mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 11:57:32 +09:00
Issue #2488 - Part 3: Remove the StyleSetHandle smart pointer class
This commit is contained in:
parent
4d7bdedade
commit
4bf43b8fb4
58 changed files with 155 additions and 589 deletions
|
|
@ -3869,7 +3869,7 @@ RestyleManager::ComputeAndProcessStyleChange(nsStyleContext* aNewContext,
|
|||
nsStyleSet*
|
||||
ElementRestyler::StyleSet() const
|
||||
{
|
||||
return mPresContext->StyleSet()->AsGecko();
|
||||
return mPresContext->StyleSet();
|
||||
}
|
||||
|
||||
AutoDisplayContentsAncestorPusher::AutoDisplayContentsAncestorPusher(
|
||||
|
|
|
|||
|
|
@ -458,7 +458,7 @@ public:
|
|||
|
||||
private:
|
||||
inline nsStyleSet* StyleSet() const {
|
||||
return PresContext()->StyleSet()->AsGecko();
|
||||
return PresContext()->StyleSet();
|
||||
}
|
||||
|
||||
/* aMinHint is the minimal change that should be made to the element */
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@
|
|||
|
||||
#include "mozilla/RestyleManagerBase.h"
|
||||
#include "mozilla/RestyleManager.h"
|
||||
#include "mozilla/StyleSetHandle.h"
|
||||
#include "mozilla/StyleSetHandleInlines.h" // for Ptr::HasStateDependentStyle
|
||||
#include "nsStyleSet.h" // for HasStateDependentStyle
|
||||
#include "ActiveLayerTracker.h"
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsCSSRendering.h"
|
||||
|
|
@ -52,7 +51,7 @@ RestyleManagerBase::ContentStateChangedInternal(Element* aElement,
|
|||
MOZ_ASSERT(aOutChangeHint);
|
||||
MOZ_ASSERT(aOutRestyleHint);
|
||||
|
||||
StyleSetHandle styleSet = PresContext()->StyleSet();
|
||||
nsStyleSet* styleSet = PresContext()->StyleSet();
|
||||
NS_ASSERTION(styleSet, "couldn't get style set");
|
||||
|
||||
*aOutChangeHint = nsChangeHint(0);
|
||||
|
|
|
|||
|
|
@ -34,8 +34,7 @@
|
|||
#include "nsPresShell.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "mozilla/StyleSetHandle.h"
|
||||
#include "mozilla/StyleSetHandleInlines.h"
|
||||
#include "nsStyleSet.h"
|
||||
#include "nsViewManager.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
|
|
@ -1837,7 +1836,7 @@ nsCSSFrameConstructor::CreateGeneratedContentItem(nsFrameConstructorState& aStat
|
|||
|
||||
MOZ_ASSERT(aParentContent->IsElement());
|
||||
|
||||
StyleSetHandle styleSet = mPresShell->StyleSet();
|
||||
nsStyleSet* styleSet = mPresShell->StyleSet();
|
||||
|
||||
// Probe for the existence of the pseudo-element
|
||||
RefPtr<nsStyleContext> pseudoStyleContext;
|
||||
|
|
@ -2691,11 +2690,11 @@ nsCSSFrameConstructor::ConstructRootFrame()
|
|||
{
|
||||
AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC);
|
||||
|
||||
StyleSetHandle styleSet = mPresShell->StyleSet();
|
||||
nsStyleSet* styleSet = mPresShell->StyleSet();
|
||||
|
||||
// Set up our style rule observer.
|
||||
// XXXbz wouldn't this make more sense as part of presshell init?
|
||||
styleSet->AsGecko()->SetBindingManager(mDocument->BindingManager());
|
||||
styleSet->SetBindingManager(mDocument->BindingManager());
|
||||
|
||||
// --------- BUILD VIEWPORT -----------
|
||||
RefPtr<nsStyleContext> viewportPseudoStyle =
|
||||
|
|
@ -2860,7 +2859,7 @@ nsCSSFrameConstructor::SetUpDocElementContainingBlock(nsIContent* aDocElement)
|
|||
// Start off with the viewport as parent; we'll adjust it as needed.
|
||||
nsContainerFrame* parentFrame = viewportFrame;
|
||||
|
||||
StyleSetHandle styleSet = mPresShell->StyleSet();
|
||||
nsStyleSet* styleSet = mPresShell->StyleSet();
|
||||
// If paginated, make sure we don't put scrollbars in
|
||||
if (!isScrollable) {
|
||||
rootPseudoStyle = styleSet->ResolveAnonymousBoxStyle(rootPseudo,
|
||||
|
|
@ -2961,7 +2960,7 @@ nsCSSFrameConstructor::ConstructPageFrame(nsIPresShell* aPresShell,
|
|||
nsContainerFrame*& aCanvasFrame)
|
||||
{
|
||||
nsStyleContext* parentStyleContext = aParentFrame->StyleContext();
|
||||
StyleSetHandle styleSet = aPresShell->StyleSet();
|
||||
nsStyleSet* styleSet = aPresShell->StyleSet();
|
||||
|
||||
RefPtr<nsStyleContext> pagePseudoStyle;
|
||||
pagePseudoStyle = styleSet->ResolveAnonymousBoxStyle(nsCSSAnonBoxes::page,
|
||||
|
|
@ -4560,7 +4559,7 @@ nsCSSFrameConstructor::BeginBuildingScrollFrame(nsFrameConstructorState& aState,
|
|||
aNewFrame = gfxScrollFrame;
|
||||
|
||||
// we used the style that was passed in. So resolve another one.
|
||||
StyleSetHandle styleSet = mPresShell->StyleSet();
|
||||
nsStyleSet* styleSet = mPresShell->StyleSet();
|
||||
RefPtr<nsStyleContext> scrolledChildStyle =
|
||||
styleSet->ResolveAnonymousBoxStyle(aScrolledPseudo, contentStyle);
|
||||
|
||||
|
|
@ -5014,7 +5013,7 @@ nsCSSFrameConstructor::ResolveStyleContext(nsStyleContext* aParentStyleContext,
|
|||
nsFrameConstructorState* aState,
|
||||
Element* aOriginatingElementOrNull)
|
||||
{
|
||||
StyleSetHandle styleSet = mPresShell->StyleSet();
|
||||
nsStyleSet* styleSet = mPresShell->StyleSet();
|
||||
aContent->OwnerDoc()->FlushPendingLinkUpdates();
|
||||
|
||||
RefPtr<nsStyleContext> result;
|
||||
|
|
@ -5096,7 +5095,7 @@ nsCSSFrameConstructor::FlushAccumulatedBlock(nsFrameConstructorState& aState,
|
|||
nsStyleContext* parentContext =
|
||||
nsFrame::CorrectStyleParentFrame(aParentFrame,
|
||||
anonPseudo)->StyleContext();
|
||||
StyleSetHandle styleSet = mPresShell->StyleSet();
|
||||
nsStyleSet* styleSet = mPresShell->StyleSet();
|
||||
RefPtr<nsStyleContext> blockContext;
|
||||
blockContext = styleSet->
|
||||
ResolveAnonymousBoxStyle(anonPseudo, parentContext);
|
||||
|
|
@ -11031,7 +11030,7 @@ nsCSSFrameConstructor::CreateFloatingLetterFrame(
|
|||
// get a proper style context for it (the one passed in is for the
|
||||
// letter frame and will have the float property set on it; the text
|
||||
// frame shouldn't have that set).
|
||||
StyleSetHandle styleSet = mPresShell->StyleSet();
|
||||
nsStyleSet* styleSet = mPresShell->StyleSet();
|
||||
RefPtr<nsStyleContext> textSC = styleSet->
|
||||
ResolveStyleForText(aTextContent, aStyleContext);
|
||||
aTextFrame->SetStyleContextWithoutNotification(textSC);
|
||||
|
|
|
|||
|
|
@ -19,8 +19,7 @@
|
|||
#include "nsIDocument.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "mozilla/StyleSetHandle.h"
|
||||
#include "mozilla/StyleSetHandleInlines.h"
|
||||
#include "nsStyleSet.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIWritablePropertyBag2.h"
|
||||
#include "nsSubDocumentFrame.h"
|
||||
|
|
@ -679,12 +678,12 @@ nsDocumentViewer::InitPresentationStuff(bool aDoInitialReflow)
|
|||
"Someone should have destroyed the presshell!");
|
||||
|
||||
// Create the style set...
|
||||
StyleSetHandle styleSet = CreateStyleSet(mDocument);
|
||||
nsStyleSet* styleSet = CreateStyleSet(mDocument);
|
||||
|
||||
// Now make the shell for the document
|
||||
mPresShell = mDocument->CreateShell(mPresContext, mViewManager, styleSet);
|
||||
if (!mPresShell) {
|
||||
styleSet->Delete();
|
||||
delete styleSet;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
|
@ -2268,7 +2267,7 @@ nsDocumentViewer::RequestWindowClose(bool* aCanClose)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
StyleSetHandle
|
||||
nsStyleSet*
|
||||
nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
||||
{
|
||||
// Make sure this does the same thing as PresShell::AddSheet wrt ordering.
|
||||
|
|
@ -2276,7 +2275,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
|||
// this should eventually get expanded to allow for creating
|
||||
// different sets for different media
|
||||
|
||||
StyleSetHandle styleSet = new nsStyleSet();
|
||||
nsStyleSet* styleSet = new nsStyleSet();
|
||||
|
||||
styleSet->BeginUpdate();
|
||||
|
||||
|
|
@ -2307,7 +2306,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
|||
}
|
||||
|
||||
if (sheet)
|
||||
styleSet->AppendStyleSheet(SheetType::User, sheet);
|
||||
styleSet->AppendStyleSheet(SheetType::User, sheet->AsGecko());
|
||||
|
||||
// Append chrome sheets (scrollbars + forms).
|
||||
bool shouldOverride = false;
|
||||
|
|
@ -2343,7 +2342,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
|||
cssLoader->LoadSheetSync(uri, &chromeSheet);
|
||||
if (!chromeSheet) continue;
|
||||
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, chromeSheet);
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, chromeSheet->AsGecko());
|
||||
shouldOverride = true;
|
||||
}
|
||||
free(str);
|
||||
|
|
@ -2354,7 +2353,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
|||
if (!shouldOverride) {
|
||||
sheet = cache->ScrollbarsSheet();
|
||||
if (sheet) {
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2370,12 +2369,12 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
|||
|
||||
sheet = cache->NumberControlSheet();
|
||||
if (sheet) {
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko());
|
||||
}
|
||||
|
||||
sheet = cache->FormsSheet();
|
||||
if (sheet) {
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko());
|
||||
}
|
||||
|
||||
if (aDocument->LoadsFullXULStyleSheetUpFront()) {
|
||||
|
|
@ -2383,7 +2382,7 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
|||
// up-front here.
|
||||
sheet = cache->XULSheet();
|
||||
if (sheet) {
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2391,25 +2390,25 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
|||
if (sheet) {
|
||||
// Load the minimal XUL rules for scrollbars and a few other XUL things
|
||||
// that non-XUL (typically HTML) documents commonly use.
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko());
|
||||
}
|
||||
|
||||
sheet = cache->CounterStylesSheet();
|
||||
if (sheet) {
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko());
|
||||
}
|
||||
|
||||
if (nsLayoutUtils::ShouldUseNoScriptSheet(aDocument)) {
|
||||
sheet = cache->NoScriptSheet();
|
||||
if (sheet) {
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko());
|
||||
}
|
||||
}
|
||||
|
||||
if (nsLayoutUtils::ShouldUseNoFramesSheet(aDocument)) {
|
||||
sheet = cache->NoFramesSheet();
|
||||
if (sheet) {
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2418,26 +2417,26 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
|||
|
||||
sheet = cache->HTMLSheet();
|
||||
if (sheet) {
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko());
|
||||
}
|
||||
|
||||
styleSet->PrependStyleSheet(SheetType::Agent,
|
||||
cache->UASheet());
|
||||
cache->UASheet()->AsGecko());
|
||||
} else {
|
||||
// SVG documents may have scrollbars and need the scrollbar styling.
|
||||
sheet = cache->MinimalXULSheet();
|
||||
if (sheet) {
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet->AsGecko());
|
||||
}
|
||||
}
|
||||
|
||||
nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance();
|
||||
if (sheetService) {
|
||||
for (StyleSheet* sheet : *sheetService->AgentStyleSheets()) {
|
||||
styleSet->AppendStyleSheet(SheetType::Agent, sheet);
|
||||
styleSet->AppendStyleSheet(SheetType::Agent, sheet->AsGecko());
|
||||
}
|
||||
for (StyleSheet* sheet : Reversed(*sheetService->UserStyleSheets())) {
|
||||
styleSet->PrependStyleSheet(SheetType::User, sheet);
|
||||
styleSet->PrependStyleSheet(SheetType::User, sheet->AsGecko());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
class nsIFrame;
|
||||
class nsIPresShell;
|
||||
class nsStyleSet;
|
||||
|
||||
class nsFrameManagerBase
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,10 +8,8 @@
|
|||
#include "nsISupports.h"
|
||||
|
||||
class nsIDocument;
|
||||
namespace mozilla {
|
||||
class StyleSetHandle;
|
||||
} // namespace mozilla
|
||||
class nsIPresShell;
|
||||
class nsStyleSet;
|
||||
class nsPresContext;
|
||||
class nsViewManager;
|
||||
|
||||
|
|
@ -38,7 +36,7 @@ public:
|
|||
// The style set returned by CreateStyleSet is in the middle of an
|
||||
// update batch so that the caller can add sheets to it if needed.
|
||||
// Callers should call EndUpdate() on it when ready to use.
|
||||
virtual mozilla::StyleSetHandle CreateStyleSet(nsIDocument* aDocument) = 0;
|
||||
virtual nsStyleSet* CreateStyleSet(nsIDocument* aDocument) = 0;
|
||||
|
||||
virtual void IncrementDestroyRefCount() = 0;
|
||||
virtual void DecrementDestroyRefCount() = 0;
|
||||
|
|
@ -74,7 +72,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentViewerPrint,
|
|||
bool GetIsPrinting() override; \
|
||||
void SetIsPrintPreview(bool aIsPrintPreview) override; \
|
||||
bool GetIsPrintPreview() override; \
|
||||
mozilla::StyleSetHandle CreateStyleSet(nsIDocument* aDocument) override; \
|
||||
nsStyleSet* CreateStyleSet(nsIDocument* aDocument) override; \
|
||||
void IncrementDestroyRefCount() override; \
|
||||
void DecrementDestroyRefCount() override; \
|
||||
void ReturnToGalleyPresentation() override; \
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/StyleSetHandle.h"
|
||||
#include "mozilla/StyleSheet.h"
|
||||
#include "mozilla/WeakPtr.h"
|
||||
#include "gfxPoint.h"
|
||||
|
|
@ -62,6 +61,7 @@ class nsIPageSequenceFrame;
|
|||
class nsCanvasFrame;
|
||||
class nsAString;
|
||||
class nsCaret;
|
||||
class nsStyleSet;
|
||||
namespace mozilla {
|
||||
class AccessibleCaretEventHub;
|
||||
class CSSStyleSheet;
|
||||
|
|
@ -323,7 +323,7 @@ public:
|
|||
#endif
|
||||
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
mozilla::StyleSetHandle StyleSet() const { return mStyleSet; }
|
||||
nsStyleSet* StyleSet() const { return mStyleSet; }
|
||||
|
||||
nsCSSFrameConstructor* FrameConstructor() const { return mFrameConstructor; }
|
||||
|
||||
|
|
@ -1722,7 +1722,7 @@ protected:
|
|||
// we must share ownership.
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
RefPtr<nsPresContext> mPresContext;
|
||||
mozilla::StyleSetHandle mStyleSet; // [OWNS]
|
||||
nsStyleSet* mStyleSet; // [OWNS]
|
||||
nsCSSFrameConstructor* mFrameConstructor; // [OWNS]
|
||||
nsViewManager* mViewManager; // [WEAK] docViewer owns it so I don't have to
|
||||
nsPresArena mFrameArena;
|
||||
|
|
|
|||
|
|
@ -114,8 +114,7 @@
|
|||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/EventStateManager.h"
|
||||
#include "mozilla/RuleNodeCacheConditions.h"
|
||||
#include "mozilla/StyleSetHandle.h"
|
||||
#include "mozilla/StyleSetHandleInlines.h"
|
||||
#include "nsStyleSet.h"
|
||||
#include "RegionBuilder.h"
|
||||
#include "SVGSVGElement.h"
|
||||
#include "nsDocument.h"
|
||||
|
|
|
|||
|
|
@ -18,8 +18,7 @@
|
|||
#include "nsDocShell.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "mozilla/StyleSetHandle.h"
|
||||
#include "mozilla/StyleSetHandleInlines.h"
|
||||
#include "nsStyleSet.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDocument.h"
|
||||
|
|
@ -1142,18 +1141,18 @@ nsPresContext::CompatibilityModeChanged()
|
|||
return;
|
||||
}
|
||||
|
||||
StyleSetHandle styleSet = mShell->StyleSet();
|
||||
nsStyleSet* styleSet = mShell->StyleSet();
|
||||
auto cache = nsLayoutStylesheetCache::Get();
|
||||
StyleSheet* sheet = cache->QuirkSheet();
|
||||
|
||||
if (needsQuirkSheet) {
|
||||
// quirk.css needs to come after html.css; we just keep it at the end.
|
||||
DebugOnly<nsresult> rv =
|
||||
styleSet->AppendStyleSheet(SheetType::Agent, sheet);
|
||||
styleSet->AppendStyleSheet(SheetType::Agent, sheet->AsGecko());
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "failed to insert quirk.css");
|
||||
} else {
|
||||
DebugOnly<nsresult> rv =
|
||||
styleSet->RemoveStyleSheet(SheetType::Agent, sheet);
|
||||
styleSet->RemoveStyleSheet(SheetType::Agent, sheet->AsGecko());
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "failed to remove quirk.css");
|
||||
}
|
||||
|
||||
|
|
@ -1375,7 +1374,7 @@ GetPropagatedScrollStylesForViewport(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
// Check the style on the document root element
|
||||
StyleSetHandle styleSet = aPresContext->StyleSet();
|
||||
nsStyleSet* styleSet = aPresContext->StyleSet();
|
||||
RefPtr<nsStyleContext> rootStyle;
|
||||
rootStyle = styleSet->ResolveStyleFor(docElement, nullptr);
|
||||
if (CheckOverflow(rootStyle->StyleDisplay(), aStyles)) {
|
||||
|
|
@ -1882,7 +1881,7 @@ nsPresContext::MediaFeatureValuesChanged(nsRestyleHint aRestyleHint,
|
|||
|
||||
// MediumFeaturesChanged updates the applied rules, so it always gets called.
|
||||
if (mShell) {
|
||||
if (mShell->StyleSet()->AsGecko()->MediumFeaturesChanged()) {
|
||||
if (mShell->StyleSet()->MediumFeaturesChanged()) {
|
||||
aRestyleHint |= eRestyle_Subtree;
|
||||
}
|
||||
}
|
||||
|
|
@ -2135,7 +2134,7 @@ nsPresContext::NotifyMissingFonts()
|
|||
void
|
||||
nsPresContext::EnsureSafeToHandOutCSSRules()
|
||||
{
|
||||
nsStyleSet* styleSet = mShell->StyleSet()->GetAsGecko();
|
||||
nsStyleSet* styleSet = mShell->StyleSet();
|
||||
if (!styleSet) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -2475,7 +2474,7 @@ nsPresContext::HasCachedStyleData()
|
|||
return false;
|
||||
}
|
||||
|
||||
nsStyleSet* styleSet = mShell->StyleSet()->GetAsGecko();
|
||||
nsStyleSet* styleSet = mShell->StyleSet();
|
||||
if (!styleSet) {
|
||||
return mShell->DidInitialize();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ public:
|
|||
}
|
||||
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
mozilla::StyleSetHandle StyleSet() { return GetPresShell()->StyleSet(); }
|
||||
nsStyleSet* StyleSet() { return GetPresShell()->StyleSet(); }
|
||||
|
||||
nsFrameManager* FrameManager()
|
||||
{ return PresShell()->FrameManager(); }
|
||||
|
|
|
|||
|
|
@ -190,8 +190,6 @@
|
|||
#include "mozilla/layers/InputAPZContext.h"
|
||||
#include "mozilla/layers/ScrollInputMethods.h"
|
||||
#include "nsStyleSet.h"
|
||||
#include "mozilla/StyleSetHandle.h"
|
||||
#include "mozilla/StyleSetHandleInlines.h"
|
||||
#include "mozilla/StyleSheet.h"
|
||||
#include "mozilla/StyleSheetInlines.h"
|
||||
#include "mozilla/dom/ImageTracker.h"
|
||||
|
|
@ -848,7 +846,7 @@ PresShell::~PresShell()
|
|||
|
||||
MOZ_ASSERT(mAllocatedPointers.IsEmpty(), "Some pres arena objects were not freed");
|
||||
|
||||
mStyleSet->Delete();
|
||||
delete mStyleSet;
|
||||
delete mFrameConstructor;
|
||||
|
||||
mCurrentEventContent = nullptr;
|
||||
|
|
@ -864,7 +862,7 @@ void
|
|||
PresShell::Init(nsIDocument* aDocument,
|
||||
nsPresContext* aPresContext,
|
||||
nsViewManager* aViewManager,
|
||||
StyleSetHandle aStyleSet)
|
||||
nsStyleSet* aStyleSet)
|
||||
{
|
||||
NS_PRECONDITION(aDocument, "null ptr");
|
||||
NS_PRECONDITION(aPresContext, "null ptr");
|
||||
|
|
@ -1400,7 +1398,7 @@ PresShell::UpdatePreferenceStyles()
|
|||
|
||||
RemovePreferenceStyles();
|
||||
|
||||
mStyleSet->AppendStyleSheet(SheetType::User, newPrefSheet);
|
||||
mStyleSet->AppendStyleSheet(SheetType::User, newPrefSheet->AsGecko());
|
||||
mPrefStyleSheet = newPrefSheet;
|
||||
|
||||
mStyleSet->EndUpdate();
|
||||
|
|
@ -1410,7 +1408,7 @@ void
|
|||
PresShell::RemovePreferenceStyles()
|
||||
{
|
||||
if (mPrefStyleSheet) {
|
||||
mStyleSet->RemoveStyleSheet(SheetType::User, mPrefStyleSheet);
|
||||
mStyleSet->RemoveStyleSheet(SheetType::User, mPrefStyleSheet->AsGecko());
|
||||
mPrefStyleSheet = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
@ -1433,13 +1431,13 @@ PresShell::AddUserSheet(nsISupports* aSheet)
|
|||
// Iterate forwards when removing so the searches for RemoveStyleSheet are as
|
||||
// short as possible.
|
||||
for (StyleSheet* sheet : userSheets) {
|
||||
mStyleSet->RemoveStyleSheet(SheetType::User, sheet);
|
||||
mStyleSet->RemoveStyleSheet(SheetType::User, sheet->AsGecko());
|
||||
}
|
||||
|
||||
// Now iterate backwards, so that the order of userSheets will be the same as
|
||||
// the order of sheets from it in the style set.
|
||||
for (StyleSheet* sheet : Reversed(userSheets)) {
|
||||
mStyleSet->PrependStyleSheet(SheetType::User, sheet);
|
||||
mStyleSet->PrependStyleSheet(SheetType::User, sheet->AsGecko());
|
||||
}
|
||||
|
||||
mStyleSet->EndUpdate();
|
||||
|
|
@ -1457,7 +1455,7 @@ PresShell::AddAgentSheet(nsISupports* aSheet)
|
|||
return;
|
||||
}
|
||||
|
||||
mStyleSet->AppendStyleSheet(SheetType::Agent, sheet);
|
||||
mStyleSet->AppendStyleSheet(SheetType::Agent, sheet->AsGecko());
|
||||
RestyleForCSSRuleChanges();
|
||||
}
|
||||
|
||||
|
|
@ -1474,9 +1472,9 @@ PresShell::AddAuthorSheet(nsISupports* aSheet)
|
|||
StyleSheet* firstAuthorSheet =
|
||||
mDocument->GetFirstAdditionalAuthorSheet();
|
||||
if (firstAuthorSheet) {
|
||||
mStyleSet->InsertStyleSheetBefore(SheetType::Doc, sheet, firstAuthorSheet);
|
||||
mStyleSet->InsertStyleSheetBefore(SheetType::Doc, sheet->AsGecko(), firstAuthorSheet->AsGecko());
|
||||
} else {
|
||||
mStyleSet->AppendStyleSheet(SheetType::Doc, sheet);
|
||||
mStyleSet->AppendStyleSheet(SheetType::Doc, sheet->AsGecko());
|
||||
}
|
||||
|
||||
RestyleForCSSRuleChanges();
|
||||
|
|
@ -1490,7 +1488,7 @@ PresShell::RemoveSheet(SheetType aType, nsISupports* aSheet)
|
|||
return;
|
||||
}
|
||||
|
||||
mStyleSet->RemoveStyleSheet(aType, sheet);
|
||||
mStyleSet->RemoveStyleSheet(aType, sheet->AsGecko());
|
||||
RestyleForCSSRuleChanges();
|
||||
}
|
||||
|
||||
|
|
@ -4168,7 +4166,7 @@ PresShell::DocumentStatesChanged(nsIDocument* aDocument,
|
|||
NS_PRECONDITION(!mIsDocumentGone, "Unexpected DocumentStatesChanged");
|
||||
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument");
|
||||
|
||||
nsStyleSet* styleSet = mStyleSet->GetAsGecko();
|
||||
nsStyleSet* styleSet = mStyleSet;
|
||||
if (!styleSet) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -8772,19 +8770,23 @@ PresShell::GetAgentStyleSheets(nsTArray<RefPtr<StyleSheet>>& aSheets)
|
|||
nsresult
|
||||
PresShell::SetAgentStyleSheets(const nsTArray<RefPtr<StyleSheet>>& aSheets)
|
||||
{
|
||||
return mStyleSet->ReplaceSheets(SheetType::Agent, aSheets);
|
||||
nsTArray<RefPtr<CSSStyleSheet>> newSheets(aSheets.Length());
|
||||
for (auto& sheet : aSheets) {
|
||||
newSheets.AppendElement(sheet->AsGecko());
|
||||
}
|
||||
return mStyleSet->ReplaceSheets(SheetType::Agent, newSheets);
|
||||
}
|
||||
|
||||
nsresult
|
||||
PresShell::AddOverrideStyleSheet(StyleSheet* aSheet)
|
||||
{
|
||||
return mStyleSet->PrependStyleSheet(SheetType::Override, aSheet);
|
||||
return mStyleSet->PrependStyleSheet(SheetType::Override, aSheet->AsGecko());
|
||||
}
|
||||
|
||||
nsresult
|
||||
PresShell::RemoveOverrideStyleSheet(StyleSheet* aSheet)
|
||||
{
|
||||
return mStyleSet->RemoveStyleSheet(SheetType::Override, aSheet);
|
||||
return mStyleSet->RemoveStyleSheet(SheetType::Override, aSheet->AsGecko());
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -9957,7 +9959,7 @@ PresShell::VerifyIncrementalReflow()
|
|||
|
||||
// Create a new presentation shell to view the document. Use the
|
||||
// exact same style information that this document has.
|
||||
nsAutoPtr<nsStyleSet> newSet(CloneStyleSet(mStyleSet->AsGecko()));
|
||||
nsAutoPtr<nsStyleSet> newSet(CloneStyleSet(mStyleSet));
|
||||
nsCOMPtr<nsIPresShell> sh = mDocument->CreateShell(cx, vm, newSet.get());
|
||||
NS_ENSURE_TRUE(sh, false);
|
||||
newSet.forget();
|
||||
|
|
@ -10802,7 +10804,7 @@ PresShell::AddSizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
|
|||
*aPresShellSize += mFramesToDirty.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||
*aPresShellSize += aArenaObjectsSize->mOther;
|
||||
|
||||
if (nsStyleSet* styleSet = StyleSet()->GetAsGecko()) {
|
||||
if (nsStyleSet* styleSet = StyleSet()) {
|
||||
*aStyleSetsSize += styleSet->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
|
|
@ -11010,7 +11012,7 @@ nsIPresShell::HasRuleProcessorUsedByMultipleStyleSets(uint32_t aSheetType,
|
|||
}
|
||||
|
||||
*aRetVal = false;
|
||||
if (nsStyleSet* styleSet = mStyleSet->GetAsGecko()) {
|
||||
if (nsStyleSet* styleSet = mStyleSet) {
|
||||
*aRetVal = styleSet->HasRuleProcessorUsedByMultipleStyleSets(type);
|
||||
}
|
||||
return NS_OK;
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/StyleSetHandle.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "MobileViewportManager.h"
|
||||
#include "ZoomConstraintsClient.h"
|
||||
|
||||
class nsIDocShell;
|
||||
class nsRange;
|
||||
class nsStyleSet;
|
||||
|
||||
struct RangePaintInfo;
|
||||
struct nsCallbackEventRequest;
|
||||
|
|
@ -100,7 +100,7 @@ public:
|
|||
static bool IsTargetIframe(nsINode* aTarget);
|
||||
|
||||
void Init(nsIDocument* aDocument, nsPresContext* aPresContext,
|
||||
nsViewManager* aViewManager, mozilla::StyleSetHandle aStyleSet);
|
||||
nsViewManager* aViewManager, nsStyleSet* aStyleSet);
|
||||
virtual void Destroy() override;
|
||||
virtual void MakeZombie() override;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue