Bug 1528914 - Tidy the relationship between the doc shell and the pres context. r=qdot

Make it always forward to the document's docshell. We rely on it being setup by
the time our stuff runs, and we cannot have multiple pres contexts per document
in different docshells anymore.

This allows me to also move some state to the document (about whether it's
currently loaded in a chrome docshell (nsPresContext::mIsChrome) and whether
it's a chrome origin image (nsPresContext::mIsChromeOriginImage), which will
help for bug 1490401 / bug 1418159.

The pres context already relies on having the docshell available on `Init` and
we don't properly handle dynamic changes to it.

The reason I store some state like whether the doc URI is chrome:// and whether
we're in a chrome docshell is not (only) to avoid recomputing it over and over,
but also to allow me to read them from Stylo (main-thread blocked, but poke at
that from multiple non-main-threads).

Differential Revision: https://phabricator.services.mozilla.com/D20301

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-02-19 22:53:40 +00:00
parent 695a8e0608
commit a59f4ed1fb
8 changed files with 85 additions and 164 deletions

View file

@ -1227,6 +1227,8 @@ Document::Document(const char* aContentType)
mInUnlinkOrDeletion(false), mInUnlinkOrDeletion(false),
mHasHadScriptHandlingObject(false), mHasHadScriptHandlingObject(false),
mIsBeingUsedAsImage(false), mIsBeingUsedAsImage(false),
mDocURISchemeIsChrome(false),
mInChromeDocShell(false),
mIsSyntheticDocument(false), mIsSyntheticDocument(false),
mHasLinksToUpdateRunnable(false), mHasLinksToUpdateRunnable(false),
mFlushingPendingLinkUpdates(false), mFlushingPendingLinkUpdates(false),
@ -2835,6 +2837,8 @@ void Document::SetDocumentURI(nsIURI* aURI) {
mDocumentURI = aURI; mDocumentURI = aURI;
nsIURI* newBase = GetDocBaseURI(); nsIURI* newBase = GetDocBaseURI();
mDocURISchemeIsChrome = aURI && IsChromeURI(aURI);
bool equalBases = false; bool equalBases = false;
// Changing just the ref of a URI does not change how relative URIs would // Changing just the ref of a URI does not change how relative URIs would
// resolve wrt to it, so we can treat the bases as equal as long as they're // resolve wrt to it, so we can treat the bases as equal as long as they're
@ -4301,6 +4305,9 @@ void Document::SetContainer(nsDocShell* aContainer) {
mDocumentContainer = WeakPtr<nsDocShell>(); mDocumentContainer = WeakPtr<nsDocShell>();
} }
mInChromeDocShell =
aContainer && aContainer->ItemType() == nsIDocShellTreeItem::typeChrome;
EnumerateActivityObservers(NotifyActivityChanged, nullptr); EnumerateActivityObservers(NotifyActivityChanged, nullptr);
// IsTopLevelWindowInactive depends on the docshell, so // IsTopLevelWindowInactive depends on the docshell, so

View file

@ -2474,6 +2474,16 @@ class Document : public nsINode,
return !mParentDocument && !mDisplayDocument; return !mParentDocument && !mDisplayDocument;
} }
bool IsDocumentURISchemeChrome() const { return mDocURISchemeIsChrome; }
bool IsInChromeDocShell() const {
const Document* root = this;
while (const Document* displayDoc = root->GetDisplayDocument()) {
root = displayDoc;
}
return root->mInChromeDocShell;
}
bool IsBeingUsedAsImage() const { return mIsBeingUsedAsImage; } bool IsBeingUsedAsImage() const { return mIsBeingUsedAsImage; }
void SetIsBeingUsedAsImage() { mIsBeingUsedAsImage = true; } void SetIsBeingUsedAsImage() { mIsBeingUsedAsImage = true; }
@ -4007,6 +4017,12 @@ class Document : public nsINode,
// True if we're an SVG document being used as an image. // True if we're an SVG document being used as an image.
bool mIsBeingUsedAsImage : 1; bool mIsBeingUsedAsImage : 1;
// True if our current document URI's scheme is chrome://
bool mDocURISchemeIsChrome : 1;
// True if we're loaded in a chrome docshell.
bool mInChromeDocShell : 1;
// True is this document is synthetic : stand alone image, video, audio // True is this document is synthetic : stand alone image, video, audio
// file, etc. // file, etc.
bool mIsSyntheticDocument : 1; bool mIsSyntheticDocument : 1;

View file

@ -3851,10 +3851,6 @@ void nsContentUtils::LogMessageToConsole(const char* aMsg) {
sConsoleService->LogStringMessage(NS_ConvertUTF8toUTF16(aMsg).get()); sConsoleService->LogStringMessage(NS_ConvertUTF8toUTF16(aMsg).get());
} }
bool nsContentUtils::IsChromeDoc(const Document* aDocument) {
return aDocument && aDocument->NodePrincipal() == sSystemPrincipal;
}
bool nsContentUtils::IsChildOfSameType(Document* aDoc) { bool nsContentUtils::IsChildOfSameType(Document* aDoc) {
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(aDoc->GetDocShell()); nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(aDoc->GetDocShell());
nsCOMPtr<nsIDocShellTreeItem> sameTypeParent; nsCOMPtr<nsIDocShellTreeItem> sameTypeParent;
@ -3888,24 +3884,6 @@ bool nsContentUtils::IsUtf8OnlyPlainTextType(const nsACString& aContentType) {
aContentType.EqualsLiteral(TEXT_VTT); aContentType.EqualsLiteral(TEXT_VTT);
} }
// static
bool nsContentUtils::IsInChromeDocshell(Document* aDocument) {
if (!aDocument) {
return false;
}
if (aDocument->GetDisplayDocument()) {
return IsInChromeDocshell(aDocument->GetDisplayDocument());
}
nsCOMPtr<nsIDocShellTreeItem> docShell = aDocument->GetDocShell();
if (!docShell) {
return false;
}
return docShell->ItemType() == nsIDocShellTreeItem::typeChrome;
}
// static // static
nsIContentPolicy* nsContentUtils::GetContentPolicy() { nsIContentPolicy* nsContentUtils::GetContentPolicy() {
if (!sTriedToGetContentPolicy) { if (!sTriedToGetContentPolicy) {

View file

@ -1227,7 +1227,9 @@ class nsContentUtils {
/** /**
* Returns true if aDocument is a chrome document * Returns true if aDocument is a chrome document
*/ */
static bool IsChromeDoc(const Document* aDocument); static bool IsChromeDoc(const Document* aDocument) {
return aDocument && aDocument->NodePrincipal() == sSystemPrincipal;
}
/** /**
* Returns true if aDocument is in a docshell whose parent is the same type * Returns true if aDocument is in a docshell whose parent is the same type
@ -1250,7 +1252,9 @@ class nsContentUtils {
* display purposes. Returns false for null documents or documents * display purposes. Returns false for null documents or documents
* which do not belong to a docshell. * which do not belong to a docshell.
*/ */
static bool IsInChromeDocshell(Document* aDocument); static bool IsInChromeDocshell(const Document* aDocument) {
return aDocument && aDocument->IsInChromeDocShell();
}
/** /**
* Return the content policy service * Return the content policy service

View file

@ -689,9 +689,6 @@ nsresult nsDocumentViewer::SyncParentSubDocMap() {
NS_IMETHODIMP NS_IMETHODIMP
nsDocumentViewer::SetContainer(nsIDocShell* aContainer) { nsDocumentViewer::SetContainer(nsIDocShell* aContainer) {
mContainer = static_cast<nsDocShell*>(aContainer); mContainer = static_cast<nsDocShell*>(aContainer);
if (mPresContext) {
mPresContext->SetContainer(mContainer);
}
// We're loading a new document into the window where this document // We're loading a new document into the window where this document
// viewer lives, sync the parent document's frame element -> sub // viewer lives, sync the parent document's frame element -> sub
@ -953,8 +950,6 @@ nsresult nsDocumentViewer::InitInternal(nsIWidget* aParentWidget,
nsCOMPtr<nsILinkHandler> linkHandler; nsCOMPtr<nsILinkHandler> linkHandler;
requestor->GetInterface(NS_GET_IID(nsILinkHandler), requestor->GetInterface(NS_GET_IID(nsILinkHandler),
getter_AddRefs(linkHandler)); getter_AddRefs(linkHandler));
mPresContext->SetContainer(mContainer);
mPresContext->SetLinkHandler(linkHandler); mPresContext->SetLinkHandler(linkHandler);
} }
@ -1476,7 +1471,6 @@ static void AttachContainerRecurse(nsIDocShell* aShell) {
} }
RefPtr<nsPresContext> pc = viewer->GetPresContext(); RefPtr<nsPresContext> pc = viewer->GetPresContext();
if (pc) { if (pc) {
pc->SetContainer(static_cast<nsDocShell*>(aShell));
nsCOMPtr<nsILinkHandler> handler = do_QueryInterface(aShell); nsCOMPtr<nsILinkHandler> handler = do_QueryInterface(aShell);
pc->SetLinkHandler(handler); pc->SetLinkHandler(handler);
} }
@ -1501,7 +1495,9 @@ NS_IMETHODIMP
nsDocumentViewer::Open(nsISupports* aState, nsISHEntry* aSHEntry) { nsDocumentViewer::Open(nsISupports* aState, nsISHEntry* aSHEntry) {
NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_INITIALIZED); NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_INITIALIZED);
if (mDocument) mDocument->SetContainer(mContainer); if (mDocument) {
mDocument->SetContainer(mContainer);
}
nsresult rv = InitInternal(mParentWidget, aState, mBounds, false); nsresult rv = InitInternal(mParentWidget, aState, mBounds, false);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
@ -2171,8 +2167,6 @@ nsDocumentViewer::Show(void) {
if (linkHandler) { if (linkHandler) {
mPresContext->SetLinkHandler(linkHandler); mPresContext->SetLinkHandler(linkHandler);
} }
mPresContext->SetContainer(mContainer);
} }
if (mPresContext) { if (mPresContext) {

View file

@ -222,14 +222,11 @@ nsPresContext::nsPresContext(dom::Document* aDocument, nsPresContextType aType)
mFontFeatureValuesDirty(true), mFontFeatureValuesDirty(true),
mSuppressResizeReflow(false), mSuppressResizeReflow(false),
mIsVisual(false), mIsVisual(false),
mIsChrome(false),
mIsChromeOriginImage(false),
mPaintFlashing(false), mPaintFlashing(false),
mPaintFlashingInitialized(false), mPaintFlashingInitialized(false),
mHasWarnedAboutPositionedTableParts(false), mHasWarnedAboutPositionedTableParts(false),
mHasWarnedAboutTooLargeDashedOrDottedRadius(false), mHasWarnedAboutTooLargeDashedOrDottedRadius(false),
mQuirkSheetAdded(false), mQuirkSheetAdded(false),
mNeedsPrefUpdate(false),
mHadNonBlankPaint(false), mHadNonBlankPaint(false),
mHadContentfulPaint(false), mHadContentfulPaint(false),
mHadContentfulPaintComposite(false) mHadContentfulPaintComposite(false)
@ -359,6 +356,15 @@ static bool sLookAndFeelChanged;
// one prescontext. // one prescontext.
static bool sThemeChanged; static bool sThemeChanged;
bool nsPresContext::IsChrome() const {
return Document()->IsInChromeDocShell();
}
bool nsPresContext::IsChromeOriginImage() const {
return Document()->IsBeingUsedAsImage() &&
Document()->IsDocumentURISchemeChrome();
}
void nsPresContext::GetDocumentColorPreferences() { void nsPresContext::GetDocumentColorPreferences() {
// Make sure the preferences are initialized. In the normal run, // Make sure the preferences are initialized. In the normal run,
// they would already be, because gfxPlatform would have been created, // they would already be, because gfxPlatform would have been created,
@ -367,7 +373,6 @@ void nsPresContext::GetDocumentColorPreferences() {
int32_t useAccessibilityTheme = 0; int32_t useAccessibilityTheme = 0;
bool usePrefColors = true; bool usePrefColors = true;
bool isChromeDocShell = false;
static int32_t sDocumentColorsSetting; static int32_t sDocumentColorsSetting;
static bool sDocumentColorsSettingPrefCached = false; static bool sDocumentColorsSettingPrefCached = false;
if (!sDocumentColorsSettingPrefCached) { if (!sDocumentColorsSettingPrefCached) {
@ -376,22 +381,7 @@ void nsPresContext::GetDocumentColorPreferences() {
"browser.display.document_color_use", 0); "browser.display.document_color_use", 0);
} }
dom::Document* doc = mDocument->GetDisplayDocument(); if (IsChrome() || IsChromeOriginImage()) {
if (doc && doc->GetDocShell()) {
isChromeDocShell =
nsIDocShellTreeItem::typeChrome == doc->GetDocShell()->ItemType();
} else {
nsCOMPtr<nsIDocShellTreeItem> docShell(mContainer);
if (docShell) {
isChromeDocShell =
nsIDocShellTreeItem::typeChrome == docShell->ItemType();
}
}
mIsChromeOriginImage = mDocument->IsBeingUsedAsImage() &&
IsChromeURI(mDocument->GetDocumentURI());
if (isChromeDocShell || mIsChromeOriginImage) {
usePrefColors = false; usePrefColors = false;
} else { } else {
useAccessibilityTheme = useAccessibilityTheme =
@ -441,11 +431,10 @@ void nsPresContext::GetDocumentColorPreferences() {
if (sDocumentColorsSetting == 1 || mDocument->IsBeingUsedAsImage()) { if (sDocumentColorsSetting == 1 || mDocument->IsBeingUsedAsImage()) {
mUseDocumentColors = true; mUseDocumentColors = true;
} else if (sDocumentColorsSetting == 2) { } else if (sDocumentColorsSetting == 2) {
mUseDocumentColors = isChromeDocShell || mIsChromeOriginImage; mUseDocumentColors = IsChrome() || IsChromeOriginImage();
} else { } else {
MOZ_ASSERT( MOZ_ASSERT(!useAccessibilityTheme || !(IsChrome() || IsChromeOriginImage()),
!useAccessibilityTheme || !(isChromeDocShell || mIsChromeOriginImage), "The accessibility theme should only be on for non-chrome");
"The accessibility theme should only be on for non-chrome");
mUseDocumentColors = !useAccessibilityTheme; mUseDocumentColors = !useAccessibilityTheme;
} }
} }
@ -678,14 +667,7 @@ void nsPresContext::UpdateAfterPreferencesChanged() {
return; return;
} }
if (!mContainer) { if (mDocument->IsInChromeDocShell()) {
// Delay updating until there is a container
mNeedsPrefUpdate = true;
return;
}
nsCOMPtr<nsIDocShellTreeItem> docShell(mContainer);
if (docShell && nsIDocShellTreeItem::typeChrome == docShell->ItemType()) {
return; return;
} }
@ -753,7 +735,6 @@ nsresult nsPresContext::Init(nsDeviceContext* aDeviceContext) {
"How did we end up with a presshell if our parent doesn't " "How did we end up with a presshell if our parent doesn't "
"have one?"); "have one?");
if (parent && parent->GetPresContext()) { if (parent && parent->GetPresContext()) {
// We don't have our container set yet at this point
nsCOMPtr<nsIDocShellTreeItem> ourItem = mDocument->GetDocShell(); nsCOMPtr<nsIDocShellTreeItem> ourItem = mDocument->GetDocShell();
if (ourItem) { if (ourItem) {
nsCOMPtr<nsIDocShellTreeItem> parentItem; nsCOMPtr<nsIDocShellTreeItem> parentItem;
@ -812,32 +793,28 @@ void nsPresContext::AttachShell(nsIPresShell* aShell) {
mCounterStyleManager = new mozilla::CounterStyleManager(this); mCounterStyleManager = new mozilla::CounterStyleManager(this);
dom::Document* doc = mShell->GetDocument(); dom::Document* doc = mShell->GetDocument();
NS_ASSERTION(doc, "expect document here"); MOZ_ASSERT(doc);
if (doc) { // Have to update PresContext's mDocument before calling any other methods.
// Have to update PresContext's mDocument before calling any other methods. mDocument = doc;
mDocument = doc;
}
// Initialize our state from the user preferences, now that we // Initialize our state from the user preferences, now that we
// have a presshell, and hence a document. // have a presshell, and hence a document.
GetUserPreferences(); GetUserPreferences();
if (doc) { nsIURI* docURI = doc->GetDocumentURI();
nsIURI* docURI = doc->GetDocumentURI();
if (IsDynamic() && docURI) { if (IsDynamic() && docURI) {
bool isChrome = false; bool isChrome = false;
bool isRes = false; bool isRes = false;
docURI->SchemeIs("chrome", &isChrome); docURI->SchemeIs("chrome", &isChrome);
docURI->SchemeIs("resource", &isRes); docURI->SchemeIs("resource", &isRes);
if (!isChrome && !isRes) if (!isChrome && !isRes)
mImageAnimationMode = mImageAnimationModePref; mImageAnimationMode = mImageAnimationModePref;
else else
mImageAnimationMode = imgIContainer::kNormalAnimMode; mImageAnimationMode = imgIContainer::kNormalAnimMode;
}
UpdateCharSet(doc->GetDocumentCharacterSet());
} }
UpdateCharSet(doc->GetDocumentCharacterSet());
} }
void nsPresContext::DetachShell() { void nsPresContext::DetachShell() {
@ -1302,45 +1279,17 @@ bool nsPresContext::ElementWouldPropagateScrollStyles(const Element& aElement) {
return GetPropagatedScrollStylesForViewport(this, &dummy) == &aElement; return GetPropagatedScrollStylesForViewport(this, &dummy) == &aElement;
} }
void nsPresContext::SetContainer(nsIDocShell* aDocShell) { nsISupports* nsPresContext::GetContainerWeak() const { return GetDocShell(); }
if (aDocShell) {
NS_ASSERTION(!(mContainer && mNeedsPrefUpdate), nsIDocShell* nsPresContext::GetDocShell() const {
"Should only need pref update if mContainer is null."); return mDocument->GetDocShell();
mContainer = static_cast<nsDocShell*>(aDocShell);
if (mNeedsPrefUpdate) {
DispatchPrefChangedRunnableIfNeeded();
mNeedsPrefUpdate = false;
}
} else {
mContainer = WeakPtr<nsDocShell>();
}
UpdateIsChrome();
if (mContainer) {
GetDocumentColorPreferences();
}
} }
nsISupports* nsPresContext::GetContainerWeak() const { /* virtual */ void nsPresContext::Detach() { SetLinkHandler(nullptr); }
return static_cast<nsIDocShell*>(mContainer);
}
nsIDocShell* nsPresContext::GetDocShell() const { return mContainer; }
/* virtual */ void nsPresContext::Detach() {
SetContainer(nullptr);
SetLinkHandler(nullptr);
}
bool nsPresContext::BidiEnabled() const { return Document()->GetBidiEnabled(); } bool nsPresContext::BidiEnabled() const { return Document()->GetBidiEnabled(); }
void nsPresContext::SetBidiEnabled() const { void nsPresContext::SetBidiEnabled() const { Document()->SetBidiEnabled(); }
if (mShell) {
dom::Document* doc = mShell->GetDocument();
if (doc) {
doc->SetBidiEnabled();
}
}
}
void nsPresContext::SetBidi(uint32_t aSource) { void nsPresContext::SetBidi(uint32_t aSource) {
// Don't do all this stuff unless the options have changed. // Don't do all this stuff unless the options have changed.
@ -1358,10 +1307,7 @@ void nsPresContext::SetBidi(uint32_t aSource) {
} else if (IBMBIDI_TEXTTYPE_LOGICAL == GET_BIDI_OPTION_TEXTTYPE(aSource)) { } else if (IBMBIDI_TEXTTYPE_LOGICAL == GET_BIDI_OPTION_TEXTTYPE(aSource)) {
SetVisualMode(false); SetVisualMode(false);
} else { } else {
dom::Document* doc = mShell->GetDocument(); SetVisualMode(IsVisualCharset(Document()->GetDocumentCharacterSet()));
if (doc) {
SetVisualMode(IsVisualCharset(doc->GetDocumentCharacterSet()));
}
} }
} }
@ -1790,20 +1736,19 @@ void nsPresContext::SetPrintSettings(nsIPrintSettings* aPrintSettings) {
} }
bool nsPresContext::EnsureVisible() { bool nsPresContext::EnsureVisible() {
nsCOMPtr<nsIDocShell> docShell(mContainer); nsCOMPtr<nsIDocShell> docShell(GetDocShell());
if (docShell) { if (!docShell) {
nsCOMPtr<nsIContentViewer> cv; return false;
docShell->GetContentViewer(getter_AddRefs(cv));
// Make sure this is the content viewer we belong with
if (cv && cv->GetPresContext() == this) {
// OK, this is us. We want to call Show() on the content viewer.
nsresult result = cv->Show();
if (NS_SUCCEEDED(result)) {
return true;
}
}
} }
return false; nsCOMPtr<nsIContentViewer> cv;
docShell->GetContentViewer(getter_AddRefs(cv));
// Make sure this is the content viewer we belong with
if (!cv || cv->GetPresContext() != this) {
return false;
}
// OK, this is us. We want to call Show() on the content viewer.
nsresult result = cv->Show();
return NS_SUCCEEDED(result);
} }
#ifdef MOZ_REFLOW_PERF #ifdef MOZ_REFLOW_PERF
@ -1814,11 +1759,6 @@ void nsPresContext::CountReflows(const char* aName, nsIFrame* aFrame) {
} }
#endif #endif
void nsPresContext::UpdateIsChrome() {
mIsChrome =
mContainer && nsIDocShellTreeItem::typeChrome == mContainer->ItemType();
}
bool nsPresContext::HasAuthorSpecifiedRules(const nsIFrame* aFrame, bool nsPresContext::HasAuthorSpecifiedRules(const nsIFrame* aFrame,
uint32_t aRuleTypeMask) const { uint32_t aRuleTypeMask) const {
Element* elem = aFrame->GetContent()->AsElement(); Element* elem = aFrame->GetContent()->AsElement();
@ -2592,12 +2532,8 @@ nscoord nsPresContext::PhysicalMillimetersToAppUnits(float aMM) const {
} }
bool nsPresContext::IsDeviceSizePageSize() { bool nsPresContext::IsDeviceSizePageSize() {
bool isDeviceSizePageSize = false; nsIDocShell* docShell = GetDocShell();
nsCOMPtr<nsIDocShell> docShell(mContainer); return docShell && docShell->GetDeviceSizeIsPageSize();
if (docShell) {
isDeviceSizePageSize = docShell->GetDeviceSizeIsPageSize();
}
return isDeviceSizePageSize;
} }
uint64_t nsPresContext::GetRestyleGeneration() const { uint64_t nsPresContext::GetRestyleGeneration() const {

View file

@ -413,7 +413,6 @@ class nsPresContext : public nsISupports,
bool GetFocusRingOnAnything() const { return mFocusRingOnAnything; } bool GetFocusRingOnAnything() const { return mFocusRingOnAnything; }
uint8_t GetFocusRingStyle() const { return mFocusRingStyle; } uint8_t GetFocusRingStyle() const { return mFocusRingStyle; }
void SetContainer(nsIDocShell* aContainer);
nsISupports* GetContainerWeak() const; nsISupports* GetContainerWeak() const;
@ -425,7 +424,7 @@ class nsPresContext : public nsISupports,
/** /**
* Detach this pres context - i.e. cancel relevant timers, * Detach this pres context - i.e. cancel relevant timers,
* SetLinkHandler(null), SetContainer(null) etc. * SetLinkHandler(null), etc.
* Only to be used by the DocumentViewer. * Only to be used by the DocumentViewer.
*/ */
virtual void Detach(); virtual void Detach();
@ -871,9 +870,8 @@ class nsPresContext : public nsISupports,
} }
// Is this presentation in a chrome docshell? // Is this presentation in a chrome docshell?
bool IsChrome() const { return mIsChrome; } bool IsChrome() const;
bool IsChromeOriginImage() const { return mIsChromeOriginImage; } bool IsChromeOriginImage() const;
void UpdateIsChrome();
// Public API for native theme code to get style internals. // Public API for native theme code to get style internals.
bool HasAuthorSpecifiedRules(const nsIFrame* aFrame, bool HasAuthorSpecifiedRules(const nsIFrame* aFrame,
@ -1195,8 +1193,6 @@ class nsPresContext : public nsISupports,
bool mInflationDisabledForShrinkWrap; bool mInflationDisabledForShrinkWrap;
protected: protected:
mozilla::WeakPtr<nsDocShell> mContainer;
float mSystemFontScale; // Internal text zoom factor, defaults to 1.0 float mSystemFontScale; // Internal text zoom factor, defaults to 1.0
float mTextZoom; // Text zoom, defaults to 1.0 float mTextZoom; // Text zoom, defaults to 1.0
float mEffectiveTextZoom; // Text zoom * system font scale float mEffectiveTextZoom; // Text zoom * system font scale
@ -1323,9 +1319,6 @@ class nsPresContext : public nsISupports,
unsigned mIsVisual : 1; unsigned mIsVisual : 1;
unsigned mIsChrome : 1;
unsigned mIsChromeOriginImage : 1;
// Should we paint flash in this context? Do not use this variable directly. // Should we paint flash in this context? Do not use this variable directly.
// Use GetPaintFlashing() method instead. // Use GetPaintFlashing() method instead.
mutable unsigned mPaintFlashing : 1; mutable unsigned mPaintFlashing : 1;
@ -1338,9 +1331,6 @@ class nsPresContext : public nsISupports,
// Have we added quirk.css to the style set? // Have we added quirk.css to the style set?
unsigned mQuirkSheetAdded : 1; unsigned mQuirkSheetAdded : 1;
// Is there a pref update to process once we have a container?
unsigned mNeedsPrefUpdate : 1;
// Has NotifyNonBlankPaint been called on this PresContext? // Has NotifyNonBlankPaint been called on this PresContext?
unsigned mHadNonBlankPaint : 1; unsigned mHadNonBlankPaint : 1;
// Has NotifyContentfulPaint been called on this PresContext? // Has NotifyContentfulPaint been called on this PresContext?

View file

@ -2270,10 +2270,6 @@ nsresult nsPrintJob::ReflowPrintObject(const UniquePtr<nsPrintObject>& aPO) {
aPO.get(), aPO->mPresShell.get(), gFrameTypesStr[aPO->mFrameType], aPO.get(), aPO->mPresShell.get(), gFrameTypesStr[aPO->mFrameType],
adjSize.width, adjSize.height)); adjSize.width, adjSize.height));
// This docshell stuff is weird; will go away when we stop having multiple
// presentations per document
aPO->mPresContext->SetContainer(aPO->mDocShell);
aPO->mPresShell->BeginObservingDocument(); aPO->mPresShell->BeginObservingDocument();
aPO->mPresContext->SetPageSize(adjSize); aPO->mPresContext->SetPageSize(adjSize);