Bug 1540015 - part 3: Rename Document::GetShell() to Document::GetPresShell() and make it return PresShell* rather than nsIPresShell* r=smaug,emilio

This makes `Document::GetShell()` return `PresShell*` instead of `nsIPresShell`.

Additonally, "shell" is unclear ("docshell" vs. "presshell").  Therefore, this
also renames `Document::GetShell()` to `Document::GetPresShell()`.

Similarly, some other method names of `Document` are also renamed from
`*Shell*` to `*PresShell*`.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Masayuki Nakano 2019-03-29 13:09:26 +00:00
parent 2137fa4b14
commit 9273f25ce2
98 changed files with 657 additions and 588 deletions

View File

@ -22,6 +22,7 @@
#include "mozilla/Components.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/Event.h" // for Event
#include "nsContentUtils.h"
#include "nsDocShellLoadTypes.h"
@ -437,8 +438,10 @@ DocAccessible* DocManager::CreateDocOrRootAccessible(Document* aDocument) {
}
// Ignore documents without presshell and not having root frame.
nsIPresShell* presShell = aDocument->GetShell();
if (!presShell || presShell->IsDestroying()) return nullptr;
PresShell* presShell = aDocument->GetPresShell();
if (!presShell || presShell->IsDestroying()) {
return nullptr;
}
bool isRootDoc = nsCoreUtils::IsRootDocument(aDocument);

View File

@ -6,6 +6,7 @@
#define mozilla_a11_DocManager_h_
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/Document.h"
#include "nsIDOMEventListener.h"
#include "nsRefPtrHashtable.h"
@ -183,8 +184,8 @@ class DocManager : public nsIWebProgressListener,
* more than one.
*/
inline DocAccessible* GetExistingDocAccessible(const dom::Document* aDocument) {
nsIPresShell* ps = aDocument->GetShell();
return ps ? ps->GetDocAccessible() : nullptr;
PresShell* presShell = aDocument->GetPresShell();
return presShell ? presShell->GetDocAccessible() : nullptr;
}
} // namespace a11y

View File

@ -22,6 +22,7 @@
#include "prenv.h"
#include "nsIDocShellTreeItem.h"
#include "nsIURI.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLBodyElement.h"
#include "mozilla/dom/Selection.h"
@ -164,13 +165,13 @@ static void LogDocState(dom::Document* aDocumentNode) {
}
static void LogPresShell(dom::Document* aDocumentNode) {
nsIPresShell* ps = aDocumentNode->GetShell();
printf("presshell: %p", static_cast<void*>(ps));
PresShell* presShell = aDocumentNode->GetPresShell();
printf("presshell: %p", static_cast<void*>(presShell));
nsIScrollableFrame* sf = nullptr;
if (ps) {
printf(", is %s destroying", (ps->IsDestroying() ? "" : "not"));
sf = ps->GetRootScrollFrameAsScrollable();
if (presShell) {
printf(", is %s destroying", (presShell->IsDestroying() ? "" : "not"));
sf = presShell->GetRootScrollFrameAsScrollable();
}
printf(", root scroll frame: %p", static_cast<void*>(sf));
}

View File

@ -72,6 +72,7 @@
#include "mozilla/dom/EventTarget.h"
#include "mozilla/dom/HTMLTableElement.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/Services.h"
#include "nsDeckFrame.h"
@ -372,9 +373,9 @@ class PluginTimerCallBack final : public nsITimerCallback, public nsINamed {
NS_IMETHOD Notify(nsITimer* aTimer) final {
if (!mContent->IsInUncomposedDoc()) return NS_OK;
nsIPresShell* ps = mContent->OwnerDoc()->GetShell();
if (ps) {
DocAccessible* doc = ps->GetDocAccessible();
PresShell* presShell = mContent->OwnerDoc()->GetPresShell();
if (presShell) {
DocAccessible* doc = presShell->GetDocAccessible();
if (doc) {
// Make sure that if we created an accessible for the plugin that wasn't
// a plugin accessible we remove it before creating the right

View File

@ -14,7 +14,6 @@
#include "nsXULElement.h"
#include "nsIDocShell.h"
#include "nsIObserverService.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsIScrollableFrame.h"
#include "nsISelectionController.h"
@ -24,6 +23,7 @@
#include "mozilla/EventListenerManager.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/PresShell.h"
#include "mozilla/TouchEvents.h"
#include "nsView.h"
#include "nsGkAtoms.h"
@ -70,8 +70,10 @@ void nsCoreUtils::DispatchClickEvent(XULTreeElement *aTree, int32_t aRowIndex,
Document *document = tcElm->GetUncomposedDoc();
if (!document) return;
nsCOMPtr<nsIPresShell> presShell = document->GetShell();
if (!presShell) return;
RefPtr<PresShell> presShell = document->GetPresShell();
if (!presShell) {
return;
}
// Ensure row is visible.
aTree->EnsureRowIsVisible(aRowIndex);

View File

@ -7,11 +7,11 @@
#define nsCoreUtils_h_
#include "mozilla/EventForwards.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/Element.h"
#include "nsIAccessibleEvent.h"
#include "nsIContent.h"
#include "mozilla/dom/Document.h" // for GetShell()
#include "nsIPresShell.h"
#include "mozilla/dom/Document.h" // for GetPresShell()
#include "nsPoint.h"
#include "nsTArray.h"
@ -213,7 +213,7 @@ class nsCoreUtils {
* Return presShell for the document containing the given DOM node.
*/
static nsIPresShell *GetPresShellFor(nsINode *aNode) {
return aNode->OwnerDoc()->GetShell();
return aNode->OwnerDoc()->GetPresShell();
}
/**

View File

@ -30,7 +30,6 @@
#include "nsIInterfaceRequestorUtils.h"
#include "nsImageFrame.h"
#include "nsIPersistentProperties2.h"
#include "nsIPresShell.h"
#include "nsIServiceManager.h"
#include "nsViewManager.h"
#include "nsIScrollableFrame.h"
@ -43,6 +42,7 @@
#include "mozilla/EventStateManager.h"
#include "mozilla/EventStates.h"
#include "mozilla/HTMLEditor.h"
#include "mozilla/PresShell.h"
#include "mozilla/TextEditor.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/DocumentType.h"
@ -466,8 +466,10 @@ nsRect DocAccessible::RelativeBounds(nsIFrame** aRelativeFrame) const {
nsRect bounds;
while (document) {
nsIPresShell* presShell = document->GetShell();
if (!presShell) return nsRect();
mozilla::PresShell* presShell = document->GetPresShell();
if (!presShell) {
return nsRect();
}
nsRect scrollPort;
nsIScrollableFrame* sf = presShell->GetRootScrollFrameAsScrollable();

View File

@ -21,11 +21,11 @@
#include "mozilla/dom/Document.h"
#include "nsIDOMWindow.h"
#include "nsIObserverService.h"
#include "nsIPresShell.h"
#include "nsIScriptError.h"
#include "nsIWindowMediator.h"
#include "nsIPrefService.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/Printf.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
@ -38,6 +38,7 @@ nsChromeRegistry* nsChromeRegistry::gChromeRegistry;
// DO NOT use namespace mozilla; it'll break due to a naming conflict between
// mozilla::TextRange and a TextRange in OSX headers.
using mozilla::PresShell;
using mozilla::StyleSheet;
using mozilla::dom::Document;
using mozilla::dom::IsChromeURI;
@ -344,11 +345,11 @@ nsresult nsChromeRegistry::RefreshWindow(nsPIDOMWindowOuter* aWindow) {
if (!document) return NS_OK;
// Deal with the agent sheets first. Have to do all the style sets by hand.
nsCOMPtr<nsIPresShell> shell = document->GetShell();
if (shell) {
RefPtr<PresShell> presShell = document->GetPresShell();
if (presShell) {
// Reload only the chrome URL agent style sheets.
nsTArray<RefPtr<StyleSheet>> agentSheets;
rv = shell->GetAgentStyleSheets(agentSheets);
rv = presShell->GetAgentStyleSheets(agentSheets);
NS_ENSURE_SUCCESS(rv, rv);
nsTArray<RefPtr<StyleSheet>> newAgentSheets;
@ -370,7 +371,7 @@ nsresult nsChromeRegistry::RefreshWindow(nsPIDOMWindowOuter* aWindow) {
}
}
rv = shell->SetAgentStyleSheets(newAgentSheets);
rv = presShell->SetAgentStyleSheets(newAgentSheets);
NS_ENSURE_SUCCESS(rv, rv);
}

View File

@ -28,6 +28,7 @@
#include "mozilla/Logging.h"
#include "mozilla/MediaFeatureChange.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/ResultExtensions.h"
#include "mozilla/ScrollTypes.h"
#include "mozilla/Services.h"
@ -7878,8 +7879,9 @@ nsresult nsDocShell::RestoreFromHistory() {
} else {
rootViewParent = nullptr;
}
if (sibling && sibling->GetShell() && sibling->GetShell()->GetViewManager()) {
rootViewSibling = sibling->GetShell()->GetViewManager()->GetRootView();
if (sibling && sibling->GetPresShell() &&
sibling->GetPresShell()->GetViewManager()) {
rootViewSibling = sibling->GetPresShell()->GetViewManager()->GetRootView();
} else {
rootViewSibling = nullptr;
}

View File

@ -20,6 +20,7 @@
#include "mozilla/LayerAnimationInfo.h"
#include "mozilla/LookAndFeel.h" // For LookAndFeel::GetInt
#include "mozilla/KeyframeUtils.h"
#include "mozilla/PresShell.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/TypeTraits.h"
@ -31,7 +32,6 @@
#include "nsCSSPseudoElements.h" // For PseudoStyleType
#include "nsDOMMutationObserver.h" // For nsAutoAnimationMutationBatch
#include "nsIFrame.h"
#include "nsIPresShell.h"
#include "nsIScriptError.h"
#include "nsPresContextInlines.h"
#include "nsRefreshDriver.h"
@ -1207,7 +1207,7 @@ bool KeyframeEffect::CanThrottleIfNotVisible(nsIFrame& aFrame) const {
return false;
}
nsIPresShell* presShell = GetPresShell();
PresShell* presShell = GetPresShell();
if (presShell && !presShell->IsActive()) {
return true;
}
@ -1409,12 +1409,12 @@ Document* KeyframeEffect::GetRenderedDocument() const {
return mTarget->mElement->GetComposedDoc();
}
nsIPresShell* KeyframeEffect::GetPresShell() const {
PresShell* KeyframeEffect::GetPresShell() const {
Document* doc = GetRenderedDocument();
if (!doc) {
return nullptr;
}
return doc->GetShell();
return doc->GetPresShell();
}
/* static */

View File

@ -34,7 +34,6 @@ struct JSContext;
class JSObject;
class nsIContent;
class nsIFrame;
class nsIPresShell;
namespace mozilla {
@ -45,6 +44,7 @@ struct AnimationRule;
struct TimingParams;
class EffectSet;
class ComputedStyle;
class PresShell;
namespace dom {
class ElementOrCSSPseudoElement;
@ -283,7 +283,7 @@ class KeyframeEffect : public AnimationEffect {
}
Document* GetRenderedDocument() const;
nsIPresShell* GetPresShell() const;
PresShell* GetPresShell() const;
// Associates a warning with the animated property set on the specified frame
// indicating why, for example, the property could not be animated on the

View File

@ -6,10 +6,10 @@
#include "PendingAnimationTracker.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/AnimationTimeline.h"
#include "mozilla/dom/Nullable.h"
#include "nsIFrame.h"
#include "nsIPresShell.h"
#include "nsTransitionManager.h" // For CSSTransition
using mozilla::dom::Nullable;
@ -173,7 +173,7 @@ void PendingAnimationTracker::EnsurePaintIsScheduled() {
return;
}
nsIPresShell* presShell = mDocument->GetShell();
PresShell* presShell = mDocument->GetPresShell();
if (!presShell) {
return;
}

View File

@ -5,11 +5,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "AnonymousContent.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/AnonymousContentBinding.h"
#include "nsComputedDOMStyle.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/dom/Document.h"
#include "nsIFrame.h"
#include "nsStyledElement.h"
#include "HTMLCanvasElement.h"
@ -185,8 +186,7 @@ void AnonymousContent::GetComputedStylePropertyValue(
return;
}
nsIPresShell* shell = element->OwnerDoc()->GetShell();
if (!shell) {
if (!element->OwnerDoc()->GetPresShell()) {
aRv.Throw(NS_ERROR_NOT_AVAILABLE);
return;
}

View File

@ -9,6 +9,7 @@
#include "nsIFrame.h"
#include "nsContentUtils.h"
#include "nsLayoutUtils.h"
#include "mozilla/PresShell.h"
#include "mozilla/ServoBindings.h"
namespace mozilla {
@ -252,7 +253,7 @@ void DOMIntersectionObserver::Update(Document* aDocument,
rootFrame, rootRectRelativeToRootFrame, containingBlock);
}
} else {
nsCOMPtr<nsIPresShell> presShell = aDocument->GetShell();
RefPtr<PresShell> presShell = aDocument->GetPresShell();
if (presShell) {
rootFrame = presShell->GetRootScrollFrame();
if (rootFrame) {

View File

@ -2251,9 +2251,9 @@ void Document::RemoveDocStyleSheetsFromStyleSets() {
sheet->ClearAssociatedDocumentOrShadowRoot();
if (sheet->IsApplicable()) {
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
shell->StyleSet()->RemoveDocStyleSheet(sheet);
RefPtr<PresShell> presShell = GetPresShell();
if (presShell) {
presShell->StyleSet()->RemoveDocStyleSheet(sheet);
}
}
// XXX Tell observers?
@ -2267,9 +2267,9 @@ void Document::RemoveStyleSheetsFromStyleSets(
sheet->ClearAssociatedDocumentOrShadowRoot();
if (sheet->IsApplicable()) {
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
shell->StyleSet()->RemoveStyleSheet(aType, sheet);
RefPtr<PresShell> presShell = GetPresShell();
if (presShell) {
presShell->StyleSet()->RemoveStyleSheet(aType, sheet);
}
}
// XXX Tell observers?
@ -2323,10 +2323,10 @@ void Document::ResetStylesheetsToURI(nsIURI* aURI) {
}
// Now set up our style sets
if (nsIPresShell* shell = GetShell()) {
FillStyleSet(shell->StyleSet());
if (shell->StyleSet()->StyleSheetsHaveChanged()) {
shell->ApplicableStylesChanged();
if (PresShell* presShell = GetPresShell()) {
FillStyleSet(presShell->StyleSet());
if (presShell->StyleSet()->StyleSheetsHaveChanged()) {
presShell->ApplicableStylesChanged();
}
}
}
@ -3630,7 +3630,7 @@ static inline void AssertNoStaleServoDataIn(nsINode& aSubtreeRoot) {
#endif
}
already_AddRefed<nsIPresShell> Document::CreateShell(
already_AddRefed<PresShell> Document::CreatePresShell(
nsPresContext* aContext, nsViewManager* aViewManager,
UniquePtr<ServoStyleSet> aStyleSet) {
NS_ASSERTION(!mPresShell, "We have a presshell already!");
@ -3640,18 +3640,20 @@ already_AddRefed<nsIPresShell> Document::CreateShell(
FillStyleSet(aStyleSet.get());
AssertNoStaleServoDataIn(*this);
RefPtr<PresShell> shell = new PresShell;
RefPtr<PresShell> presShell = new PresShell;
// Note: we don't hold a ref to the shell (it holds a ref to us)
mPresShell = shell;
shell->Init(this, aContext, aViewManager, std::move(aStyleSet));
mPresShell = presShell;
presShell->Init(this, aContext, aViewManager, std::move(aStyleSet));
// Make sure to never paint if we belong to an invisible DocShell.
nsCOMPtr<nsIDocShell> docShell(mDocumentContainer);
if (docShell && docShell->IsInvisible()) shell->SetNeverPainting(true);
if (docShell && docShell->IsInvisible()) {
presShell->SetNeverPainting(true);
}
MOZ_LOG(gDocumentLeakPRLog, LogLevel::Debug,
("DOCUMENT %p with PressShell %p and DocShell %p", this, shell.get(),
docShell.get()));
("DOCUMENT %p with PressShell %p and DocShell %p", this,
presShell.get(), docShell.get()));
mExternalResourceMap.ShowViewers();
@ -3663,11 +3665,11 @@ already_AddRefed<nsIPresShell> Document::CreateShell(
// is ready to update we'll flush the font set.
MarkUserFontSetDirty();
return shell.forget();
return presShell.forget();
}
void Document::UpdateFrameRequestCallbackSchedulingState(
nsIPresShell* aOldShell) {
PresShell* aOldPresShell) {
// If the condition for shouldBeScheduled changes to depend on some other
// variable, add UpdateFrameRequestCallbackSchedulingState() calls to the
// places where that variable can change.
@ -3678,7 +3680,7 @@ void Document::UpdateFrameRequestCallbackSchedulingState(
return;
}
nsIPresShell* presShell = aOldShell ? aOldShell : mPresShell;
PresShell* presShell = aOldPresShell ? aOldPresShell : mPresShell;
MOZ_RELEASE_ASSERT(presShell);
nsRefreshDriver* rd = presShell->GetPresContext()->RefreshDriver();
@ -3738,7 +3740,7 @@ bool Document::ShouldThrottleFrameRequests() {
return false;
}
void Document::DeleteShell() {
void Document::DeletePresShell() {
mExternalResourceMap.HideViewers();
if (nsPresContext* presContext = mPresShell->GetPresContext()) {
presContext->RefreshDriver()->CancelPendingFullscreenEvents(this);
@ -3755,9 +3757,9 @@ void Document::DeleteShell() {
// no point on it.
MarkUserFontSetDirty();
nsIPresShell* oldShell = mPresShell;
PresShell* oldPresShell = mPresShell;
mPresShell = nullptr;
UpdateFrameRequestCallbackSchedulingState(oldShell);
UpdateFrameRequestCallbackSchedulingState(oldPresShell);
mStyleSetFilled = false;
ClearStaleServoData();
@ -3952,9 +3954,9 @@ void Document::RemoveChildNode(nsIContent* aKid, bool aNotify) {
}
void Document::AddStyleSheetToStyleSets(StyleSheet* aSheet) {
if (nsIPresShell* shell = GetShell()) {
shell->StyleSet()->AddDocStyleSheet(aSheet, this);
shell->ApplicableStylesChanged();
if (PresShell* presShell = GetPresShell()) {
presShell->StyleSet()->AddDocStyleSheet(aSheet, this);
presShell->ApplicableStylesChanged();
}
}
@ -3992,9 +3994,9 @@ void Document::NotifyStyleSheetRemoved(StyleSheet* aSheet,
}
void Document::RemoveStyleSheetFromStyleSets(StyleSheet* aSheet) {
if (nsIPresShell* shell = GetShell()) {
shell->StyleSet()->RemoveDocStyleSheet(aSheet);
shell->ApplicableStylesChanged();
if (PresShell* presShell = GetPresShell()) {
presShell->StyleSet()->RemoveDocStyleSheet(aSheet);
presShell->ApplicableStylesChanged();
}
}
@ -4174,10 +4176,10 @@ nsresult Document::AddAdditionalStyleSheet(additionalSheetType aType,
mAdditionalSheets[aType].AppendElement(aSheet);
if (nsIPresShell* shell = GetShell()) {
if (PresShell* presShell = GetPresShell()) {
SheetType type = ConvertAdditionalSheetType(aType);
shell->StyleSet()->AppendStyleSheet(type, aSheet);
shell->ApplicableStylesChanged();
presShell->StyleSet()->AppendStyleSheet(type, aSheet);
presShell->ApplicableStylesChanged();
}
// Passing false, so documet.styleSheets.length will not be affected by
@ -4199,10 +4201,10 @@ void Document::RemoveAdditionalStyleSheet(additionalSheetType aType,
if (!mIsGoingAway) {
MOZ_ASSERT(sheetRef->IsApplicable());
if (nsIPresShell* shell = GetShell()) {
if (PresShell* presShell = GetPresShell()) {
SheetType type = ConvertAdditionalSheetType(aType);
shell->StyleSet()->RemoveStyleSheet(type, sheetRef);
shell->ApplicableStylesChanged();
presShell->StyleSet()->RemoveStyleSheet(type, sheetRef);
presShell->ApplicableStylesChanged();
}
}
@ -4941,8 +4943,8 @@ void Document::UnblockDOMContentLoaded() {
("DOCUMENT %p UnblockDOMContentLoaded", this));
mDidFireDOMContentLoaded = true;
if (nsIPresShell* shell = GetShell()) {
shell->GetRefreshDriver()->NotifyDOMContentLoaded();
if (PresShell* presShell = GetPresShell()) {
presShell->GetRefreshDriver()->NotifyDOMContentLoaded();
}
MOZ_ASSERT(mReadyState == READYSTATE_INTERACTIVE);
@ -4971,8 +4973,8 @@ void Document::DocumentStatesChanged(EventStates aStateMask) {
}
void Document::StyleRuleChanged(StyleSheet* aSheet, css::Rule* aStyleRule) {
if (nsIPresShell* shell = GetShell()) {
shell->ApplicableStylesChanged();
if (PresShell* presShell = GetPresShell()) {
presShell->ApplicableStylesChanged();
}
if (!StyleSheetChangeEventsEnabled()) {
@ -4984,8 +4986,8 @@ void Document::StyleRuleChanged(StyleSheet* aSheet, css::Rule* aStyleRule) {
}
void Document::StyleRuleAdded(StyleSheet* aSheet, css::Rule* aStyleRule) {
if (nsIPresShell* shell = GetShell()) {
shell->ApplicableStylesChanged();
if (PresShell* presShell = GetPresShell()) {
presShell->ApplicableStylesChanged();
}
if (!StyleSheetChangeEventsEnabled()) {
@ -4997,8 +4999,8 @@ void Document::StyleRuleAdded(StyleSheet* aSheet, css::Rule* aStyleRule) {
}
void Document::StyleRuleRemoved(StyleSheet* aSheet, css::Rule* aStyleRule) {
if (nsIPresShell* shell = GetShell()) {
shell->ApplicableStylesChanged();
if (PresShell* presShell = GetPresShell()) {
presShell->ApplicableStylesChanged();
}
if (!StyleSheetChangeEventsEnabled()) {
@ -5011,17 +5013,17 @@ void Document::StyleRuleRemoved(StyleSheet* aSheet, css::Rule* aStyleRule) {
#undef DO_STYLESHEET_NOTIFICATION
static Element* GetCustomContentContainer(nsIPresShell* aShell) {
if (!aShell || !aShell->GetCanvasFrame()) {
static Element* GetCustomContentContainer(PresShell* aPresShell) {
if (!aPresShell || !aPresShell->GetCanvasFrame()) {
return nullptr;
}
return aShell->GetCanvasFrame()->GetCustomContentContainer();
return aPresShell->GetCanvasFrame()->GetCustomContentContainer();
}
static void InsertAnonContentIntoCanvas(AnonymousContent& aAnonContent,
nsIPresShell* aShell) {
Element* container = GetCustomContentContainer(aShell);
PresShell* aPresShell) {
Element* container = GetCustomContentContainer(aPresShell);
if (!container) {
return;
}
@ -5031,7 +5033,7 @@ static void InsertAnonContentIntoCanvas(AnonymousContent& aAnonContent,
return;
}
aShell->GetCanvasFrame()->ShowCustomContentContainer();
aPresShell->GetCanvasFrame()->ShowCustomContentContainer();
}
already_AddRefed<AnonymousContent> Document::InsertAnonymousContent(
@ -5048,14 +5050,14 @@ already_AddRefed<AnonymousContent> Document::InsertAnonymousContent(
MakeRefPtr<AnonymousContent>(clone.forget().downcast<Element>());
mAnonymousContents.AppendElement(anonContent);
InsertAnonContentIntoCanvas(*anonContent, GetShell());
InsertAnonContentIntoCanvas(*anonContent, GetPresShell());
return anonContent.forget();
}
static void RemoveAnonContentFromCanvas(AnonymousContent& aAnonContent,
nsIPresShell* aShell) {
RefPtr<Element> container = GetCustomContentContainer(aShell);
PresShell* aPresShell) {
RefPtr<Element> container = GetCustomContentContainer(aPresShell);
if (!container) {
return;
}
@ -5072,10 +5074,11 @@ void Document::RemoveAnonymousContent(AnonymousContent& aContent,
}
mAnonymousContents.RemoveElementAt(index);
RemoveAnonContentFromCanvas(aContent, GetShell());
RemoveAnonContentFromCanvas(aContent, GetPresShell());
if (mAnonymousContents.IsEmpty() && GetCustomContentContainer(GetShell())) {
GetShell()->GetCanvasFrame()->HideCustomContentContainer();
if (mAnonymousContents.IsEmpty() &&
GetCustomContentContainer(GetPresShell())) {
GetPresShell()->GetCanvasFrame()->HideCustomContentContainer();
}
}
@ -5085,14 +5088,14 @@ Element* Document::GetAnonRootIfInAnonymousContentContainer(
return nullptr;
}
nsIPresShell* shell = GetShell();
if (!shell || !shell->GetCanvasFrame()) {
PresShell* presShell = GetPresShell();
if (!presShell || !presShell->GetCanvasFrame()) {
return nullptr;
}
nsAutoScriptBlocker scriptBlocker;
nsCOMPtr<Element> customContainer =
shell->GetCanvasFrame()->GetCustomContentContainer();
presShell->GetCanvasFrame()->GetCustomContentContainer();
if (!customContainer) {
return nullptr;
}
@ -5526,9 +5529,9 @@ void Document::EnableStyleSheetsForSetInternal(const nsAString& aSheetSet,
if (aUpdateCSSLoader) {
CSSLoader()->DocumentStyleSheetSetChanged();
}
if (nsIPresShell* shell = GetShell()) {
if (shell->StyleSet()->StyleSheetsHaveChanged()) {
shell->ApplicableStylesChanged();
if (PresShell* presShell = GetPresShell()) {
if (presShell->StyleSet()->StyleSheetsHaveChanged()) {
presShell->ApplicableStylesChanged();
}
}
}
@ -5891,10 +5894,10 @@ void Document::DoNotifyPossibleTitleChange() {
nsAutoString title;
GetTitle(title);
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
RefPtr<PresShell> presShell = GetPresShell();
if (presShell) {
nsCOMPtr<nsISupports> container =
shell->GetPresContext()->GetContainerWeak();
presShell->GetPresContext()->GetContainerWeak();
if (container) {
nsCOMPtr<nsIBaseWindow> docShellWin = do_QueryInterface(container);
if (docShellWin) {
@ -7114,8 +7117,8 @@ void Document::FlushPendingNotifications(mozilla::ChangesToFlush aFlush) {
mParentDocument->FlushPendingNotifications(parentFlush);
}
if (nsIPresShell* shell = GetShell()) {
shell->FlushPendingNotifications(aFlush);
if (RefPtr<PresShell> presShell = GetPresShell()) {
presShell->FlushPendingNotifications(aFlush);
}
}
@ -7315,10 +7318,11 @@ already_AddRefed<Element> Document::CreateElem(const nsAString& aName,
}
bool Document::IsSafeToFlush() const {
nsIPresShell* shell = GetShell();
if (!shell) return true;
return shell->IsSafeToFlush();
PresShell* presShell = GetPresShell();
if (!presShell) {
return true;
}
return presShell->IsSafeToFlush();
}
void Document::Sanitize() {
@ -8303,12 +8307,12 @@ static void FireOrClearDelayedEvents(nsTArray<nsCOMPtr<Document>>& aDocuments,
// closed before this event ran.
if (!aDocuments[i]->EventHandlingSuppressed()) {
fm->FireDelayedEvents(aDocuments[i]);
nsCOMPtr<nsIPresShell> shell = aDocuments[i]->GetShell();
if (shell) {
RefPtr<PresShell> presShell = aDocuments[i]->GetPresShell();
if (presShell) {
// Only fire events for active documents.
bool fire = aFireEvents && aDocuments[i]->GetInnerWindow() &&
aDocuments[i]->GetInnerWindow()->IsCurrentInnerWindow();
shell->FireOrClearDelayedEvents(fire);
presShell->FireOrClearDelayedEvents(fire);
}
}
}
@ -8790,9 +8794,9 @@ void Document::SetScrollToRef(nsIURI* aDocumentURI) {
void Document::ScrollToRef() {
if (mScrolledToRefAlready) {
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
shell->ScrollToAnchor();
RefPtr<PresShell> presShell = GetPresShell();
if (presShell) {
presShell->ScrollToAnchor();
}
return;
}
@ -8801,8 +8805,8 @@ void Document::ScrollToRef() {
return;
}
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
RefPtr<PresShell> presShell = GetPresShell();
if (presShell) {
nsresult rv = NS_ERROR_FAILURE;
// We assume that the bytes are in UTF-8, as it says in the spec:
// http://www.w3.org/TR/html4/appendix/notes.html#h-B.2.1
@ -8810,7 +8814,7 @@ void Document::ScrollToRef() {
// Check an empty string which might be caused by the UTF-8 conversion
if (!ref.IsEmpty()) {
// Note that GoToAnchor will handle flushing layout as needed.
rv = shell->GoToAnchor(ref, mChangeScrollPosWhenScrollingToRef);
rv = presShell->GoToAnchor(ref, mChangeScrollPosWhenScrollingToRef);
} else {
rv = NS_ERROR_FAILURE;
}
@ -8825,7 +8829,8 @@ void Document::ScrollToRef() {
if (unescaped) {
NS_ConvertUTF8toUTF16 utf16Str(buff);
if (!utf16Str.IsEmpty()) {
rv = shell->GoToAnchor(utf16Str, mChangeScrollPosWhenScrollingToRef);
rv = presShell->GoToAnchor(utf16Str,
mChangeScrollPosWhenScrollingToRef);
}
}
@ -8836,7 +8841,7 @@ void Document::ScrollToRef() {
rv = encoding->DecodeWithoutBOMHandling(unescaped ? buff : mScrollToRef,
ref);
if (NS_SUCCEEDED(rv) && !ref.IsEmpty()) {
rv = shell->GoToAnchor(ref, mChangeScrollPosWhenScrollingToRef);
rv = presShell->GoToAnchor(ref, mChangeScrollPosWhenScrollingToRef);
}
}
}
@ -9171,8 +9176,8 @@ void Document::ScheduleSVGUseElementShadowTreeUpdate(
mSVGUseElementsNeedingShadowTreeUpdate.PutEntry(&aUseElement);
if (nsIPresShell* shell = GetShell()) {
shell->EnsureStyleFlush();
if (PresShell* presShell = GetPresShell()) {
presShell->EnsureStyleFlush();
}
}
@ -9258,12 +9263,12 @@ already_AddRefed<nsDOMCaretPosition> Document::CaretPositionFromPoint(
FlushPendingNotifications(FlushType::Layout);
nsIPresShell* ps = GetShell();
if (!ps) {
PresShell* presShell = GetPresShell();
if (!presShell) {
return nullptr;
}
nsIFrame* rootFrame = ps->GetRootFrame();
nsIFrame* rootFrame = presShell->GetRootFrame();
// XUL docs, unlike HTML, have no frame tree until everything's done loading
if (!rootFrame) {
@ -9280,7 +9285,7 @@ already_AddRefed<nsDOMCaretPosition> Document::CaretPositionFromPoint(
// We require frame-relative coordinates for GetContentOffsetsFromPoint.
nsPoint aOffset;
nsCOMPtr<nsIWidget> widget = nsContentUtils::GetWidget(ps, &aOffset);
nsCOMPtr<nsIWidget> widget = nsContentUtils::GetWidget(presShell, &aOffset);
LayoutDeviceIntPoint refPoint = nsContentUtils::ToWidgetPoint(
CSSPoint(aX, aY), aOffset, GetPresContext());
nsPoint adjustedPoint =
@ -10222,10 +10227,10 @@ void Document::CleanupFullscreenState() {
mFullscreenRoot = nullptr;
// Restore the zoom level that was in place prior to entering fullscreen.
if (nsIPresShell* shell = GetShell()) {
if (shell->GetMobileViewportManager()) {
shell->SetResolutionAndScaleTo(mSavedResolution,
nsIPresShell::ChangeOrigin::eMainThread);
if (PresShell* presShell = GetPresShell()) {
if (presShell->GetMobileViewportManager()) {
presShell->SetResolutionAndScaleTo(
mSavedResolution, nsIPresShell::ChangeOrigin::eMainThread);
}
}
@ -10616,13 +10621,14 @@ bool Document::ApplyFullscreen(UniquePtr<FullscreenRequest> aRequest) {
// fixed elements are sized to the layout viewport).
// This also ensures that things like video controls aren't zoomed in
// when in fullscreen mode.
if (nsIPresShell* shell = child->GetShell()) {
if (PresShell* presShell = child->GetPresShell()) {
if (RefPtr<MobileViewportManager> manager =
shell->GetMobileViewportManager()) {
presShell->GetMobileViewportManager()) {
// Save the previous resolution so it can be restored.
child->mSavedResolution = shell->GetResolution();
shell->SetResolutionAndScaleTo(manager->ComputeIntrinsicResolution(),
nsIPresShell::ChangeOrigin::eMainThread);
child->mSavedResolution = presShell->GetResolution();
presShell->SetResolutionAndScaleTo(
manager->ComputeIntrinsicResolution(),
nsIPresShell::ChangeOrigin::eMainThread);
}
}
@ -10892,8 +10898,8 @@ bool Document::SetPointerLock(Element* aElement, StyleCursorKind aCursorStyle) {
}
#endif
nsIPresShell* shell = GetShell();
if (!shell) {
PresShell* presShell = GetPresShell();
if (!presShell) {
NS_WARNING("SetPointerLock(): No PresShell");
if (!aElement) {
// If we are unlocking pointer lock, but for some reason the doc
@ -10904,19 +10910,19 @@ bool Document::SetPointerLock(Element* aElement, StyleCursorKind aCursorStyle) {
}
return false;
}
nsPresContext* presContext = shell->GetPresContext();
nsPresContext* presContext = presShell->GetPresContext();
if (!presContext) {
NS_WARNING("SetPointerLock(): Unable to get PresContext");
return false;
}
nsCOMPtr<nsIWidget> widget;
nsIFrame* rootFrame = shell->GetRootFrame();
nsIFrame* rootFrame = presShell->GetRootFrame();
if (!NS_WARN_IF(!rootFrame)) {
widget = rootFrame->GetNearestWidget();
NS_WARNING_ASSERTION(widget,
"SetPointerLock(): Unable to find widget in "
"shell->GetRootFrame()->GetNearestWidget();");
"presShell->GetRootFrame()->GetNearestWidget();");
if (aElement && !widget) {
return false;
}
@ -11696,8 +11702,8 @@ void Document::FlushUserFontSet() {
if (gfxPlatform::GetPlatform()->DownloadableFontsEnabled()) {
nsTArray<nsFontFaceRuleContainer> rules;
nsIPresShell* shell = GetShell();
if (shell && !shell->StyleSet()->AppendFontFaceRules(rules)) {
PresShell* presShell = GetPresShell();
if (presShell && !presShell->StyleSet()->AppendFontFaceRules(rules)) {
return;
}
@ -11715,8 +11721,8 @@ void Document::FlushUserFontSet() {
// reflect that we're modifying @font-face rules. (However,
// without a reflow, nothing will happen to start any downloads
// that are needed.)
if (changed && shell) {
if (nsPresContext* presContext = shell->GetPresContext()) {
if (changed && presShell) {
if (nsPresContext* presContext = presShell->GetPresContext()) {
presContext->UserFontSetUpdated();
}
}
@ -11728,8 +11734,8 @@ void Document::MarkUserFontSetDirty() {
return;
}
mFontFaceSetDirty = true;
if (nsIPresShell* shell = GetShell()) {
shell->EnsureStyleFlush();
if (PresShell* presShell = GetPresShell()) {
presShell->EnsureStyleFlush();
}
}

View File

@ -107,7 +107,6 @@ class nsILayoutHistoryState;
class nsILoadContext;
class nsIObjectLoadingContent;
class nsIObserver;
class nsIPresShell;
class nsIPrincipal;
class nsIRequest;
class nsIRunnable;
@ -139,6 +138,7 @@ class EventListenerManager;
class FullscreenExit;
class FullscreenRequest;
class PendingAnimationTracker;
class PresShell;
class ServoStyleSet;
class SMILAnimationController;
enum class StyleCursorKind : uint8_t;
@ -471,8 +471,8 @@ class Document : public nsINode,
func_, params_); \
/* FIXME(emilio): Apparently we can keep observing from the BFCache? That \
looks bogus. */ \
if (nsIPresShell* shell = GetObservingShell()) { \
shell->func_ params_; \
if (PresShell* presShell = GetObservingPresShell()) { \
presShell->func_ params_; \
} \
} while (0)
@ -1244,16 +1244,16 @@ class Document : public nsINode,
* method is responsible for calling BeginObservingDocument() on the
* presshell if the presshell should observe document mutations.
*/
already_AddRefed<nsIPresShell> CreateShell(
already_AddRefed<PresShell> CreatePresShell(
nsPresContext* aContext, nsViewManager* aViewManager,
UniquePtr<ServoStyleSet> aStyleSet);
void DeleteShell();
void DeletePresShell();
nsIPresShell* GetShell() const {
PresShell* GetPresShell() const {
return GetBFCacheEntry() ? nullptr : mPresShell;
}
inline nsIPresShell* GetObservingShell() const;
inline PresShell* GetObservingPresShell() const;
// Return whether the presshell for this document is safe to flush.
bool IsSafeToFlush() const;
@ -2513,7 +2513,7 @@ class Document : public nsINode,
* null.
*/
void SetDisplayDocument(Document* aDisplayDocument) {
MOZ_ASSERT(!GetShell() && !GetContainer() && !GetWindow(),
MOZ_ASSERT(!GetPresShell() && !GetContainer() && !GetWindow(),
"Shouldn't set mDisplayDocument on documents that already "
"have a presentation or a docshell or a window");
MOZ_ASSERT(aDisplayDocument, "Must not be null");
@ -3852,7 +3852,7 @@ class Document : public nsINode,
// mPresShell is becoming null; in that case it will be used to get hold of
// the relevant refresh driver.
void UpdateFrameRequestCallbackSchedulingState(
nsIPresShell* aOldShell = nullptr);
PresShell* aOldPresShell = nullptr);
// Helper for GetScrollingElement/IsScrollingElement.
bool IsPotentiallyScrollable(HTMLBodyElement* aBody);
@ -4332,7 +4332,7 @@ class Document : public nsINode,
// won't be collected
uint32_t mMarkedCCGeneration;
nsIPresShell* mPresShell;
PresShell* mPresShell;
nsCOMArray<nsINode> mSubtreeModifiedTargets;
uint32_t mSubtreeModifiedDepth;

View File

@ -17,12 +17,12 @@
namespace mozilla {
namespace dom {
inline nsIPresShell* Document::GetObservingShell() const {
inline PresShell* Document::GetObservingPresShell() const {
return mPresShell && mPresShell->IsObservingDocument() ? mPresShell : nullptr;
}
inline nsPresContext* Document::GetPresContext() const {
nsIPresShell* presShell = GetShell();
PresShell* presShell = GetPresShell();
return presShell ? presShell->GetPresContext() : nullptr;
}

View File

@ -6,6 +6,7 @@
#include "DocumentOrShadowRoot.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/dom/ShadowRoot.h"
@ -244,12 +245,12 @@ static void QueryNodesFromRect(DocumentOrShadowRoot& aRoot, const nsRect& aRect,
doc->FlushPendingNotifications(FlushType::Layout);
}
nsIPresShell* ps = doc->GetShell();
if (!ps) {
PresShell* presShell = doc->GetPresShell();
if (!presShell) {
return;
}
nsIFrame* rootFrame = ps->GetRootFrame();
nsIFrame* rootFrame = presShell->GetRootFrame();
// XUL docs, unlike HTML, have no frame tree until everything's done loading
if (!rootFrame) {
return; // return null to premature XUL callers as a reminder to wait

View File

@ -34,7 +34,6 @@
#include "nsIURL.h"
#include "nsContainerFrame.h"
#include "nsIAnonymousContentCreator.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsStyleConsts.h"
#include "nsString.h"
@ -68,6 +67,7 @@
#include "mozilla/FullscreenChange.h"
#include "mozilla/InternalMutationEvent.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/PresShell.h"
#include "mozilla/RestyleManager.h"
#include "mozilla/ScrollTypes.h"
#include "mozilla/SizeOfState.h"
@ -448,7 +448,7 @@ Element::StyleStateLocks Element::LockedStyleStates() const {
void Element::NotifyStyleStateChange(EventStates aStates) {
Document* doc = GetComposedDoc();
if (doc) {
nsIPresShell* presShell = doc->GetShell();
RefPtr<PresShell> presShell = doc->GetPresShell();
if (presShell) {
nsAutoScriptBlocker scriptBlocker;
presShell->ContentStateChanged(doc, this, aStates);
@ -527,7 +527,7 @@ static bool MayNeedToLoadXBLBinding(const Document& aDocument,
// Otherwise, don't do anything else here unless we're dealing with
// XUL or an HTML element that may have a plugin-related overlay
// (i.e. object or embed).
if (!aDocument.GetShell() || aElement.GetPrimaryFrame()) {
if (!aDocument.GetPresShell() || aElement.GetPrimaryFrame()) {
return false;
}
@ -698,8 +698,8 @@ nsIScrollableFrame* Element::GetScrollFrame(nsIFrame** aFrame,
if (isScrollingElement) {
// Our scroll info should map to the root scrollable frame if there is one.
if (nsIPresShell* shell = doc->GetShell()) {
return shell->GetRootScrollFrameAsScrollable();
if (PresShell* presShell = doc->GetPresShell()) {
return presShell->GetRootScrollFrameAsScrollable();
}
}
@ -731,7 +731,7 @@ void Element::ScrollIntoView(const ScrollIntoViewOptions& aOptions) {
}
// Get the presentation shell
nsCOMPtr<nsIPresShell> presShell = document->GetShell();
RefPtr<PresShell> presShell = document->GetPresShell();
if (!presShell) {
return;
}
@ -990,7 +990,7 @@ nsRect Element::GetClientAreaRect() {
// We will always have a pres shell if we have a pres context, and we will
// only get here if we have a pres context from the root content document
// check
nsIPresShell* presShell = doc->GetShell();
PresShell* presShell = doc->GetPresShell();
// Ensure up to date dimensions, but don't reflow
RefPtr<nsViewManager> viewManager = presShell->GetViewManager();
@ -1198,8 +1198,8 @@ already_AddRefed<ShadowRoot> Element::AttachShadowWithoutNameChecks(
DOCUMENT_FRAGMENT_NODE);
if (Document* doc = GetComposedDoc()) {
if (nsIPresShell* shell = doc->GetShell()) {
shell->DestroyFramesForAndRestyle(this);
if (PresShell* presShell = doc->GetPresShell()) {
presShell->DestroyFramesForAndRestyle(this);
}
}
MOZ_ASSERT(!GetPrimaryFrame());
@ -1319,8 +1319,8 @@ void Element::UnattachShadow() {
nsAutoScriptBlocker scriptBlocker;
if (Document* doc = GetComposedDoc()) {
if (nsIPresShell* shell = doc->GetShell()) {
shell->DestroyFramesForAndRestyle(this);
if (PresShell* presShell = doc->GetPresShell()) {
presShell->DestroyFramesForAndRestyle(this);
}
}
MOZ_ASSERT(!GetPrimaryFrame());
@ -2041,8 +2041,8 @@ nsresult Element::SetSMILOverrideStyleDeclaration(
// be in a document, if we're clearing animation effects on a target node
// that's been detached since the previous animation sample.)
if (Document* doc = GetComposedDoc()) {
if (nsIPresShell* shell = doc->GetShell()) {
shell->RestyleForAnimation(this, StyleRestyleHint_RESTYLE_SMIL);
if (PresShell* presShell = doc->GetPresShell()) {
presShell->RestyleForAnimation(this, StyleRestyleHint_RESTYLE_SMIL);
}
}
@ -4290,8 +4290,8 @@ static void NoteDirtyElement(Element* aElement, uint32_t aBits) {
}
}
if (nsIPresShell* shell = doc->GetShell()) {
shell->EnsureStyleFlush();
if (PresShell* presShell = doc->GetPresShell()) {
presShell->EnsureStyleFlush();
}
MOZ_ASSERT(parent->IsElement() || parent == doc);

View File

@ -22,6 +22,7 @@
#include "mozilla/EventListenerManager.h"
#include "mozilla/EventStates.h"
#include "mozilla/HTMLEditor.h"
#include "mozilla/PresShell.h"
#include "mozilla/RestyleManager.h"
#include "mozilla/TextEditor.h"
#include "mozilla/TouchEvents.h"
@ -43,7 +44,6 @@
#include "nsNetUtil.h"
#include "nsIFrame.h"
#include "nsIAnonymousContentCreator.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsStyleConsts.h"
#include "nsString.h"
@ -1580,7 +1580,7 @@ static bool ShouldClearPurple(nsIContent* aContent) {
// we can act as if it was optimizable. When the primary frame dies, aNode
// will end up to the purple buffer because of the refcount change.
bool NodeHasActiveFrame(Document* aCurrentDoc, nsINode* aNode) {
return aCurrentDoc->GetShell() && aNode->IsElement() &&
return aCurrentDoc->GetPresShell() && aNode->IsElement() &&
aNode->AsElement()->GetPrimaryFrame();
}

View File

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/ResponsiveImageSelector.h"
#include "mozilla/PresShell.h"
#include "mozilla/ServoStyleSetInlines.h"
#include "mozilla/TextUtils.h"
#include "nsIURI.h"
@ -401,7 +402,7 @@ int ResponsiveImageSelector::GetSelectedCandidateIndex() {
bool ResponsiveImageSelector::ComputeFinalWidthForCurrentViewport(
double* aWidth) {
dom::Document* doc = Document();
nsIPresShell* presShell = doc->GetShell();
PresShell* presShell = doc->GetPresShell();
nsPresContext* pctx = presShell ? presShell->GetPresContext() : nullptr;
if (!pctx) {

View File

@ -17,6 +17,7 @@
#include "mozilla/dom/HTMLSlotElement.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/IdentifierMapEntry.h"
#include "mozilla/PresShell.h"
#include "mozilla/ServoStyleRuleMap.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
@ -185,12 +186,12 @@ void ShadowRoot::InvalidateStyleAndLayoutOnSubtree(Element* aElement) {
return;
}
nsIPresShell* shell = doc->GetShell();
if (!shell) {
PresShell* presShell = doc->GetPresShell();
if (!presShell) {
return;
}
shell->DestroyFramesForAndRestyle(aElement);
presShell->DestroyFramesForAndRestyle(aElement);
}
void ShadowRoot::AddSlot(HTMLSlotElement* aSlot) {
@ -349,8 +350,8 @@ void ShadowRoot::ApplicableRulesChanged() {
return;
}
if (nsIPresShell* shell = doc->GetShell()) {
shell->RecordShadowStyleChange(*this);
if (PresShell* presShell = doc->GetPresShell()) {
presShell->RecordShadowStyleChange(*this);
}
}
@ -534,8 +535,8 @@ void ShadowRoot::MaybeReassignElement(Element* aElement) {
}
if (Document* doc = GetComposedDoc()) {
if (nsIPresShell* shell = doc->GetShell()) {
shell->SlotAssignmentWillChange(*aElement, oldSlot, assignment.mSlot);
if (RefPtr<PresShell> presShell = doc->GetPresShell()) {
presShell->SlotAssignmentWillChange(*aElement, oldSlot, assignment.mSlot);
}
}

View File

@ -11,6 +11,7 @@
#include "nsContentSink.h"
#include "mozilla/Components.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/Document.h"
#include "mozilla/css/Loader.h"
#include "mozilla/dom/SRILogHelper.h"
@ -24,7 +25,6 @@
#include "nsIProtocolHandler.h"
#include "nsIHttpChannel.h"
#include "nsIContent.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsViewManager.h"
#include "nsAtom.h"
@ -1190,14 +1190,14 @@ void nsContentSink::StartLayout(bool aIgnorePendingSheets) {
mLastNotificationTime = PR_Now();
mDocument->SetMayStartLayout(true);
nsCOMPtr<nsIPresShell> shell = mDocument->GetShell();
RefPtr<PresShell> presShell = mDocument->GetPresShell();
// Make sure we don't call Initialize() for a shell that has
// already called it. This can happen when the layout frame for
// an iframe is constructed *between* the Embed() call for the
// docshell in the iframe, and the content sink's call to OpenBody().
// (Bug 153815)
if (shell && !shell->DidInitialize()) {
nsresult rv = shell->Initialize();
if (presShell && !presShell->DidInitialize()) {
nsresult rv = presShell->Initialize();
if (NS_FAILED(rv)) {
return;
}
@ -1345,8 +1345,8 @@ nsresult nsContentSink::DidProcessATokenImpl() {
}
// Get the current user event time
nsIPresShell* shell = mDocument->GetShell();
if (!shell) {
PresShell* presShell = mDocument->GetPresShell();
if (!presShell) {
// If there's no pres shell in the document, return early since
// we're not laying anything out here.
return NS_OK;
@ -1358,7 +1358,7 @@ nsresult nsContentSink::DidProcessATokenImpl() {
// Check if there's a pending event
if (sPendingEventMode != 0 && !mHasPendingEvent &&
(mDeflectedCount % sEventProbeRate) == 0) {
nsViewManager* vm = shell->GetViewManager();
nsViewManager* vm = presShell->GetViewManager();
NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE);
nsCOMPtr<nsIWidget> widget;
vm->GetRootWidget(getter_AddRefs(widget));
@ -1492,15 +1492,15 @@ nsresult nsContentSink::WillParseImpl(void) {
return NS_OK;
}
nsIPresShell* shell = mDocument->GetShell();
if (!shell) {
PresShell* presShell = mDocument->GetPresShell();
if (!presShell) {
return NS_OK;
}
uint32_t currentTime = PR_IntervalToMicroseconds(PR_IntervalNow());
if (sEnablePerfMode == 0) {
nsViewManager* vm = shell->GetViewManager();
nsViewManager* vm = presShell->GetViewManager();
NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE);
uint32_t lastEventTime;
vm->GetLastUserEventTime(lastEventTime);

View File

@ -91,6 +91,7 @@
#include "mozilla/ManualNAC.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/ResultExtensions.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/Services.h"
@ -3197,25 +3198,21 @@ void nsContentUtils::SplitExpatName(const char16_t* aExpatName,
}
// static
nsIPresShell* nsContentUtils::GetPresShellForContent(
const nsIContent* aContent) {
PresShell* nsContentUtils::GetPresShellForContent(const nsIContent* aContent) {
Document* doc = aContent->GetComposedDoc();
if (!doc) {
return nullptr;
}
return doc->GetShell();
return doc->GetPresShell();
}
// static
nsPresContext* nsContentUtils::GetContextForContent(
const nsIContent* aContent) {
nsIPresShell* presShell = GetPresShellForContent(aContent);
PresShell* presShell = GetPresShellForContent(aContent);
if (!presShell) {
return nullptr;
}
return presShell->GetPresContext();
}
@ -4184,7 +4181,7 @@ nsresult nsContentUtils::DispatchInputEvent(Element* aEventTargetElement,
}
// If we're running xpcshell tests, we fail to get presShell here.
// Even in such case, we need to dispatch "input" event without widget.
nsIPresShell* presShell = document->GetShell();
PresShell* presShell = document->GetPresShell();
if (presShell) {
nsPresContext* presContext = presShell->GetPresContext();
if (NS_WARN_IF(!presContext)) {
@ -6298,9 +6295,9 @@ nsIPresShell* nsContentUtils::FindPresShellForDocument(const Document* aDoc) {
doc = displayDoc;
}
nsIPresShell* shell = doc->GetShell();
if (shell) {
return shell;
PresShell* presShell = doc->GetPresShell();
if (presShell) {
return presShell;
}
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = doc->GetDocShell();
@ -9833,7 +9830,7 @@ void nsContentUtils::AppendDocumentLevelNativeAnonymousContentTo(
size_t oldLength = aElements.Length();
#endif
if (nsIPresShell* presShell = aDocument->GetShell()) {
if (PresShell* presShell = aDocument->GetPresShell()) {
if (nsIFrame* scrollFrame = presShell->GetRootScrollFrame()) {
nsIAnonymousContentCreator* creator = do_QueryFrame(scrollFrame);
MOZ_ASSERT(
@ -10510,9 +10507,9 @@ bool nsContentUtils::
}
Document* topLevel = aDocument->GetTopLevelContentDocument();
return topLevel && topLevel->GetShell() &&
topLevel->GetShell()->GetPresContext() &&
!topLevel->GetShell()->GetPresContext()->HadContentfulPaint() &&
return topLevel && topLevel->GetPresShell() &&
topLevel->GetPresShell()->GetPresContext() &&
!topLevel->GetPresShell()->GetPresContext()->HadContentfulPaint() &&
nsThreadManager::MainThreadHasPendingHighPriorityEvents();
}

View File

@ -127,6 +127,7 @@ class Dispatcher;
class ErrorResult;
class EventListenerManager;
class HTMLEditor;
class PresShell;
class TextEditor;
namespace dom {
@ -827,7 +828,7 @@ class nsContentUtils {
* @return the pres shell, or nullptr if the content is not in a document
* (if GetComposedDoc returns nullptr)
*/
static nsIPresShell* GetPresShellForContent(const nsIContent* aContent);
static mozilla::PresShell* GetPresShellForContent(const nsIContent* aContent);
/**
* Method to do security and content policy checks on the image URI

View File

@ -18,7 +18,6 @@
#include "nsRange.h"
#include "imgIContainer.h"
#include "imgIRequest.h"
#include "nsIPresShell.h"
#include "nsFocusManager.h"
#include "mozilla/dom/DataTransfer.h"
@ -56,6 +55,7 @@
#include "mozilla/dom/Element.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/IntegerRange.h"
@ -588,8 +588,10 @@ nsIContent* nsCopySupport::GetSelectionForCopy(Document* aDocument,
Selection** aSelection) {
*aSelection = nullptr;
nsIPresShell* presShell = aDocument->GetShell();
if (!presShell) return nullptr;
PresShell* presShell = aDocument->GetPresShell();
if (!presShell) {
return nullptr;
}
nsCOMPtr<nsIContent> focusedContent;
nsCOMPtr<nsISelectionController> selectionController =

View File

@ -45,6 +45,7 @@
#include "mozilla/EventStateManager.h"
#include "mozilla/MiscEvents.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/PresShell.h"
#include "mozilla/TextEvents.h"
#include "mozilla/TextEventDispatcher.h"
#include "mozilla/TouchEvents.h"
@ -53,7 +54,6 @@
#include "nsLayoutUtils.h"
#include "nsComputedDOMStyle.h"
#include "nsIPresShell.h"
#include "nsCSSProps.h"
#include "nsIDocShell.h"
#include "nsIContentViewer.h"
@ -1040,7 +1040,7 @@ nsIWidget* nsDOMWindowUtils::GetWidgetForElement(Element* aElement) {
if (!aElement) return GetWidget();
Document* doc = aElement->GetUncomposedDoc();
nsIPresShell* presShell = doc ? doc->GetShell() : nullptr;
PresShell* presShell = doc ? doc->GetPresShell() : nullptr;
if (presShell) {
nsIFrame* frame = aElement->GetPrimaryFrame();
@ -1376,7 +1376,7 @@ static nsresult getScrollXYAppUnits(const nsWeakPtr& aWindow, bool aFlushLayout,
doc->FlushPendingNotifications(FlushType::Layout);
}
nsIPresShell* presShell = doc->GetShell();
PresShell* presShell = doc->GetPresShell();
if (presShell) {
nsIScrollableFrame* sf = presShell->GetRootScrollFrameAsScrollable();
if (sf) {
@ -1462,7 +1462,7 @@ nsDOMWindowUtils::GetVisualViewportOffsetRelativeToLayoutViewport(
nsCOMPtr<Document> doc = GetDocument();
NS_ENSURE_STATE(doc);
nsIPresShell* presShell = doc->GetShell();
PresShell* presShell = doc->GetPresShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_NOT_AVAILABLE);
nsPoint offset = presShell->GetVisualViewportOffsetRelativeToLayoutViewport();
@ -1481,7 +1481,7 @@ nsDOMWindowUtils::GetVisualViewportOffset(int32_t* aOffsetX,
nsCOMPtr<Document> doc = GetDocument();
NS_ENSURE_STATE(doc);
nsIPresShell* presShell = doc->GetShell();
PresShell* presShell = doc->GetPresShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_NOT_AVAILABLE);
nsPoint offset = presShell->GetVisualViewportOffset();
@ -1504,7 +1504,7 @@ nsDOMWindowUtils::GetScrollbarSize(bool aFlushLayout, int32_t* aWidth,
doc->FlushPendingNotifications(FlushType::Layout);
}
nsIPresShell* presShell = doc->GetShell();
PresShell* presShell = doc->GetPresShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_NOT_AVAILABLE);
nsIScrollableFrame* scrollFrame = presShell->GetRootScrollFrameAsScrollable();
@ -1546,7 +1546,7 @@ nsDOMWindowUtils::NeedsFlush(int32_t aFlushType, bool* aResult) {
nsCOMPtr<Document> doc = GetDocument();
NS_ENSURE_STATE(doc);
nsIPresShell* presShell = doc->GetShell();
PresShell* presShell = doc->GetPresShell();
NS_ENSURE_STATE(presShell);
FlushType flushType;
@ -1588,7 +1588,7 @@ nsDOMWindowUtils::GetRootBounds(DOMRect** aResult) {
NS_ENSURE_STATE(doc);
nsRect bounds(0, 0, 0, 0);
nsIPresShell* presShell = doc->GetShell();
PresShell* presShell = doc->GetPresShell();
if (presShell) {
nsIScrollableFrame* sf = presShell->GetRootScrollFrameAsScrollable();
if (sf) {
@ -1698,13 +1698,14 @@ nsDOMWindowUtils::DispatchDOMEventViaPresShell(nsINode* aTarget, Event* aEvent,
}
nsCOMPtr<Document> targetDoc = content->GetUncomposedDoc();
NS_ENSURE_STATE(targetDoc);
RefPtr<nsIPresShell> targetShell = targetDoc->GetShell();
NS_ENSURE_STATE(targetShell);
RefPtr<PresShell> targetPresShell = targetDoc->GetPresShell();
NS_ENSURE_STATE(targetPresShell);
targetDoc->FlushPendingNotifications(FlushType::Layout);
nsEventStatus status = nsEventStatus_eIgnore;
targetShell->HandleEventWithTarget(internalEvent, nullptr, content, &status);
targetPresShell->HandleEventWithTarget(internalEvent, nullptr, content,
&status);
*aRetVal = (status != nsEventStatus_eConsumeNoDefault);
return NS_OK;
}
@ -4032,7 +4033,7 @@ nsDOMWindowUtils::GetDirectionFromText(const nsAString& aString,
NS_IMETHODIMP
nsDOMWindowUtils::EnsureDirtyRootFrame() {
Document* doc = GetDocument();
nsIPresShell* presShell = doc ? doc->GetShell() : nullptr;
PresShell* presShell = doc ? doc->GetPresShell() : nullptr;
if (!presShell) {
return NS_ERROR_FAILURE;

View File

@ -21,7 +21,6 @@
#include "nsIDocShellTreeOwner.h"
#include "nsIFormControl.h"
#include "nsLayoutUtils.h"
#include "nsIPresShell.h"
#include "nsFrameTraversal.h"
#include "nsIWebNavigation.h"
#include "nsCaret.h"
@ -60,6 +59,7 @@
#include "mozilla/IMEStateManager.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/Services.h"
#include "mozilla/Unused.h"
#include <algorithm>
@ -1482,8 +1482,10 @@ Element* nsFocusManager::CheckIfFocusable(Element* aElement, uint32_t aFlags) {
mEventHandlingNeedsFlush = false;
doc->FlushPendingNotifications(FlushType::EnsurePresShellInitAndFrames);
nsIPresShell* shell = doc->GetShell();
if (!shell) return nullptr;
PresShell* presShell = doc->GetPresShell();
if (!presShell) {
return nullptr;
}
// the root content can always be focused,
// except in userfocusignored context.
@ -1492,7 +1494,7 @@ Element* nsFocusManager::CheckIfFocusable(Element* aElement, uint32_t aFlags) {
}
// cannot focus content in print preview mode. Only the root can be focused.
nsPresContext* presContext = shell->GetPresContext();
nsPresContext* presContext = presShell->GetPresContext();
if (presContext &&
presContext->Type() == nsPresContext::eContext_PrintPreview) {
LOGCONTENT("Cannot focus %s while in print preview", aElement)
@ -2529,7 +2531,7 @@ nsresult nsFocusManager::DetermineElementToMoveFocus(
Element* rootContent = doc->GetRootElement();
NS_ENSURE_TRUE(rootContent, NS_OK);
nsIPresShell* presShell = doc->GetShell();
PresShell* presShell = doc->GetPresShell();
NS_ENSURE_TRUE(presShell, NS_OK);
if (aType == MOVEFOCUS_FIRST) {
@ -2776,7 +2778,7 @@ nsresult nsFocusManager::DetermineElementToMoveFocus(
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
rootContent = doc->GetRootElement();
presShell = doc->GetShell();
presShell = doc->GetPresShell();
// We can focus the root element now that we have moved to another
// document.
@ -3626,11 +3628,12 @@ bool nsFocusManager::TryToMoveFocusToSubDocument(
}
}
Element* rootElement = subdoc->GetRootElement();
nsIPresShell* subShell = subdoc->GetShell();
if (rootElement && subShell) {
PresShell* subPresShell = subdoc->GetPresShell();
if (rootElement && subPresShell) {
nsresult rv = GetNextTabbableContent(
subShell, rootElement, aOriginalStartContent, rootElement, aForward,
(aForward ? 1 : 0), false, aForDocumentNavigation, aResultContent);
subPresShell, rootElement, aOriginalStartContent, rootElement,
aForward, (aForward ? 1 : 0), false, aForDocumentNavigation,
aResultContent);
NS_ENSURE_SUCCESS(rv, false);
if (*aResultContent) {
return true;
@ -3773,7 +3776,7 @@ nsresult nsFocusManager::FocusFirst(Element* aRootElement,
// If the found content is in a chrome shell, navigate forward one
// tabbable item so that the first item is focused. Note that we
// always go forward and not back here.
nsIPresShell* presShell = doc->GetShell();
PresShell* presShell = doc->GetPresShell();
if (presShell) {
return GetNextTabbableContent(presShell, aRootElement, nullptr,
aRootElement, true, 1, false, false,

View File

@ -16,7 +16,6 @@
#include "nsDocShell.h"
#include "nsIDOMMozBrowserFrame.h"
#include "nsIDOMWindow.h"
#include "nsIPresShell.h"
#include "nsIContentInlines.h"
#include "nsIContentViewer.h"
#include "mozilla/dom/Document.h"
@ -86,6 +85,7 @@
#include "mozilla/gfx/CrossProcessPaint.h"
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
#include "mozilla/layout/RenderFrame.h"
#include "mozilla/PresShell.h"
#include "mozilla/ServoCSSParser.h"
#include "mozilla/ServoStyleSet.h"
#include "nsGenericHTMLFrameElement.h"
@ -1005,9 +1005,9 @@ nsresult nsFrameLoader::SwapWithOtherRemoteLoader(
return NS_ERROR_NOT_IMPLEMENTED;
}
nsIPresShell* ourShell = ourDoc->GetShell();
nsIPresShell* otherShell = otherDoc->GetShell();
if (!ourShell || !otherShell) {
PresShell* ourPresShell = ourDoc->GetPresShell();
PresShell* otherPresShell = otherDoc->GetPresShell();
if (!ourPresShell || !otherPresShell) {
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -1153,8 +1153,8 @@ nsresult nsFrameLoader::SwapWithOtherRemoteLoader(
ourFrameFrame->EndSwapDocShells(otherFrame);
ourShell->BackingScaleFactorChanged();
otherShell->BackingScaleFactorChanged();
ourPresShell->BackingScaleFactorChanged();
otherPresShell->BackingScaleFactorChanged();
// Initialize browser API if needed now that owner content has changed.
InitializeBrowserAPI();
@ -1417,9 +1417,9 @@ nsresult nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
NS_ASSERTION(ourDoc == ourParentDocument, "Unexpected parent document");
NS_ASSERTION(otherDoc == otherParentDocument, "Unexpected parent document");
nsIPresShell* ourShell = ourDoc->GetShell();
nsIPresShell* otherShell = otherDoc->GetShell();
if (!ourShell || !otherShell) {
PresShell* ourPresShell = ourDoc->GetPresShell();
PresShell* otherPresShell = otherDoc->GetPresShell();
if (!ourPresShell || !otherPresShell) {
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -1576,8 +1576,8 @@ nsresult nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
// hi-dpi and low-dpi screens), it will have style data that is based on
// the wrong appUnitsPerDevPixel value. So we tell the PresShells that their
// backing scale factor may have changed. (Bug 822266)
ourShell->BackingScaleFactorChanged();
otherShell->BackingScaleFactorChanged();
ourPresShell->BackingScaleFactorChanged();
otherPresShell->BackingScaleFactorChanged();
// Initialize browser API if needed now that owner content has changed
InitializeBrowserAPI();
@ -3097,7 +3097,7 @@ already_AddRefed<mozilla::dom::Promise> nsFrameLoader::DrawSnapshot(
aRv = NS_ERROR_FAILURE;
return nullptr;
}
nsIPresShell* presShell = document->GetShell();
PresShell* presShell = document->GetPresShell();
if (NS_WARN_IF(!presShell)) {
aRv = NS_ERROR_FAILURE;
return nullptr;

View File

@ -96,6 +96,7 @@
#include "mozilla/EventListenerManager.h"
#include "mozilla/EventStates.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/PresShell.h"
#include "mozilla/ProcessHangMonitor.h"
#include "mozilla/ScrollTypes.h"
#include "mozilla/ThrottledEventQueue.h"
@ -123,7 +124,6 @@
#include "nsIEmbeddingSiteWindow.h"
#include "nsThreadUtils.h"
#include "nsILoadContext.h"
#include "nsIPresShell.h"
#include "nsIScrollableFrame.h"
#include "nsView.h"
#include "nsViewManager.h"
@ -1136,9 +1136,9 @@ void nsGlobalWindowInner::FreeInnerObjects() {
}
if (mObservingDidRefresh) {
nsIPresShell* shell = mDoc->GetShell();
if (shell) {
Unused << shell->RemovePostRefreshObserver(this);
PresShell* presShell = mDoc->GetPresShell();
if (presShell) {
Unused << presShell->RemovePostRefreshObserver(this);
}
}
}
@ -6258,8 +6258,8 @@ already_AddRefed<Promise> nsGlobalWindowInner::PromiseDocumentFlushed(
return nullptr;
}
nsIPresShell* shell = mDoc->GetShell();
if (!shell) {
PresShell* presShell = mDoc->GetPresShell();
if (!presShell) {
aError.Throw(NS_ERROR_FAILURE);
return nullptr;
}
@ -6282,13 +6282,13 @@ already_AddRefed<Promise> nsGlobalWindowInner::PromiseDocumentFlushed(
UniquePtr<PromiseDocumentFlushedResolver> flushResolver(
new PromiseDocumentFlushedResolver(resultPromise, aCallback));
if (!shell->NeedStyleFlush() && !shell->NeedLayoutFlush()) {
if (!presShell->NeedStyleFlush() && !presShell->NeedLayoutFlush()) {
flushResolver->Call();
return resultPromise.forget();
}
if (!mObservingDidRefresh) {
bool success = shell->AddPostRefreshObserver(this);
bool success = presShell->AddPostRefreshObserver(this);
if (!success) {
aError.Throw(NS_ERROR_FAILURE);
return nullptr;
@ -6335,9 +6335,9 @@ void nsGlobalWindowInner::CallOrCancelDocumentFlushedResolvers() {
// PromiseDocumentFlushed. Add here and leave.
// FIXME: Handle this case inside PromiseDocumentFlushed (bug 1442824).
if (mDoc) {
nsIPresShell* shell = mDoc->GetShell();
if (shell) {
(void)shell->AddPostRefreshObserver(this);
PresShell* presShell = mDoc->GetPresShell();
if (presShell) {
Unused << presShell->AddPostRefreshObserver(this);
break;
}
}
@ -6366,10 +6366,10 @@ void nsGlobalWindowInner::DidRefresh() {
MOZ_ASSERT(mDoc);
nsIPresShell* shell = mDoc->GetShell();
MOZ_ASSERT(shell);
PresShell* presShell = mDoc->GetPresShell();
MOZ_ASSERT(presShell);
if (shell->NeedStyleFlush() || shell->NeedLayoutFlush()) {
if (presShell->NeedStyleFlush() || presShell->NeedLayoutFlush()) {
// By the time our observer fired, something has already invalidated
// style or layout - or perhaps we're still in the middle of a flush that
// was interrupted. In either case, we'll wait until the next refresh driver
@ -6378,7 +6378,7 @@ void nsGlobalWindowInner::DidRefresh() {
return;
}
bool success = shell->RemovePostRefreshObserver(this);
bool success = presShell->RemovePostRefreshObserver(this);
if (!success) {
return;
}

View File

@ -56,6 +56,7 @@
#include "nsGlobalWindow.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/MainThreadIdlePeriod.h"
#include "mozilla/PresShell.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/dom/DOMException.h"
@ -89,7 +90,6 @@
#include "GeckoProfiler.h"
#include "mozilla/IdleTaskRunner.h"
#include "nsIDocShell.h"
#include "nsIPresShell.h"
#include "nsViewManager.h"
#include "mozilla/EventStateManager.h"
@ -1943,7 +1943,7 @@ void nsJSContext::MaybeRunNextCollectorSlice(nsIDocShell* aDocShell,
return;
}
nsIPresShell* presShell = rootDocument->GetShell();
PresShell* presShell = rootDocument->GetPresShell();
if (!presShell) {
return;
}

View File

@ -31,6 +31,7 @@
#include "mozilla/dom/HTMLImageElement.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "mozilla/dom/KeyframeEffect.h"
#include "mozilla/PresShell.h"
#include "nsWrapperCacheInlines.h"
#include "nsObjectLoadingContent.h"
#include "nsDOMMutationObserver.h"
@ -67,8 +68,8 @@ enum class IsRemoveNotification {
COMPOSED_DOC_DECL \
NS_ASSERTION(node->OwnerDoc() == doc, "Bogus document"); \
if (remove_ == IsRemoveNotification::Yes && node->GetComposedDoc()) { \
if (nsIPresShell* shell = doc->GetObservingShell()) { \
shell->func_ params_; \
if (PresShell* presShell = doc->GetObservingPresShell()) { \
presShell->func_ params_; \
} \
} \
doc->BindingManager()->func_ params_; \
@ -93,8 +94,8 @@ enum class IsRemoveNotification {
(remove_ == IsRemoveNotification::Yes && \
!strcmp(#func_, "NativeAnonymousChildListChange"))); \
if (remove_ == IsRemoveNotification::No && last == doc) { \
if (nsIPresShell* shell = doc->GetObservingShell()) { \
shell->func_ params_; \
if (PresShell* presShell = doc->GetObservingPresShell()) { \
presShell->func_ params_; \
} \
} \
if (needsEnterLeave) { \

View File

@ -26,7 +26,6 @@
#include "nsPluginInstanceOwner.h"
#include "nsJSNPRuntime.h"
#include "nsINestedURI.h"
#include "nsIPresShell.h"
#include "nsScriptSecurityManager.h"
#include "nsIScriptSecurityManager.h"
#include "nsIStreamConverterService.h"
@ -92,6 +91,7 @@
#include "mozilla/dom/HTMLObjectElement.h"
#include "mozilla/net/UrlClassifierFeatureFactory.h"
#include "mozilla/LoadInfo.h"
#include "mozilla/PresShell.h"
#include "nsChannelClassifier.h"
#include "nsFocusManager.h"
@ -2485,9 +2485,9 @@ void nsObjectLoadingContent::NotifyStateChanged(ObjectType aOldType,
} else if (aOldType != mType) {
// If our state changed, then we already recreated frames
// Otherwise, need to do that here
nsCOMPtr<nsIPresShell> shell = doc->GetShell();
if (shell) {
shell->PostRecreateFramesFor(thisEl);
RefPtr<PresShell> presShell = doc->GetPresShell();
if (presShell) {
presShell->PostRecreateFramesFor(thisEl);
}
}

View File

@ -30,6 +30,7 @@
#include "mozilla/dom/ShadowRoot.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/dom/Text.h"
#include "mozilla/PresShell.h"
#include "mozilla/Telemetry.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/Likely.h"
@ -68,8 +69,8 @@ static void InvalidateAllFrames(nsINode* aNode) {
}
case nsINode::DOCUMENT_NODE: {
Document* doc = static_cast<Document*>(aNode);
nsIPresShell* shell = doc ? doc->GetShell() : nullptr;
frame = shell ? shell->GetRootFrame() : nullptr;
PresShell* presShell = doc ? doc->GetPresShell() : nullptr;
frame = presShell ? presShell->GetRootFrame() : nullptr;
break;
}
}
@ -2728,8 +2729,8 @@ static void ExtractRectFromOffset(nsIFrame* aFrame, const int32_t aOffset,
static nsTextFrame* GetTextFrameForContent(nsIContent* aContent,
bool aFlushLayout) {
Document* doc = aContent->OwnerDoc();
nsIPresShell* presShell = doc->GetShell();
RefPtr<Document> doc = aContent->OwnerDoc();
PresShell* presShell = doc->GetPresShell();
if (!presShell) {
return nullptr;
}

View File

@ -20,6 +20,7 @@
#include "mozilla/dom/CanvasPattern.h"
#include "mozilla/gfx/Rect.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/PresShell.h"
#include "mozilla/UniquePtr.h"
#include "gfx2DGlue.h"
#include "imgIEncoder.h"
@ -392,7 +393,7 @@ class CanvasRenderingContext2D final : public nsICanvasRenderingContextInternal,
*/
nsIPresShell* GetPresShell() final {
if (mCanvasElement) {
return mCanvasElement->OwnerDoc()->GetShell();
return mCanvasElement->OwnerDoc()->GetPresShell();
}
if (mDocShell) {
return mDocShell->GetPresShell();

View File

@ -13,6 +13,7 @@
#include "nsRefreshDriver.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "mozilla/dom/OffscreenCanvas.h"
#include "mozilla/PresShell.h"
#include "mozilla/RefPtr.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/NotNull.h"
@ -58,7 +59,7 @@ class nsICanvasRenderingContextInternal : public nsISupports,
virtual nsIPresShell* GetPresShell() {
if (mCanvasElement) {
return mCanvasElement->OwnerDoc()->GetShell();
return mCanvasElement->OwnerDoc()->GetPresShell();
}
return nullptr;
}

View File

@ -8,6 +8,7 @@
#include "mozilla/ContentIterator.h"
#include "mozilla/IMEStateManager.h"
#include "mozilla/PresShell.h"
#include "mozilla/TextComposition.h"
#include "mozilla/TextEvents.h"
#include "mozilla/dom/Element.h"
@ -21,7 +22,6 @@
#include "nsFocusManager.h"
#include "nsFontMetrics.h"
#include "nsFrameSelection.h"
#include "nsIPresShell.h"
#include "nsIFrame.h"
#include "nsIObjectFrame.h"
#include "nsLayoutUtils.h"
@ -287,7 +287,7 @@ nsresult ContentEventHandler::InitRootContent(Selection* aNormalSelection) {
NS_ASSERTION(startNode->GetComposedDoc() == endNode->GetComposedDoc(),
"firstNormalSelectionRange crosses the document boundary");
mRootContent = startNode->GetSelectionRootContent(mDocument->GetShell());
mRootContent = startNode->GetSelectionRootContent(mDocument->GetPresShell());
if (NS_WARN_IF(!mRootContent)) {
return NS_ERROR_FAILURE;
}
@ -309,8 +309,8 @@ nsresult ContentEventHandler::InitCommon(SelectionType aSelectionType,
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISelectionController> selectionController;
if (nsIPresShell* shell = mDocument->GetShell()) {
selectionController = shell->GetSelectionControllerForFocusedContent();
if (PresShell* presShell = mDocument->GetPresShell()) {
selectionController = presShell->GetSelectionControllerForFocusedContent();
}
if (NS_WARN_IF(!selectionController)) {
return NS_ERROR_NOT_AVAILABLE;
@ -965,8 +965,8 @@ nsresult ContentEventHandler::ExpandToClusterBoundary(nsIContent* aContent,
NS_ASSERTION(*aXPOffset <= aContent->TextLength(), "offset is out of range.");
MOZ_DIAGNOSTIC_ASSERT(mDocument->GetShell());
RefPtr<nsFrameSelection> fs = mDocument->GetShell()->FrameSelection();
MOZ_DIAGNOSTIC_ASSERT(mDocument->GetPresShell());
RefPtr<nsFrameSelection> fs = mDocument->GetPresShell()->FrameSelection();
int32_t offsetInFrame;
CaretAssociationHint hint =
aForward ? CARET_ASSOCIATE_BEFORE : CARET_ASSOCIATE_AFTER;
@ -2511,9 +2511,9 @@ nsresult ContentEventHandler::OnQueryCharacterAtPoint(
aEvent->mReply.mOffset = aEvent->mReply.mTentativeCaretOffset =
WidgetQueryContentEvent::NOT_FOUND;
nsIPresShell* shell = mDocument->GetShell();
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
nsIFrame* rootFrame = shell->GetRootFrame();
PresShell* presShell = mDocument->GetPresShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
nsIFrame* rootFrame = presShell->GetRootFrame();
NS_ENSURE_TRUE(rootFrame, NS_ERROR_FAILURE);
nsIWidget* rootWidget = rootFrame->GetNearestWidget();
NS_ENSURE_TRUE(rootWidget, NS_ERROR_FAILURE);
@ -2623,9 +2623,9 @@ nsresult ContentEventHandler::OnQueryDOMWidgetHittest(
NS_ENSURE_TRUE(aEvent->mWidget, NS_ERROR_FAILURE);
nsIPresShell* shell = mDocument->GetShell();
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
nsIFrame* docFrame = shell->GetRootFrame();
PresShell* presShell = mDocument->GetPresShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
nsIFrame* docFrame = presShell->GetRootFrame();
NS_ENSURE_TRUE(docFrame, NS_ERROR_FAILURE);
LayoutDeviceIntPoint eventLoc =

View File

@ -18,6 +18,7 @@
#include "mozilla/Maybe.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Event.h"
@ -445,9 +446,9 @@ void EventListenerManager::ProcessApzAwareEventListenerAdd() {
}
if (doc && gfxPlatform::AsyncPanZoomEnabled()) {
nsIPresShell* ps = doc->GetShell();
if (ps) {
nsIFrame* f = ps->GetRootFrame();
PresShell* presShell = doc->GetPresShell();
if (presShell) {
nsIFrame* f = presShell->GetRootFrame();
if (f) {
f->SchedulePaint();
}

View File

@ -855,9 +855,9 @@ void EventStateManager::NotifyTargetUserActivation(WidgetEvent* aEvent,
already_AddRefed<EventStateManager> EventStateManager::ESMFromContentOrThis(
nsIContent* aContent) {
if (aContent) {
nsIPresShell* shell = aContent->OwnerDoc()->GetShell();
if (shell) {
nsPresContext* prescontext = shell->GetPresContext();
PresShell* presShell = aContent->OwnerDoc()->GetPresShell();
if (presShell) {
nsPresContext* prescontext = presShell->GetPresContext();
if (prescontext) {
RefPtr<EventStateManager> esm = prescontext->EventStateManager();
if (esm) {
@ -4302,9 +4302,9 @@ void EventStateManager::NotifyMouseOver(WidgetMouseEvent* aMouseEvent,
if (Document* parentDoc = mDocument->GetParentDocument()) {
if (nsCOMPtr<nsIContent> docContent =
parentDoc->FindContentForSubDocument(mDocument)) {
if (nsIPresShell* parentShell = parentDoc->GetShell()) {
if (PresShell* parentPresShell = parentDoc->GetPresShell()) {
RefPtr<EventStateManager> parentESM =
parentShell->GetPresContext()->EventStateManager();
parentPresShell->GetPresContext()->EventStateManager();
parentESM->NotifyMouseOver(aMouseEvent, docContent);
}
}

View File

@ -14,6 +14,7 @@
#include "mozilla/EventStates.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/TextComposition.h"
#include "mozilla/TextEvents.h"
#include "mozilla/Unused.h"
@ -32,7 +33,6 @@
#include "nsIFormControl.h"
#include "nsINode.h"
#include "nsIObserverService.h"
#include "nsIPresShell.h"
#include "nsISupports.h"
#include "nsPresContext.h"
@ -922,11 +922,11 @@ void IMEStateManager::UpdateIMEState(const IMEState& aNewIMEState,
return;
}
nsCOMPtr<nsIPresShell> presShell;
RefPtr<PresShell> presShell;
if (!aEditorBase) {
MOZ_ASSERT(aContent, "we must have content");
Document* doc = aContent->OwnerDoc();
presShell = doc->GetShell();
presShell = doc->GetPresShell();
} else {
presShell = aEditorBase->GetPresShell();
}

View File

@ -627,8 +627,8 @@ void PointerEventHandler::DispatchGotOrLostPointerCaptureEvent(
bool aIsGotCapture, const WidgetPointerEvent* aPointerEvent,
nsIContent* aCaptureTarget) {
Document* targetDoc = aCaptureTarget->OwnerDoc();
nsCOMPtr<nsIPresShell> shell = targetDoc->GetShell();
if (NS_WARN_IF(!shell)) {
RefPtr<PresShell> presShell = targetDoc->GetPresShell();
if (NS_WARN_IF(!presShell)) {
return;
}
@ -654,7 +654,7 @@ void PointerEventHandler::DispatchGotOrLostPointerCaptureEvent(
aPointerEvent->mWidget);
localEvent.AssignPointerEventData(*aPointerEvent, true);
DebugOnly<nsresult> rv = shell->HandleEventWithTarget(
DebugOnly<nsresult> rv = presShell->HandleEventWithTarget(
&localEvent, aCaptureTarget->GetPrimaryFrame(), aCaptureTarget, &status);
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),

View File

@ -12,6 +12,7 @@
#include "mozilla/dom/ImageDocumentBinding.h"
#include "mozilla/dom/HTMLImageElement.h"
#include "mozilla/dom/MouseEvent.h"
#include "mozilla/PresShell.h"
#include "mozilla/StaticPrefs.h"
#include "nsRect.h"
#include "nsIImageLoadingContent.h"
@ -26,7 +27,6 @@
#include "imgILoader.h"
#include "imgIContainer.h"
#include "imgINotificationObserver.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsIChannel.h"
#include "nsIContentPolicy.h"
@ -402,12 +402,12 @@ void ImageDocument::ScrollImageTo(int32_t aX, int32_t aY, bool restoreImage) {
FlushPendingNotifications(FlushType::Layout);
}
nsCOMPtr<nsIPresShell> shell = GetShell();
if (!shell) {
RefPtr<PresShell> presShell = GetPresShell();
if (!presShell) {
return;
}
nsIScrollableFrame* sf = shell->GetRootScrollFrameAsScrollable();
nsIScrollableFrame* sf = presShell->GetRootScrollFrameAsScrollable();
if (!sf) {
return;
}
@ -835,9 +835,9 @@ float ImageDocument::GetZoomLevel() {
#if defined(MOZ_WIDGET_ANDROID)
float ImageDocument::GetResolution() {
float resolution = mOriginalResolution;
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
resolution = shell->GetResolution();
RefPtr<PresShell> presShell = GetPresShell();
if (presShell) {
resolution = presShell->GetResolution();
}
return resolution;
}

View File

@ -8,7 +8,6 @@
#include "nsGkAtoms.h"
#include "nsRect.h"
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "nsIScrollable.h"
#include "nsViewManager.h"
#include "nsITextToSubURI.h"
@ -19,6 +18,7 @@
#include "nsNodeInfoManager.h"
#include "nsContentUtils.h"
#include "nsDocElementCreatedNotificationRunner.h"
#include "mozilla/PresShell.h"
#include "mozilla/Services.h"
#include "nsServiceManagerUtils.h"
#include "nsIPrincipal.h"
@ -242,11 +242,11 @@ nsresult MediaDocument::CreateSyntheticDocument() {
nsresult MediaDocument::StartLayout() {
mMayStartLayout = true;
nsCOMPtr<nsIPresShell> shell = GetShell();
RefPtr<PresShell> presShell = GetPresShell();
// Don't mess with the presshell if someone has already handled
// its initial reflow.
if (shell && !shell->DidInitialize()) {
nsresult rv = shell->Initialize();
if (presShell && !presShell->DidInitialize()) {
nsresult rv = presShell->Initialize();
NS_ENSURE_SUCCESS(rv, rv);
}

View File

@ -7,7 +7,6 @@
#include "MediaDocument.h"
#include "nsIPluginDocument.h"
#include "nsGkAtoms.h"
#include "nsIPresShell.h"
#include "nsIObjectFrame.h"
#include "nsNPAPIPluginInstance.h"
#include "DocumentInlines.h"
@ -17,6 +16,7 @@
#include "nsContentPolicyUtils.h"
#include "nsIPropertyBag2.h"
#include "mozilla/dom/Element.h"
#include "mozilla/PresShell.h"
#include "nsObjectLoadingContent.h"
#include "GeckoProfiler.h"
@ -182,7 +182,7 @@ nsresult PluginDocument::StartDocumentLoad(const char* aCommand,
}
nsresult PluginDocument::CreateSyntheticPluginDocument() {
NS_ASSERTION(!GetShell() || !GetShell()->DidInitialize(),
NS_ASSERTION(!GetPresShell() || !GetPresShell()->DidInitialize(),
"Creating synthetic plugin document content too late");
// make our generic document

View File

@ -8,6 +8,7 @@
#include "nsIContentPolicy.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/HTMLAllCollection.h"
#include "mozilla/dom/FeaturePolicyUtils.h"
#include "nsCOMPtr.h"
@ -1432,7 +1433,7 @@ void nsHTMLDocument::Close(ErrorResult& rv) {
// above about reusing frames applies.
//
// XXXhsivonen keeping this around for bug 577508 / 253951 still :-(
if (GetShell()) {
if (GetPresShell()) {
FlushPendingNotifications(FlushType::Layout);
}
}
@ -1873,8 +1874,10 @@ void nsHTMLDocument::TearingDownEditor() {
EditingState oldState = mEditingState;
mEditingState = eTearingDown;
nsCOMPtr<nsIPresShell> presShell = GetShell();
if (!presShell) return;
RefPtr<PresShell> presShell = GetPresShell();
if (!presShell) {
return;
}
nsTArray<RefPtr<StyleSheet>> agentSheets;
presShell->GetAgentStyleSheets(agentSheets);
@ -2018,7 +2021,7 @@ nsresult nsHTMLDocument::EditingStateChanged() {
EditingState oldState = mEditingState;
nsAutoEditingState push(this, eSettingUp);
nsCOMPtr<nsIPresShell> presShell = GetShell();
RefPtr<PresShell> presShell = GetPresShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
// Before making this window editable, we need to modify UA style sheet
@ -2200,7 +2203,7 @@ void nsHTMLDocument::MaybeDispatchCheckKeyPressEventModelEvent() {
}
void nsHTMLDocument::SetKeyPressEventModel(uint16_t aKeyPressEventModel) {
nsIPresShell* presShell = GetShell();
PresShell* presShell = GetPresShell();
if (!presShell) {
return;
}

View File

@ -8,7 +8,6 @@
#include "mozilla/TextInputListener.h"
#include "nsCOMPtr.h"
#include "nsIPresShell.h"
#include "nsView.h"
#include "nsCaret.h"
#include "nsLayoutCID.h"
@ -35,6 +34,7 @@
#include "nsTextNode.h"
#include "nsIController.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/PresShell.h"
#include "mozilla/TextEvents.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/ScriptSettings.h"
@ -799,7 +799,7 @@ void TextInputListener::OnSelectionChange(Selection& aSelection,
if (content) {
nsCOMPtr<Document> doc = content->GetComposedDoc();
if (doc) {
nsCOMPtr<nsIPresShell> presShell = doc->GetShell();
RefPtr<PresShell> presShell = doc->GetPresShell();
if (presShell) {
nsEventStatus status = nsEventStatus_eIgnore;
WidgetEvent event(true, eFormSelect);

View File

@ -205,7 +205,7 @@ already_AddRefed<Document> TabChildBase::GetDocument() const {
already_AddRefed<nsIPresShell> TabChildBase::GetPresShell() const {
nsCOMPtr<nsIPresShell> result;
if (nsCOMPtr<Document> doc = GetDocument()) {
result = doc->GetShell();
result = doc->GetPresShell();
}
return result.forget();
}
@ -455,12 +455,12 @@ TabChild::Observe(nsISupports* aSubject, const char* aTopic,
nsCOMPtr<Document> doc(GetDocument());
if (subject == doc) {
nsCOMPtr<nsIPresShell> shell(doc->GetShell());
if (shell) {
shell->SetIsFirstPaint(true);
RefPtr<PresShell> presShell = doc->GetPresShell();
if (presShell) {
presShell->SetIsFirstPaint(true);
}
APZCCallbackHelper::InitializeRootDisplayport(shell);
APZCCallbackHelper::InitializeRootDisplayport(presShell);
}
}
}

View File

@ -2171,7 +2171,7 @@ mozilla::ipc::IPCResult TabParent::RecvAccessKeyNotHandled(
// Here we convert the WidgetEvent that we received to an Event
// to be able to dispatch it to the <browser> element as the target element.
Document* doc = mFrameElement->OwnerDoc();
nsIPresShell* presShell = doc->GetShell();
PresShell* presShell = doc->GetPresShell();
NS_ENSURE_TRUE(presShell, IPC_OK());
if (presShell->CanDispatchEvent()) {
@ -2538,9 +2538,9 @@ mozilla::ipc::IPCResult TabParent::RecvSetInputContext(
already_AddRefed<nsIWidget> TabParent::GetTopLevelWidget() {
nsCOMPtr<nsIContent> content = mFrameElement;
if (content) {
nsIPresShell* shell = content->OwnerDoc()->GetShell();
if (shell) {
nsViewManager* vm = shell->GetViewManager();
PresShell* presShell = content->OwnerDoc()->GetPresShell();
if (presShell) {
nsViewManager* vm = presShell->GetViewManager();
nsCOMPtr<nsIWidget> widget;
vm->GetRootWidget(getter_AddRefs(widget));
return widget.forget();
@ -3297,8 +3297,8 @@ mozilla::ipc::IPCResult TabParent::RecvInvokeDragSession(
const gfx::SurfaceFormat& aFormat, const LayoutDeviceIntRect& aDragRect,
const IPC::Principal& aPrincipal) {
mInitialDataTransferItems.Clear();
nsIPresShell* shell = mFrameElement->OwnerDoc()->GetShell();
if (!shell) {
PresShell* presShell = mFrameElement->OwnerDoc()->GetPresShell();
if (!presShell) {
Unused << Manager()->SendEndDragSession(true, true, LayoutDeviceIntPoint(),
0);
// Continue sending input events with input priority when stopping the dnd
@ -3307,7 +3307,7 @@ mozilla::ipc::IPCResult TabParent::RecvInvokeDragSession(
return IPC_OK();
}
EventStateManager* esm = shell->GetPresContext()->EventStateManager();
EventStateManager* esm = presShell->GetPresContext()->EventStateManager();
for (uint32_t i = 0; i < aTransfers.Length(); ++i) {
mInitialDataTransferItems.AppendElement(std::move(aTransfers[i].items()));
}

View File

@ -58,6 +58,7 @@
#include "mozilla/dom/ProcessingInstruction.h"
#include "mozilla/dom/ScriptLoader.h"
#include "mozilla/LoadInfo.h"
#include "mozilla/PresShell.h"
#include "nsXULPrototypeCache.h"
#include "nsXULElement.h"
@ -642,9 +643,9 @@ void PrototypeDocumentContentSink::StartLayout() {
"PrototypeDocumentContentSink::StartLayout", LAYOUT,
mDocumentURI->GetSpecOrDefault());
mDocument->SetMayStartLayout(true);
nsCOMPtr<nsIPresShell> shell = mDocument->GetShell();
if (shell && !shell->DidInitialize()) {
nsresult rv = shell->Initialize();
RefPtr<PresShell> presShell = mDocument->GetPresShell();
if (presShell && !presShell->DidInitialize()) {
nsresult rv = presShell->Initialize();
if (NS_FAILED(rv)) {
return;
}

View File

@ -9,6 +9,7 @@
#include <algorithm>
#include "mozilla/AutoRestore.h"
#include "mozilla/PresShell.h"
#include "mozilla/RestyleManager.h"
#include "mozilla/SMILTimedElement.h"
#include "mozilla/dom/DocumentInlines.h"
@ -17,7 +18,6 @@
#include "nsContentUtils.h"
#include "nsCSSProps.h"
#include "mozilla/dom/Document.h"
#include "nsIPresShell.h"
#include "nsIPresShellInlines.h"
#include "nsITimer.h"
#include "SMILCompositor.h"
@ -729,8 +729,8 @@ nsRefreshDriver* SMILAnimationController::GetRefreshDriver() {
}
void SMILAnimationController::FlagDocumentNeedsFlush() {
if (nsIPresShell* shell = mDocument->GetShell()) {
shell->SetNeedStyleFlush();
if (PresShell* presShell = mDocument->GetPresShell()) {
presShell->SetNeedStyleFlush();
}
}

View File

@ -14,6 +14,7 @@
#include "gfxPlatform.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "mozilla/PresShell.h"
#include "mozilla/RefPtr.h"
#include "mozilla/SVGContextPaint.h"
#include "mozilla/TextUtils.h"
@ -516,7 +517,7 @@ static gfx::Matrix GetCTMInternal(SVGElement* aElement, bool aScreenCTM,
float x = 0.0f, y = 0.0f;
if (currentDoc &&
element->NodeInfo()->Equals(nsGkAtoms::svg, kNameSpaceID_SVG)) {
nsIPresShell* presShell = currentDoc->GetShell();
PresShell* presShell = currentDoc->GetPresShell();
if (presShell) {
nsIFrame* frame = element->GetPrimaryFrame();
nsIFrame* ancestorFrame = presShell->GetRootFrame();

View File

@ -19,6 +19,7 @@
#include "mozilla/DeclarationBlock.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/InternalMutationEvent.h"
#include "mozilla/PresShell.h"
#include "mozilla/RestyleManager.h"
#include "mozilla/SMILAnimationController.h"
#include "mozilla/SVGContentUtils.h"
@ -34,7 +35,6 @@
#include "mozilla/dom/Document.h"
#include "nsError.h"
#include "nsGkAtoms.h"
#include "nsIPresShell.h"
#include "nsIFrame.h"
#include "nsQueryObject.h"
#include "nsLayoutUtils.h"
@ -105,9 +105,9 @@ JSObject* SVGElement::WrapNode(JSContext* aCx,
void SVGElement::DidAnimateClass() {
// For Servo, snapshot the element before we change it.
nsIPresShell* shell = OwnerDoc()->GetShell();
if (shell) {
if (nsPresContext* presContext = shell->GetPresContext()) {
PresShell* presShell = OwnerDoc()->GetPresShell();
if (presShell) {
if (nsPresContext* presContext = presShell->GetPresContext()) {
presContext->RestyleManager()->ClassAttributeWillBeChangedBySMIL(this);
}
}
@ -121,8 +121,8 @@ void SVGElement::DidAnimateClass() {
// FIXME(emilio): This re-selector-matches, but we do the snapshot stuff right
// above... Is this needed anymore?
if (shell) {
shell->RestyleForAnimation(this, StyleRestyleHint_RESTYLE_SELF);
if (presShell) {
presShell->RestyleForAnimation(this, StyleRestyleHint_RESTYLE_SELF);
}
}

View File

@ -12,6 +12,7 @@
#include "mozilla/dom/SVGRect.h"
#include "mozilla/dom/SVGViewElement.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/PresShell.h"
#include "mozilla/SMILAnimationController.h"
#include "mozilla/SMILTimeContainer.h"
@ -319,7 +320,7 @@ void SVGSVGElement::SetCurrentScaleTranslate(float s, float x, float y) {
// now dispatch the appropriate event if we are the root element
Document* doc = GetUncomposedDoc();
if (doc) {
nsCOMPtr<nsIPresShell> presShell = doc->GetShell();
RefPtr<PresShell> presShell = doc->GetPresShell();
if (presShell && IsRoot()) {
nsEventStatus status = nsEventStatus_eIgnore;
if (mPreviousScale == mCurrentScale) {

View File

@ -5,9 +5,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/XBLChildrenElement.h"
#include "nsCharSeparatedTokenizer.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/NodeListBinding.h"
#include "nsAttrValueOrString.h"
#include "nsCharSeparatedTokenizer.h"
namespace mozilla {
namespace dom {
@ -46,8 +48,8 @@ void XBLChildrenElement::DoRemoveDefaultContent(bool aNotify) {
if (aNotify) {
Element* parent = GetParentElement();
if (Document* doc = parent->GetComposedDoc()) {
if (nsIPresShell* shell = doc->GetShell()) {
shell->DestroyFramesForAndRestyle(parent);
if (PresShell* presShell = doc->GetPresShell()) {
presShell->DestroyFramesForAndRestyle(parent);
}
}
}

View File

@ -19,7 +19,6 @@
#include "nsIContentInlines.h"
#include "mozilla/dom/Document.h"
#include "nsContentUtils.h"
#include "nsIPresShell.h"
#include "nsIPresShellInlines.h"
#include "nsIXMLContentSink.h"
#include "nsContentCID.h"
@ -51,6 +50,7 @@
#include "nsThreadUtils.h"
#include "mozilla/dom/NodeListBinding.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/PresShell.h"
#include "mozilla/Unused.h"
using namespace mozilla;
@ -228,8 +228,7 @@ nsresult nsBindingManager::ClearBinding(Element* aElement) {
nsCOMPtr<Document> doc = aElement->OwnerDoc();
// Destroy the frames here before the UnbindFromTree happens.
nsIPresShell* presShell = doc->GetShell();
if (presShell) {
if (PresShell* presShell = doc->GetPresShell()) {
presShell->DestroyFramesForAndRestyle(aElement);
}
@ -245,9 +244,9 @@ nsresult nsBindingManager::ClearBinding(Element* aElement) {
// been removed and style may have changed due to the removal of the
// anonymous children.
// XXXbz this should be using the current doc (if any), not the owner doc.
presShell = doc->GetShell(); // get the shell again, just in case it changed
// get the shell again, just in case it changed
PresShell* presShell = doc->GetPresShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
presShell->PostRecreateFramesFor(aElement);
return NS_OK;
}
@ -289,8 +288,8 @@ nsresult nsBindingManager::AddToAttachedQueue(nsXBLBinding* aBinding) {
}
// Make sure that flushes will flush out the new items as needed.
if (nsIPresShell* shell = mDocument->GetShell()) {
shell->SetNeedStyleFlush();
if (PresShell* presShell = mDocument->GetPresShell()) {
presShell->SetNeedStyleFlush();
}
return NS_OK;

View File

@ -16,6 +16,7 @@
#include "nsLayoutCID.h"
#include "mozilla/dom/URL.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/PresShell.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/ServoStyleRuleMap.h"
#include "mozilla/StyleSheet.h"
@ -94,9 +95,9 @@ nsresult nsXBLPrototypeResources::FlushSkinSheets() {
}
// There may be no shell during unlink.
if (auto* shell = doc->GetShell()) {
MOZ_ASSERT(shell->GetPresContext());
ComputeServoStyles(*shell->StyleSet());
if (PresShell* presShell = doc->GetPresShell()) {
MOZ_ASSERT(presShell->GetPresContext());
ComputeServoStyles(*presShell->StyleSet());
}
return NS_OK;

View File

@ -8,7 +8,6 @@
#include "nsString.h"
#include "mozilla/dom/Document.h"
#include "nsIContent.h"
#include "nsIPresShell.h"
#include "nsXBLService.h"
#include "nsIServiceManager.h"
#include "nsXBLResourceLoader.h"
@ -17,6 +16,7 @@
#include "imgILoader.h"
#include "imgRequestProxy.h"
#include "mozilla/ComputedStyle.h"
#include "mozilla/PresShell.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/css/Loader.h"
@ -162,8 +162,8 @@ nsXBLResourceLoader::StyleSheetLoaded(StyleSheet* aSheet, bool aWasDeferred,
// Our document might have been undisplayed after this sheet load
// was started, so check before building the XBL cascade data.
if (nsIPresShell* shell = mBoundDocument->GetShell()) {
mResources->ComputeServoStyles(*shell->StyleSet());
if (PresShell* presShell = mBoundDocument->GetPresShell()) {
mResources->ComputeServoStyles(*presShell->StyleSet());
}
// XXX Check for mPendingScripts when scripts also come online.
@ -214,12 +214,12 @@ void nsXBLResourceLoader::NotifyBoundElements() {
continue;
}
nsIPresShell* shell = doc->GetShell();
if (!shell) {
PresShell* presShell = doc->GetPresShell();
if (!presShell) {
continue;
}
shell->PostRecreateFramesFor(content->AsElement());
presShell->PostRecreateFramesFor(content->AsElement());
}
// Clear out the whole array.

View File

@ -36,7 +36,6 @@
#include "nsTArray.h"
#include "nsError.h"
#include "nsIPresShell.h"
#include "nsIDocumentObserver.h"
#include "nsFrameManager.h"
#include "nsIScriptSecurityManager.h"
@ -50,6 +49,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/ServoStyleSet.h"
#include "mozilla/RestyleManager.h"
#include "mozilla/dom/ChildIterator.h"
@ -116,8 +116,8 @@ class nsXBLBindingRequest {
// Destroy the frames for mBoundElement. Do this after getting the binding,
// since if the binding fetch fails then we don't want to destroy the
// frames.
if (nsIPresShell* shell = doc->GetShell()) {
shell->DestroyFramesForAndRestyle(mBoundElement->AsElement());
if (PresShell* presShell = doc->GetPresShell()) {
presShell->DestroyFramesForAndRestyle(mBoundElement->AsElement());
}
MOZ_ASSERT(!mBoundElement->GetPrimaryFrame());
}
@ -360,7 +360,7 @@ static void EnsureSubtreeStyled(Element* aElement) {
return;
}
nsIPresShell* presShell = aElement->OwnerDoc()->GetShell();
PresShell* presShell = aElement->OwnerDoc()->GetPresShell();
if (!presShell || !presShell->DidInitialize()) {
return;
}
@ -410,7 +410,7 @@ class MOZ_RAII AutoStyleElement {
}
~AutoStyleElement() {
nsIPresShell* presShell = mElement->OwnerDoc()->GetShell();
PresShell* presShell = mElement->OwnerDoc()->GetPresShell();
if (!mHadData || !presShell || !presShell->DidInitialize()) {
return;
}

View File

@ -18,6 +18,7 @@
#include "mozilla/EventStateManager.h"
#include "mozilla/EventStates.h"
#include "mozilla/DeclarationBlock.h"
#include "mozilla/PresShell.h"
#include "js/CompilationAndEvaluation.h"
#include "js/SourceText.h"
#include "nsFocusManager.h"
@ -25,7 +26,6 @@
#include "nsNameSpaceManager.h"
#include "nsIObjectInputStream.h"
#include "nsIObjectOutputStream.h"
#include "nsIPresShell.h"
#include "nsIPrincipal.h"
#include "nsIScriptContext.h"
#include "nsIScriptError.h"
@ -746,9 +746,9 @@ void nsXULElement::UnregisterAccessKey(const nsAString& aOldValue) {
//
Document* doc = GetComposedDoc();
if (doc && !aOldValue.IsEmpty()) {
nsIPresShell* shell = doc->GetShell();
PresShell* presShell = doc->GetPresShell();
if (shell) {
if (presShell) {
Element* element = this;
// find out what type of content node this is
@ -761,7 +761,7 @@ void nsXULElement::UnregisterAccessKey(const nsAString& aOldValue) {
}
if (element) {
shell->GetPresContext()->EventStateManager()->UnregisterAccessKey(
presShell->GetPresContext()->EventStateManager()->UnregisterAccessKey(
element, aOldValue.First());
}
}

View File

@ -197,7 +197,7 @@ class EditorBase : public nsIEditor,
Document* GetDocument() const { return mDocument; }
PresShell* GetPresShell() const {
return mDocument ? static_cast<PresShell*>(mDocument->GetShell()) : nullptr;
return mDocument ? mDocument->GetPresShell() : nullptr;
}
nsPresContext* GetPresContext() const {
PresShell* presShell = GetPresShell();
@ -220,7 +220,7 @@ class EditorBase : public nsIEditor,
if (!mDocument) {
return nullptr;
}
return static_cast<PresShell*>(mDocument->GetShell());
return mDocument->GetPresShell();
}
nsresult GetSelection(SelectionType aSelectionType,

View File

@ -11,8 +11,8 @@
#include "mozilla/dom/TabParent.h" // for TabParent
#include "mozilla/EventDispatcher.h" // for EventDispatcher
#include "mozilla/layout/RenderFrame.h" // For RenderFrame
#include "mozilla/PresShell.h" // For PresShell and nsIPresShell
#include "nsIContentInlines.h" // for nsINode::IsEditable()
#include "nsIPresShell.h" // for nsIPresShell
#include "nsLayoutUtils.h" // for nsLayoutUtils
#define ENABLE_FT_LOGGING 0
@ -49,7 +49,7 @@ static already_AddRefed<nsIPresShell> GetRetargetEventPresShell(
return nullptr;
}
nsCOMPtr<nsIPresShell> presShell = retargetEventDoc->GetShell();
nsCOMPtr<nsIPresShell> presShell = retargetEventDoc->GetPresShell();
return presShell.forget();
}

View File

@ -18,6 +18,7 @@
#include "mozilla/layers/ShadowLayers.h"
#include "mozilla/layers/WebRenderLayerManager.h"
#include "mozilla/layers/WebRenderBridgeChild.h"
#include "mozilla/PresShell.h"
#include "mozilla/TouchEvents.h"
#include "nsContainerFrame.h"
#include "nsContentUtils.h"
@ -73,7 +74,7 @@ static ScreenMargin RecenterDisplayPort(const ScreenMargin& aDisplayPort) {
static already_AddRefed<nsIPresShell> GetPresShell(const nsIContent* aContent) {
nsCOMPtr<nsIPresShell> result;
if (dom::Document* doc = aContent->GetComposedDoc()) {
result = doc->GetShell();
result = doc->GetPresShell();
}
return result.forget();
}
@ -436,11 +437,11 @@ nsPresContext* APZCCallbackHelper::GetPresContextForContent(
if (!doc) {
return nullptr;
}
nsIPresShell* shell = doc->GetShell();
if (!shell) {
PresShell* presShell = doc->GetPresShell();
if (!presShell) {
return nullptr;
}
return shell->GetPresContext();
return presShell->GetPresContext();
}
nsIPresShell* APZCCallbackHelper::GetRootContentDocumentPresShellForContent(
@ -461,11 +462,11 @@ static nsIPresShell* GetRootDocumentPresShell(nsIContent* aContent) {
if (!doc) {
return nullptr;
}
nsIPresShell* shell = doc->GetShell();
if (!shell) {
PresShell* presShell = doc->GetPresShell();
if (!presShell) {
return nullptr;
}
nsPresContext* context = shell->GetPresContext();
nsPresContext* context = presShell->GetPresContext();
if (!context) {
return nullptr;
}
@ -646,8 +647,8 @@ static nsIFrame* UpdateRootFrameForTouchTargetDocument(nsIFrame* aRootFrame) {
// necessary.
if (dom::Document* doc =
aRootFrame->PresShell()->GetPrimaryContentDocument()) {
if (nsIPresShell* shell = doc->GetShell()) {
if (nsIFrame* frame = shell->GetRootFrame()) {
if (PresShell* presShell = doc->GetPresShell()) {
if (nsIFrame* frame = presShell->GetRootFrame()) {
return frame;
}
}
@ -838,8 +839,8 @@ APZCCallbackHelper::SendSetTargetAPZCNotification(
return nullptr;
}
sLastTargetAPZCNotificationInputBlock = aInputBlockId;
if (nsIPresShell* shell = aDocument->GetShell()) {
if (nsIFrame* rootFrame = shell->GetRootFrame()) {
if (PresShell* presShell = aDocument->GetPresShell()) {
if (nsIFrame* rootFrame = presShell->GetRootFrame()) {
rootFrame = UpdateRootFrameForTouchTargetDocument(rootFrame);
bool waitForRefresh = false;
@ -866,7 +867,7 @@ APZCCallbackHelper::SendSetTargetAPZCNotification(
"At least one target got a new displayport, need to wait for "
"refresh\n");
return MakeUnique<DisplayportSetListener>(
aWidget, shell, aInputBlockId, std::move(targets));
aWidget, presShell, aInputBlockId, std::move(targets));
}
APZCCH_LOG("Sending target APZCs for input block %" PRIu64 "\n",
aInputBlockId);
@ -884,8 +885,8 @@ void APZCCallbackHelper::SendSetAllowedTouchBehaviorNotification(
if (!aWidget || !aDocument) {
return;
}
if (nsIPresShell* shell = aDocument->GetShell()) {
if (nsIFrame* rootFrame = shell->GetRootFrame()) {
if (PresShell* presShell = aDocument->GetPresShell()) {
if (nsIFrame* rootFrame = presShell->GetRootFrame()) {
rootFrame = UpdateRootFrameForTouchTargetDocument(rootFrame);
nsTArray<TouchBehaviorFlags> flags;

View File

@ -8,6 +8,7 @@
#include "mozilla/EventStateManager.h"
#include "mozilla/EventStates.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "base/message_loop.h"
#include "base/task.h"
#include "mozilla/dom/Element.h"
@ -131,11 +132,11 @@ static nsPresContext* GetPresContextFor(nsIContent* aContent) {
if (!aContent) {
return nullptr;
}
nsIPresShell* shell = aContent->OwnerDoc()->GetShell();
if (!shell) {
PresShell* presShell = aContent->OwnerDoc()->GetPresShell();
if (!presShell) {
return nullptr;
}
return shell->GetPresContext();
return presShell->GetPresContext();
}
void ActiveElementManager::SetActive(dom::Element* aTarget) {

View File

@ -8,6 +8,7 @@
#include "MainThreadUtils.h" // for NS_IsMainThread()
#include "base/message_loop.h" // for MessageLoop
#include "mozilla/PresShell.h"
#include "mozilla/dom/Element.h"
#include "mozilla/layers/CompositorBridgeParent.h"
#include "mozilla/layers/APZCCallbackHelper.h"
@ -17,7 +18,6 @@
#include "mozilla/layers/DoubleTapToZoom.h"
#include "mozilla/dom/Document.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIPresShell.h"
#include "nsLayoutUtils.h"
#include "nsView.h"
@ -141,7 +141,7 @@ void ChromeProcessController::HandleDoubleTap(
// Root Content Document. Unfortunately that frame does not know about the
// resolution of the document and so we must remove it before calculating
// the zoomToRect.
nsIPresShell* presShell = document->GetShell();
PresShell* presShell = document->GetPresShell();
const float resolution = presShell->GetResolution();
CSSPoint point(aPoint.x / resolution, aPoint.y / resolution);
CSSRect zoomToRect = CalculateRectToZoomTo(document, point);

View File

@ -6,6 +6,7 @@
#include "ContentProcessController.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/layers/APZCCallbackHelper.h"
#include "mozilla/layers/APZChild.h"
@ -67,11 +68,11 @@ void ContentProcessController::NotifyMozMouseScrollEvent(
void ContentProcessController::NotifyFlushComplete() {
if (mBrowser) {
nsCOMPtr<nsIPresShell> shell;
RefPtr<PresShell> presShell;
if (nsCOMPtr<dom::Document> doc = mBrowser->GetDocument()) {
shell = doc->GetShell();
presShell = doc->GetPresShell();
}
APZCCallbackHelper::NotifyFlushComplete(shell.get());
APZCCallbackHelper::NotifyFlushComplete(presShell);
}
}

View File

@ -8,6 +8,7 @@
#include <algorithm> // for std::min, std::max
#include "mozilla/PresShell.h"
#include "mozilla/AlreadyAddRefed.h"
#include "mozilla/dom/Element.h"
#include "nsCOMPtr.h"
@ -16,7 +17,6 @@
#include "nsIDOMWindow.h"
#include "nsIFrame.h"
#include "nsIFrameInlines.h"
#include "nsIPresShell.h"
#include "nsLayoutUtils.h"
#include "nsStyleConsts.h"
@ -28,7 +28,7 @@ namespace {
using FrameForPointOption = nsLayoutUtils::FrameForPointOption;
// Returns the DOM element found at |aPoint|, interpreted as being relative to
// the root frame of |aShell|. If the point is inside a subdocument, returns
// the root frame of |aPresShell|. If the point is inside a subdocument, returns
// an element inside the subdocument, rather than the subdocument element
// (and does so recursively).
// The implementation was adapted from DocumentOrShadowRoot::ElementFromPoint(),
@ -36,8 +36,8 @@ using FrameForPointOption = nsLayoutUtils::FrameForPointOption;
// to GetFrameForPoint(), so as to get the behaviour described above in the
// presence of subdocuments.
static already_AddRefed<dom::Element> ElementFromPoint(
const nsCOMPtr<nsIPresShell>& aShell, const CSSPoint& aPoint) {
nsIFrame* rootFrame = aShell->GetRootFrame();
const RefPtr<PresShell>& aPresShell, const CSSPoint& aPoint) {
nsIFrame* rootFrame = aPresShell->GetRootFrame();
if (!rootFrame) {
return nullptr;
}
@ -104,17 +104,18 @@ CSSRect CalculateRectToZoomTo(const RefPtr<dom::Document>& aRootContentDocument,
// An empty rect as return value is interpreted as "zoom out".
const CSSRect zoomOut;
nsCOMPtr<nsIPresShell> shell = aRootContentDocument->GetShell();
if (!shell) {
RefPtr<PresShell> presShell = aRootContentDocument->GetPresShell();
if (!presShell) {
return zoomOut;
}
nsIScrollableFrame* rootScrollFrame = shell->GetRootScrollFrameAsScrollable();
nsIScrollableFrame* rootScrollFrame =
presShell->GetRootScrollFrameAsScrollable();
if (!rootScrollFrame) {
return zoomOut;
}
nsCOMPtr<dom::Element> element = ElementFromPoint(shell, aPoint);
nsCOMPtr<dom::Element> element = ElementFromPoint(presShell, aPoint);
if (!element) {
return zoomOut;
}
@ -130,7 +131,7 @@ CSSRect CalculateRectToZoomTo(const RefPtr<dom::Document>& aRootContentDocument,
FrameMetrics metrics =
nsLayoutUtils::CalculateBasicFrameMetrics(rootScrollFrame);
CSSRect compositedArea(
CSSPoint::FromAppUnits(shell->GetVisualViewportOffset()),
CSSPoint::FromAppUnits(presShell->GetVisualViewportOffset()),
metrics.CalculateCompositedSizeInCssPixels());
const CSSCoord margin = 15;
CSSRect rect =

View File

@ -18,6 +18,7 @@
#include "mozilla/dom/TreeWalker.h"
#include "mozilla/IMEStateManager.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/PresShell.h"
#include "mozilla/StaticPrefs.h"
#include "nsCaret.h"
#include "nsContainerFrame.h"

View File

@ -6,6 +6,7 @@
#include "GeometryUtils.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/CharacterData.h"
#include "mozilla/dom/DOMPointBinding.h"
#include "mozilla/dom/GeometryUtilsBinding.h"
@ -33,8 +34,8 @@ enum GeometryNodeType {
static nsIFrame* GetFrameForNode(nsINode* aNode, GeometryNodeType aType) {
Document* doc = aNode->OwnerDoc();
if (aType == GEOMETRY_NODE_TEXT) {
if (nsIPresShell* shell = doc->GetShell()) {
shell->FrameConstructor()->EnsureFrameForTextNodeIsCreatedAfterFlush(
if (PresShell* presShell = doc->GetPresShell()) {
presShell->FrameConstructor()->EnsureFrameForTextNodeIsCreatedAfterFlush(
static_cast<CharacterData*>(aNode));
}
}
@ -45,7 +46,7 @@ static nsIFrame* GetFrameForNode(nsINode* aNode, GeometryNodeType aType) {
case GEOMETRY_NODE_ELEMENT:
return aNode->AsContent()->GetPrimaryFrame();
case GEOMETRY_NODE_DOCUMENT: {
nsIPresShell* presShell = doc->GetShell();
PresShell* presShell = doc->GetPresShell();
return presShell ? presShell->GetRootFrame() : nullptr;
}
default:

View File

@ -1317,9 +1317,9 @@ void PresShell::Destroy() {
// hierarchy is torn down to avoid finding deleted frames through
// this presshell while the frames are being torn down
if (mDocument) {
NS_ASSERTION(mDocument->GetShell() == this, "Wrong shell?");
NS_ASSERTION(mDocument->GetPresShell() == this, "Wrong shell?");
mDocument->ClearServoRestyleRoot();
mDocument->DeleteShell();
mDocument->DeletePresShell();
if (mDocument->HasAnimationController()) {
mDocument->GetAnimationController()->NotifyRefreshDriverDestroying(rd);
@ -3415,8 +3415,8 @@ nsresult nsIPresShell::ScrollContentIntoView(
}
// Flush layout and attempt to scroll in the process.
if (nsIPresShell* shell = composedDoc->GetShell()) {
shell->SetNeedLayoutFlush();
if (PresShell* presShell = composedDoc->GetPresShell()) {
presShell->SetNeedLayoutFlush();
}
composedDoc->FlushPendingNotifications(FlushType::InterruptibleLayout);
@ -4040,8 +4040,8 @@ void PresShell::DoFlushPendingNotifications(mozilla::ChangesToFlush aFlush) {
}
// Don't flush if the doc is already in the bfcache.
if (MOZ_UNLIKELY(mDocument->GetShell() != this)) {
MOZ_DIAGNOSTIC_ASSERT(!mDocument->GetShell(),
if (MOZ_UNLIKELY(mDocument->GetPresShell() != this)) {
MOZ_DIAGNOSTIC_ASSERT(!mDocument->GetPresShell(),
"Where did this shell come from?");
isSafeToFlush = false;
}
@ -5853,8 +5853,8 @@ void PresShell::EnsureFrameInApproximatelyVisibleList(nsIFrame* aFrame) {
// Make sure it's in this pres shell.
nsCOMPtr<nsIContent> content = aFrame->GetContent();
if (content) {
PresShell* shell = static_cast<PresShell*>(content->OwnerDoc()->GetShell());
MOZ_ASSERT(!shell || shell == this, "wrong shell");
PresShell* presShell = content->OwnerDoc()->GetPresShell();
MOZ_ASSERT(!presShell || presShell == this, "wrong shell");
}
#endif
@ -5869,8 +5869,8 @@ void PresShell::RemoveFrameFromApproximatelyVisibleList(nsIFrame* aFrame) {
// Make sure it's in this pres shell.
nsCOMPtr<nsIContent> content = aFrame->GetContent();
if (content) {
PresShell* shell = static_cast<PresShell*>(content->OwnerDoc()->GetShell());
MOZ_ASSERT(!shell || shell == this, "wrong shell");
PresShell* presShell = content->OwnerDoc()->GetPresShell();
MOZ_ASSERT(!presShell || presShell == this, "wrong shell");
}
#endif
@ -6376,9 +6376,9 @@ nsIFrame* PresShell::EventHandler::GetNearestFrameContainingPresShell(
}
static bool FlushThrottledStyles(Document* aDocument, void* aData) {
nsIPresShell* shell = aDocument->GetShell();
if (shell && shell->IsVisible()) {
nsPresContext* presContext = shell->GetPresContext();
PresShell* presShell = aDocument->GetPresShell();
if (presShell && presShell->IsVisible()) {
nsPresContext* presContext = presShell->GetPresContext();
if (presContext) {
presContext->RestyleManager()->UpdateOnlyAnimationStyles();
}
@ -6408,7 +6408,7 @@ PresShell* PresShell::GetShellForEventTarget(nsIFrame* aFrame,
if (!doc) {
return nullptr;
}
return static_cast<PresShell*>(doc->GetShell());
return doc->GetPresShell();
}
return nullptr;
}
@ -6947,7 +6947,7 @@ bool PresShell::EventHandler::MaybeHandleEventWithAccessibleCaret(
if (!retargetEventDoc) {
return false;
}
nsCOMPtr<nsIPresShell> presShell = retargetEventDoc->GetShell();
RefPtr<PresShell> presShell = retargetEventDoc->GetPresShell();
if (!presShell) {
return false;
}
@ -7074,7 +7074,7 @@ nsIFrame* PresShell::EventHandler::GetFrameForHandlingEventWith(
MOZ_ASSERT(aGUIEvent);
MOZ_ASSERT(aRetargetDocument);
nsCOMPtr<nsIPresShell> retargetPresShell = aRetargetDocument->GetShell();
RefPtr<PresShell> retargetPresShell = aRetargetDocument->GetPresShell();
// Even if the document doesn't have PresShell, i.e., it's invisible, we
// need to dispatch only KeyboardEvent in its nearest visible document
// because key focus shouldn't be caught by invisible document.
@ -7088,7 +7088,7 @@ nsIFrame* PresShell::EventHandler::GetFrameForHandlingEventWith(
if (!retargetEventDoc) {
return nullptr;
}
retargetPresShell = retargetEventDoc->GetShell();
retargetPresShell = retargetEventDoc->GetPresShell();
}
}
@ -7552,8 +7552,7 @@ bool PresShell::EventHandler::MaybeHandleEventWithAnotherPresShell(
return false;
}
RefPtr<PresShell> eventTargetPresShell =
static_cast<PresShell*>(eventTargetDocument->GetShell());
RefPtr<PresShell> eventTargetPresShell = eventTargetDocument->GetPresShell();
if (!eventTargetPresShell) {
*aRv = NS_OK;
return true; // No PresShell can handle the event.
@ -8257,7 +8256,7 @@ void PresShell::EventHandler::DispatchTouchEventToDOM(
RefPtr<PresShell> contentPresShell;
if (doc == GetDocument()) {
contentPresShell = static_cast<PresShell*>(doc->GetShell());
contentPresShell = doc->GetPresShell();
if (contentPresShell) {
// XXXsmaug huge hack. Pushing possibly capturing content,
// even though event target is something else.
@ -8834,9 +8833,10 @@ static void FreezeElement(nsISupports* aSupports, void* /* unused */) {
}
static bool FreezeSubDocument(Document* aDocument, void* aData) {
nsIPresShell* shell = aDocument->GetShell();
if (shell) shell->Freeze();
PresShell* presShell = aDocument->GetPresShell();
if (presShell) {
presShell->Freeze();
}
return true;
}
@ -8904,9 +8904,10 @@ static void ThawElement(nsISupports* aSupports, void* aShell) {
}
static bool ThawSubDocument(Document* aDocument, void* aData) {
nsIPresShell* shell = aDocument->GetShell();
if (shell) shell->Thaw();
PresShell* presShell = aDocument->GetPresShell();
if (presShell) {
presShell->Thaw();
}
return true;
}
@ -9920,23 +9921,26 @@ bool nsIPresShell::VerifyIncrementalReflow() {
// exact same style information that this document has.
UniquePtr<ServoStyleSet> newSet = CloneStyleSet(StyleSet());
nsCOMPtr<nsIPresShell> sh = mDocument->CreateShell(cx, vm, std::move(newSet));
NS_ENSURE_TRUE(sh, false);
RefPtr<PresShell> presShell =
mDocument->CreatePresShell(cx, vm, std::move(newSet));
NS_ENSURE_TRUE(presShell, false);
// Note that after we create the shell, we must make sure to destroy it
sh->SetVerifyReflowEnable(false); // turn off verify reflow while we're
// reflowing the test frame tree
vm->SetPresShell(sh);
presShell->SetVerifyReflowEnable(
false); // turn off verify reflow while we're
// reflowing the test frame tree
vm->SetPresShell(presShell);
{
nsAutoCauseReflowNotifier crNotifier(this);
sh->Initialize();
presShell->Initialize();
}
mDocument->BindingManager()->ProcessAttachedQueue();
sh->FlushPendingNotifications(FlushType::Layout);
sh->SetVerifyReflowEnable(true); // turn on verify reflow again now that
// we're done reflowing the test frame tree
presShell->FlushPendingNotifications(FlushType::Layout);
presShell->SetVerifyReflowEnable(
true); // turn on verify reflow again now that
// we're done reflowing the test frame tree
// Force the non-primary presshell to unsuppress; it doesn't want to normally
// because it thinks it's hidden
((PresShell*)sh.get())->mPaintingSuppressed = false;
presShell->mPaintingSuppressed = false;
if (VERIFY_REFLOW_NOISY & gVerifyReflowFlags) {
printf("Verification Tree built, comparing...\n");
}
@ -9944,7 +9948,7 @@ bool nsIPresShell::VerifyIncrementalReflow() {
// Now that the document has been reflowed, use its frame tree to
// compare against our frame tree.
nsIFrame* root1 = mFrameConstructor->GetRootFrame();
nsIFrame* root2 = sh->GetRootFrame();
nsIFrame* root2 = presShell->GetRootFrame();
bool ok = CompareTrees(mPresContext, root1, cx, root2);
if (!ok && (VERIFY_REFLOW_NOISY & gVerifyReflowFlags)) {
printf("Verify reflow failed, primary tree:\n");
@ -9962,18 +9966,18 @@ bool nsIPresShell::VerifyIncrementalReflow() {
stra.AppendLiteral("C:\\mozilla\\mozilla\\debug\\filea");
stra.AppendInt(num);
stra.AppendLiteral(".png");
gfxUtils::WriteAsPNG(sh, stra);
gfxUtils::WriteAsPNG(presShell, stra);
nsString strb;
strb.AppendLiteral("C:\\mozilla\\mozilla\\debug\\fileb");
strb.AppendInt(num);
strb.AppendLiteral(".png");
gfxUtils::WriteAsPNG(sh, strb);
gfxUtils::WriteAsPNG(presShell, strb);
++num;
}
# endif
sh->EndObservingDocument();
sh->Destroy();
presShell->EndObservingDocument();
presShell->Destroy();
if (VERIFY_REFLOW_NOISY & gVerifyReflowFlags) {
printf("Finished Verifying Reflow...\n");
}
@ -10477,9 +10481,9 @@ void PresShell::QueryIsActive() {
// Helper for propagating mIsActive changes to external resources
static bool SetExternalResourceIsActive(Document* aDocument, void* aClosure) {
nsIPresShell* shell = aDocument->GetShell();
if (shell) {
shell->SetIsActive(*static_cast<bool*>(aClosure));
PresShell* presShell = aDocument->GetPresShell();
if (presShell) {
presShell->SetIsActive(*static_cast<bool*>(aClosure));
}
return true;
}

View File

@ -171,6 +171,14 @@ class PresShell final : public nsIPresShell,
void SetRestoreResolution(float aResolution,
LayoutDeviceIntSize aDisplaySize) override;
// Widget notificiations
void WindowSizeMoveDone() override;
void SysColorChanged() override { mPresContext->SysColorChanged(); }
void ThemeChanged() override { mPresContext->ThemeChanged(); }
void BackingScaleFactorChanged() override {
mPresContext->UIResolutionChangedSync();
}
// nsIViewObserver interface
void Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
@ -1284,13 +1292,6 @@ class PresShell final : public nsIPresShell,
// The callback for the mPaintSuppressionTimer timer.
static void sPaintSuppressionCallback(nsITimer* aTimer, void* aPresShell);
// Widget notificiations
void WindowSizeMoveDone() override;
void SysColorChanged() override { mPresContext->SysColorChanged(); }
void ThemeChanged() override { mPresContext->ThemeChanged(); }
void BackingScaleFactorChanged() override {
mPresContext->UIResolutionChangedSync();
}
Document* GetPrimaryContentDocument() override;
void PausePainting() override;

View File

@ -61,7 +61,7 @@ void TouchManager::EvictTouchPoint(RefPtr<Touch>& aTouch,
if (node) {
Document* doc = node->GetComposedDoc();
if (doc && (!aLimitToDocument || aLimitToDocument == doc)) {
nsIPresShell* presShell = doc->GetShell();
PresShell* presShell = doc->GetPresShell();
if (presShell) {
nsIFrame* frame = presShell->GetRootFrame();
if (frame) {

View File

@ -7,6 +7,7 @@
/* container for a document and its presentation */
#include "gfxContext.h"
#include "mozilla/PresShell.h"
#include "mozilla/RestyleManager.h"
#include "mozilla/ServoStyleSet.h"
#include "nscore.h"
@ -21,7 +22,6 @@
#include "mozilla/dom/PopupBlocker.h"
#include "mozilla/dom/Document.h"
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "nsIFrame.h"
#include "nsIWritablePropertyBag2.h"
#include "nsSubDocumentFrame.h"
@ -402,7 +402,7 @@ class nsDocumentViewer final : public nsIContentViewer,
nsCOMPtr<nsIWidget> mWindow; // may be null
RefPtr<nsViewManager> mViewManager;
RefPtr<nsPresContext> mPresContext;
nsCOMPtr<nsIPresShell> mPresShell;
RefPtr<PresShell> mPresShell;
RefPtr<nsDocViewerSelectionListener> mSelectionListener;
RefPtr<nsDocViewerFocusListener> mFocusListener;
@ -730,8 +730,8 @@ nsresult nsDocumentViewer::InitPresentationStuff(bool aDoInitialReflow) {
UniquePtr<ServoStyleSet> styleSet = CreateStyleSet(mDocument);
// Now make the shell for the document
mPresShell =
mDocument->CreateShell(mPresContext, mViewManager, std::move(styleSet));
mPresShell = mDocument->CreatePresShell(mPresContext, mViewManager,
std::move(styleSet));
if (!mPresShell) {
return NS_ERROR_FAILURE;
}
@ -770,9 +770,9 @@ nsresult nsDocumentViewer::InitPresentationStuff(bool aDoInitialReflow) {
p2a = mPresContext->AppUnitsPerDevPixel(); // zoom may have changed it
if (aDoInitialReflow) {
nsCOMPtr<nsIPresShell> shell = mPresShell;
RefPtr<PresShell> presShell = mPresShell;
// Initial reflow
shell->Initialize();
presShell->Initialize();
}
// now register ourselves as a selection listener, so that we get
@ -880,7 +880,7 @@ nsresult nsDocumentViewer::InitInternal(nsIWidget* aParentWidget,
if (!mPresContext &&
(aParentWidget || containerView || mDocument->IsBeingUsedAsImage() ||
(mDocument->GetDisplayDocument() &&
mDocument->GetDisplayDocument()->GetShell()))) {
mDocument->GetDisplayDocument()->GetPresShell()))) {
// Create presentation context
if (mIsPageMode) {
// Presentation context already created in SetPageMode which is calling
@ -1009,8 +1009,8 @@ nsDocumentViewer::LoadComplete(nsresult aStatus) {
// checking for our mDocument and its window.
if (mPresShell && !mStopped) {
// Hold strong ref because this could conceivably run script
nsCOMPtr<nsIPresShell> shell = mPresShell;
shell->FlushPendingNotifications(FlushType::Layout);
RefPtr<PresShell> presShell = mPresShell;
presShell->FlushPendingNotifications(FlushType::Layout);
}
nsresult rv = NS_OK;
@ -1144,8 +1144,8 @@ nsDocumentViewer::LoadComplete(nsresult aStatus) {
// Now that the document has loaded, we can tell the presshell
// to unsuppress painting.
if (mPresShell) {
nsCOMPtr<nsIPresShell> shell(mPresShell);
shell->UnsuppressPainting();
RefPtr<PresShell> presShell = mPresShell;
presShell->UnsuppressPainting();
// mPresShell could have been removed now, see bug 378682/421432
if (mPresShell) {
mPresShell->LoadComplete();
@ -1867,8 +1867,8 @@ nsDocumentViewer::Stop(void) {
if (!mLoaded && mPresShell) {
// Well, we might as well paint what we have so far.
nsCOMPtr<nsIPresShell> shell(mPresShell); // bug 378682
shell->UnsuppressPainting();
RefPtr<PresShell> presShell = mPresShell; // bug 378682
presShell->UnsuppressPainting();
}
return NS_OK;
@ -2192,8 +2192,8 @@ nsDocumentViewer::Show(void) {
// shown...
if (mPresShell) {
nsCOMPtr<nsIPresShell> shell(mPresShell); // bug 378682
shell->UnsuppressPainting();
RefPtr<PresShell> presShell = mPresShell; // bug 378682
presShell->UnsuppressPainting();
}
}
@ -4270,7 +4270,7 @@ void nsDocumentViewer::SetPrintPreviewPresentation(nsViewManager* aViewManager,
mWindow = nullptr;
mViewManager = aViewManager;
mPresContext = aPresContext;
mPresShell = aPresShell;
mPresShell = static_cast<PresShell*>(aPresShell);
if (ShouldAttachToTopLevel()) {
DetachFromTopLevelWidget();

View File

@ -7,12 +7,13 @@
#ifndef nsIPresShellInlines_h
#define nsIPresShellInlines_h
#include "mozilla/PresShell.h"
#include "mozilla/dom/Document.h"
void nsIPresShell::SetNeedLayoutFlush() {
mNeedLayoutFlush = true;
if (mozilla::dom::Document* doc = mDocument->GetDisplayDocument()) {
if (nsIPresShell* shell = doc->GetShell()) {
if (mozilla::PresShell* shell = doc->GetPresShell()) {
shell->mNeedLayoutFlush = true;
}
}
@ -27,8 +28,8 @@ void nsIPresShell::SetNeedLayoutFlush() {
void nsIPresShell::SetNeedStyleFlush() {
mNeedStyleFlush = true;
if (mozilla::dom::Document* doc = mDocument->GetDisplayDocument()) {
if (nsIPresShell* shell = doc->GetShell()) {
shell->mNeedStyleFlush = true;
if (mozilla::PresShell* presShell = doc->GetPresShell()) {
presShell->mNeedStyleFlush = true;
}
}
@ -47,8 +48,8 @@ void nsIPresShell::EnsureStyleFlush() {
void nsIPresShell::SetNeedThrottledAnimationFlush() {
mNeedThrottledAnimationFlush = true;
if (mozilla::dom::Document* doc = mDocument->GetDisplayDocument()) {
if (nsIPresShell* shell = doc->GetShell()) {
shell->mNeedThrottledAnimationFlush = true;
if (mozilla::PresShell* presShell = doc->GetPresShell()) {
presShell->mNeedThrottledAnimationFlush = true;
}
}
}

View File

@ -20,6 +20,7 @@
#include "mozilla/Likely.h"
#include "mozilla/Maybe.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/PresShell.h"
#include "mozilla/ServoStyleSetInlines.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/Unused.h"
@ -597,7 +598,7 @@ static nsIFrame* GetScrollFrameFromContent(nsIContent* aContent) {
if (aContent->OwnerDoc()->GetRootElement() == aContent) {
nsIPresShell* presShell = frame ? frame->PresShell() : nullptr;
if (!presShell) {
presShell = aContent->OwnerDoc()->GetShell();
presShell = aContent->OwnerDoc()->GetPresShell();
}
// We want the scroll frame, the root scroll frame differs from all
// others in that the primary frame is not the scroll frame.
@ -9357,7 +9358,7 @@ CSSRect nsLayoutUtils::GetBoundingContentRect(
static already_AddRefed<nsIPresShell> GetPresShell(const nsIContent* aContent) {
nsCOMPtr<nsIPresShell> result;
if (Document* doc = aContent->GetComposedDoc()) {
result = doc->GetShell();
result = doc->GetPresShell();
}
return result.forget();
}

View File

@ -14,12 +14,12 @@
#include "mozilla/Encoding.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/PresShell.h"
#include "base/basictypes.h"
#include "nsCOMPtr.h"
#include "nsCSSFrameConstructor.h"
#include "nsIPresShell.h"
#include "nsIPresShellInlines.h"
#include "nsDocShell.h"
#include "nsIContentViewer.h"
@ -616,9 +616,10 @@ nsresult nsPresContext::Init(nsDeviceContext* aDeviceContext) {
// printing screws up things. Assert that in other cases it does,
// but whenever the shell is null just fall back on using our own
// refresh driver.
NS_ASSERTION(!parent || mDocument->IsStaticDocument() || parent->GetShell(),
"How did we end up with a presshell if our parent doesn't "
"have one?");
NS_ASSERTION(
!parent || mDocument->IsStaticDocument() || parent->GetPresShell(),
"How did we end up with a presshell if our parent doesn't "
"have one?");
if (parent && parent->GetPresContext()) {
nsCOMPtr<nsIDocShellTreeItem> ourItem = mDocument->GetDocShell();
if (ourItem) {

View File

@ -21,6 +21,7 @@
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/gfx/PathHelpers.h"
#include "mozilla/PresShell.h"
#include "mozilla/Sprintf.h"
#include "mozilla/StaticPrefs.h"
@ -47,7 +48,6 @@
#include "nsPresContext.h"
#include "nsPresContextInlines.h"
#include "nsStyleConsts.h"
#include "nsIPresShell.h"
#include "mozilla/Logging.h"
#include "nsLayoutUtils.h"
#include "LayoutLogging.h"
@ -4701,9 +4701,11 @@ NS_IMETHODIMP nsFrame::HandleRelease(nsPresContext* aPresContext,
if (!frameSelection && captureContent) {
Document* doc = captureContent->GetUncomposedDoc();
if (doc) {
nsIPresShell* capturingShell = doc->GetShell();
if (capturingShell && capturingShell != PresContext()->GetPresShell()) {
frameSelection = capturingShell->FrameSelection();
mozilla::PresShell* capturingPresShell = doc->GetPresShell();
if (capturingPresShell &&
capturingPresShell !=
static_cast<mozilla::PresShell*>(PresContext()->GetPresShell())) {
frameSelection = capturingPresShell->FrameSelection();
}
}
}

View File

@ -13,6 +13,10 @@
#include "gfxPrefs.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/HTMLFrameElement.h"
#include "mozilla/layout/RenderFrame.h"
#include "nsCOMPtr.h"
@ -23,8 +27,6 @@
#include "nsIContentViewer.h"
#include "nsIContentInlines.h"
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "mozilla/dom/Document.h"
#include "nsView.h"
#include "nsViewManager.h"
#include "nsGkAtoms.h"
@ -42,8 +44,6 @@
#include "nsIPermissionManager.h"
#include "nsServiceManagerUtils.h"
#include "nsQueryObject.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/HTMLFrameElement.h"
#include "RetainedDisplayListBuilder.h"
using namespace mozilla;
@ -1024,12 +1024,12 @@ static void DestroyDisplayItemDataForFrames(nsIFrame* aFrame) {
static bool BeginSwapDocShellsForDocument(Document* aDocument, void*) {
MOZ_ASSERT(aDocument, "null document");
nsIPresShell* shell = aDocument->GetShell();
if (shell) {
PresShell* presShell = aDocument->GetPresShell();
if (presShell) {
// Disable painting while the views are detached, see bug 946929.
shell->SetNeverPainting(true);
presShell->SetNeverPainting(true);
nsIFrame* rootFrame = shell->GetRootFrame();
nsIFrame* rootFrame = presShell->GetRootFrame();
if (rootFrame) {
::DestroyDisplayItemDataForFrames(rootFrame);
}

View File

@ -17,7 +17,6 @@
#include "nsIStyleSheetLinkingElement.h"
#include "nsIContentInlines.h"
#include "mozilla/dom/Document.h"
#include "nsIPresShell.h"
#include "nsIDOMWindow.h"
#include "nsXBLBinding.h"
#include "nsXBLPrototypeBinding.h"
@ -28,6 +27,7 @@
#include "mozilla/EventStateManager.h"
#include "nsAtom.h"
#include "nsRange.h"
#include "mozilla/PresShell.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/dom/CharacterData.h"
#include "mozilla/dom/Element.h"
@ -58,7 +58,7 @@ void InspectorUtils::GetAllStyleSheets(GlobalObject& aGlobalObject,
Document& aDocument, bool aDocumentOnly,
nsTArray<RefPtr<StyleSheet>>& aResult) {
// Get the agent, then user and finally xbl sheets in the style set.
nsIPresShell* presShell = aDocument.GetShell();
PresShell* presShell = aDocument.GetPresShell();
if (presShell) {
ServoStyleSet* styleSet = presShell->StyleSet();
@ -168,8 +168,8 @@ void InspectorUtils::GetCSSStyleRules(
}
Document* doc = aElement.OwnerDoc();
nsIPresShell* shell = doc->GetShell();
if (!shell) {
PresShell* presShell = doc->GetPresShell();
if (!presShell) {
return;
}
@ -178,7 +178,7 @@ void InspectorUtils::GetCSSStyleRules(
AutoTArray<ServoStyleRuleMap*, 1> maps;
{
ServoStyleSet* styleSet = shell->StyleSet();
ServoStyleSet* styleSet = presShell->StyleSet();
ServoStyleRuleMap* map = styleSet->StyleRuleMap();
maps.AppendElement(map);
}
@ -598,7 +598,7 @@ already_AddRefed<ComputedStyle> InspectorUtils::GetCleanComputedStyleForElement(
return nullptr;
}
nsIPresShell* presShell = doc->GetShell();
PresShell* presShell = doc->GetPresShell();
if (!presShell) {
return nullptr;
}

View File

@ -14,6 +14,7 @@
#include "nsViewManager.h"
#include "nsCanvasFrame.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/PresShell.h"
/**
* Code for doing display list building for a modified subset of the window,
@ -724,7 +725,7 @@ static nsIFrame* GetRootFrameForPainting(nsDisplayListBuilder* aBuilder,
// what painting uses. Walk up to the nsSubDocumentFrame owning
// us, and then ask that which subdoc it's going to paint.
nsIPresShell* presShell = aDocument->GetShell();
PresShell* presShell = aDocument->GetPresShell();
if (!presShell) {
return nullptr;
}
@ -752,10 +753,11 @@ static nsIFrame* GetRootFrameForPainting(nsDisplayListBuilder* aBuilder,
nsSubDocumentFrame* subdocumentFrame = do_QueryFrame(subDocFrame);
MOZ_ASSERT(subdocumentFrame);
presShell = subdocumentFrame->GetSubdocumentPresShellForPainting(
aBuilder->IsIgnoringPaintSuppression()
? nsSubDocumentFrame::IGNORE_PAINT_SUPPRESSION
: 0);
presShell = static_cast<PresShell*>(
subdocumentFrame->GetSubdocumentPresShellForPainting(
aBuilder->IsIgnoringPaintSuppression()
? nsSubDocumentFrame::IGNORE_PAINT_SUPPRESSION
: 0));
return presShell ? presShell->GetRootFrame() : nullptr;
}

View File

@ -28,11 +28,11 @@
#include "mozilla/dom/TouchEvent.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/layers/PLayerTransaction.h"
#include "mozilla/PresShell.h"
#include "mozilla/ShapeUtils.h"
#include "nsCSSRendering.h"
#include "nsCSSRenderingGradients.h"
#include "nsISelectionController.h"
#include "nsIPresShell.h"
#include "nsRegion.h"
#include "nsStyleStructInlines.h"
#include "nsStyleTransformMatrix.h"
@ -2541,10 +2541,10 @@ static bool TriggerPendingAnimationsOnSubDocuments(Document* aDocument,
void* aReadyTime) {
PendingAnimationTracker* tracker = aDocument->GetPendingAnimationTracker();
if (tracker) {
nsIPresShell* shell = aDocument->GetShell();
PresShell* presShell = aDocument->GetPresShell();
// If paint-suppression is in effect then we haven't finished painting
// this document yet so we shouldn't start animations
if (!shell || !shell->IsPaintingSuppressed()) {
if (!presShell || !presShell->IsPaintingSuppressed()) {
const TimeStamp& readyTime = *static_cast<TimeStamp*>(aReadyTime);
tracker->TriggerPendingAnimationsOnNextTick(readyTime);
}

View File

@ -83,10 +83,10 @@ static const char kPrintingPromptService[] =
#include "nsContentCID.h"
#include "nsLayoutCID.h"
#include "nsContentUtils.h"
#include "nsIPresShell.h"
#include "nsLayoutStylesheetCache.h"
#include "nsLayoutUtils.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "Text.h"
#include "nsWidgetsCID.h"
@ -2238,7 +2238,7 @@ nsresult nsPrintJob::ReflowPrintObject(const UniquePtr<nsPrintObject>& aPO) {
UniquePtr<ServoStyleSet> styleSet =
mDocViewerPrint->CreateStyleSet(aPO->mDocument);
aPO->mPresShell = aPO->mDocument->CreateShell(
aPO->mPresShell = aPO->mDocument->CreatePresShell(
aPO->mPresContext, aPO->mViewManager, std::move(styleSet));
if (!aPO->mPresShell) {
return NS_ERROR_FAILURE;
@ -2426,14 +2426,14 @@ static nsINode* GetCorrespondingNodeInDocument(const nsINode* aNode,
static NS_NAMED_LITERAL_STRING(kEllipsis, u"\x2026");
static nsresult DeleteUnselectedNodes(Document* aOrigDoc, Document* aDoc) {
nsIPresShell* origShell = aOrigDoc->GetShell();
nsIPresShell* shell = aDoc->GetShell();
NS_ENSURE_STATE(origShell && shell);
PresShell* origPresShell = aOrigDoc->GetPresShell();
PresShell* presShell = aDoc->GetPresShell();
NS_ENSURE_STATE(origPresShell && presShell);
RefPtr<Selection> origSelection =
origShell->GetCurrentSelection(SelectionType::eNormal);
origPresShell->GetCurrentSelection(SelectionType::eNormal);
RefPtr<Selection> selection =
shell->GetCurrentSelection(SelectionType::eNormal);
presShell->GetCurrentSelection(SelectionType::eNormal);
NS_ENSURE_STATE(origSelection && selection);
nsINode* bodyNode = aDoc->GetBodyElement();

View File

@ -22,6 +22,7 @@
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/Logging.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/ServoCSSParser.h"
#include "mozilla/ServoStyleSet.h"
@ -42,7 +43,6 @@
#include "mozilla/dom/Document.h"
#include "nsILoadContext.h"
#include "nsINetworkPredictor.h"
#include "nsIPresShell.h"
#include "nsIPresShellInlines.h"
#include "nsIPrincipal.h"
#include "nsISupportsPriority.h"
@ -1709,8 +1709,8 @@ void FontFaceSet::MarkUserFontSetDirty() {
// Ensure we trigger at least a style flush, that will eventually flush the
// user font set. Otherwise the font loads that that flush may cause could
// never be triggered.
if (nsIPresShell* shell = mDocument->GetShell()) {
shell->EnsureStyleFlush();
if (PresShell* presShell = mDocument->GetPresShell()) {
presShell->EnsureStyleFlush();
}
mDocument->MarkUserFontSetDirty();
}

View File

@ -13,6 +13,7 @@
#include "mozilla/EffectCompositor.h"
#include "mozilla/IntegerRange.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/PresShell.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/RestyleManager.h"
#include "mozilla/ServoStyleRuleMap.h"
@ -1346,8 +1347,8 @@ bool ServoStyleSet::MayTraverseFrom(const Element* aElement) {
}
bool ServoStyleSet::ShouldTraverseInParallel() const {
MOZ_ASSERT(mDocument->GetShell(), "Styling a document without a shell?");
if (!mDocument->GetShell()->IsActive()) {
MOZ_ASSERT(mDocument->GetPresShell(), "Styling a document without a shell?");
if (!mDocument->GetPresShell()->IsActive()) {
return false;
}
#ifdef MOZ_GECKO_PROFILER

View File

@ -10,6 +10,7 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/PresShell.h"
#include "mozilla/ServoStyleSet.h"
#include "mozilla/Tuple.h"
#include "mozilla/UniquePtr.h"
@ -316,8 +317,8 @@ AnimationValue AnimationValue::FromString(nsCSSPropertyID aProperty,
return result;
}
nsCOMPtr<nsIPresShell> shell = doc->GetShell();
if (!shell) {
RefPtr<PresShell> presShell = doc->GetPresShell();
if (!presShell) {
return result;
}
@ -334,7 +335,7 @@ AnimationValue AnimationValue::FromString(nsCSSPropertyID aProperty,
return result;
}
result.mServo = shell->StyleSet()->ComputeAnimationValue(
result.mServo = presShell->StyleSet()->ComputeAnimationValue(
aElement, declarations, computedStyle);
return result;
}

View File

@ -12,6 +12,7 @@
#include "mozilla/FloatingPoint.h"
#include "mozilla/FontPropertyTypes.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/StaticPtr.h"
#include "nsError.h"
@ -99,17 +100,17 @@ already_AddRefed<CSSValue> GetBackgroundList(
// Whether aDocument needs to restyle for aElement
static bool DocumentNeedsRestyle(const Document* aDocument, Element* aElement,
nsAtom* aPseudo) {
nsIPresShell* shell = aDocument->GetShell();
if (!shell) {
PresShell* presShell = aDocument->GetPresShell();
if (!presShell) {
return true;
}
nsPresContext* presContext = shell->GetPresContext();
nsPresContext* presContext = presShell->GetPresContext();
MOZ_ASSERT(presContext);
// Unfortunately we don't know if the sheet change affects mElement or not, so
// just assume it will and that we need to flush normally.
ServoStyleSet* styleSet = shell->StyleSet();
ServoStyleSet* styleSet = presShell->StyleSet();
if (styleSet->StyleSheetsHaveChanged()) {
return true;
}
@ -570,8 +571,9 @@ nsComputedDOMStyle::GetUnanimatedComputedStyleNoFlush(Element* aElement,
}
PseudoStyleType pseudoType = GetPseudoType(aPseudo);
nsIPresShell* shell = aElement->OwnerDoc()->GetShell();
MOZ_ASSERT(shell, "How in the world did we get a style a few lines above?");
PresShell* presShell = aElement->OwnerDoc()->GetPresShell();
MOZ_ASSERT(presShell,
"How in the world did we get a style a few lines above?");
Element* elementOrPseudoElement =
EffectCompositor::GetElementToRestyle(aElement, pseudoType);
@ -579,8 +581,8 @@ nsComputedDOMStyle::GetUnanimatedComputedStyleNoFlush(Element* aElement,
return nullptr;
}
return shell->StyleSet()->GetBaseContextForElement(elementOrPseudoElement,
style);
return presShell->StyleSet()->GetBaseContextForElement(elementOrPseudoElement,
style);
}
nsMargin nsComputedDOMStyle::GetAdjustedValuesForBoxSizing() {
@ -827,7 +829,7 @@ void nsComputedDOMStyle::UpdateCurrentStyleSources(bool aNeedsLayoutFlush) {
}
}
mPresShell = document->GetShell();
mPresShell = document->GetPresShell();
if (!mPresShell || !mPresShell->GetPresContext()) {
ClearComputedStyle();
return;

View File

@ -14,9 +14,9 @@
#include "nsGkAtoms.h"
#include "nsPresContext.h"
#include "mozilla/EventStates.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/DocumentInlines.h"
#include "nsIPresShell.h"
#include "nsStyleConsts.h"
#include "nsError.h"
#include "mozilla/MemoryReporting.h"
@ -91,7 +91,7 @@ void nsHTMLStyleSheet::Reset() {
nsresult nsHTMLStyleSheet::ImplLinkColorSetter(
RefPtr<RawServoDeclarationBlock> &aDecl, nscolor aColor) {
if (!mDocument || !mDocument->GetShell()) {
if (!mDocument || !mDocument->GetPresShell()) {
return NS_OK;
}

View File

@ -6,8 +6,8 @@
#include "mozilla/dom/BoxObject.h"
#include "nsCOMPtr.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/Document.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsIContent.h"
#include "nsContainerFrame.h"
@ -116,7 +116,7 @@ nsIPresShell* BoxObject::GetPresShell(bool aFlushLayout) {
doc->FlushPendingNotifications(FlushType::Layout);
}
return doc->GetShell();
return doc->GetPresShell();
}
nsresult BoxObject::GetOffsetRect(nsIntRect& aRect) {

View File

@ -43,6 +43,7 @@
#include "mozilla/EventStateManager.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/PresShell.h"
#include "mozilla/Services.h"
#include "mozilla/widget/nsAutoRollup.h"
@ -538,8 +539,10 @@ nsMenuPopupFrame* nsXULPopupManager::GetPopupFrameForContent(
if (aShouldFlush) {
Document* document = aContent->GetUncomposedDoc();
if (document) {
nsCOMPtr<nsIPresShell> presShell = document->GetShell();
if (presShell) presShell->FlushPendingNotifications(FlushType::Layout);
RefPtr<PresShell> presShell = document->GetPresShell();
if (presShell) {
presShell->FlushPendingNotifications(FlushType::Layout);
}
}
}
@ -594,7 +597,7 @@ void nsXULPopupManager::InitTriggerEvent(Event* aEvent, nsIContent* aPopup,
}
Document* doc = aPopup->GetUncomposedDoc();
if (doc) {
nsIPresShell* presShell = doc->GetShell();
PresShell* presShell = doc->GetPresShell();
nsPresContext* presContext;
if (presShell && (presContext = presShell->GetPresContext())) {
nsPresContext* rootDocPresContext = presContext->GetRootPresContext();
@ -784,8 +787,10 @@ static void CheckCaretDrawingState() {
nsCOMPtr<Document> focusedDoc = piWindow->GetDoc();
if (!focusedDoc) return;
nsIPresShell* presShell = focusedDoc->GetShell();
if (!presShell) return;
PresShell* presShell = focusedDoc->GetPresShell();
if (!presShell) {
return;
}
RefPtr<nsCaret> caret = presShell->GetCaret();
if (!caret) return;

View File

@ -25,8 +25,9 @@
#include "nsTreeColumns.h"
#include "nsContentUtils.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/Preferences.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Event.h" // for Event
#include "mozilla/dom/MouseEvent.h"
@ -524,7 +525,7 @@ nsresult nsXULTooltipListener::FindTooltip(nsIContent* aTarget,
// non-XUL elements should just use the default tooltip
if (!aTarget->IsXULElement()) {
nsIPopupContainer* popupContainer =
nsIPopupContainer::GetPopupContainer(document->GetShell());
nsIPopupContainer::GetPopupContainer(document->GetPresShell());
NS_ENSURE_STATE(popupContainer);
if (RefPtr<Element> tooltip = popupContainer->GetDefaultTooltip()) {
tooltip.forget(aTooltip);
@ -541,7 +542,7 @@ nsresult nsXULTooltipListener::FindTooltip(nsIContent* aTarget,
if (!tooltipText.IsEmpty()) {
// specifying tooltiptext means we will always use the default tooltip
nsIPopupContainer* popupContainer =
nsIPopupContainer::GetPopupContainer(document->GetShell());
nsIPopupContainer::GetPopupContainer(document->GetPresShell());
NS_ENSURE_STATE(popupContainer);
if (RefPtr<Element> tooltip = popupContainer->GetDefaultTooltip()) {
tooltip->SetAttr(kNameSpaceID_None, nsGkAtoms::label, tooltipText, true);
@ -584,7 +585,7 @@ nsresult nsXULTooltipListener::FindTooltip(nsIContent* aTarget,
// titletips should just use the default tooltip
if (mIsSourceTree && mNeedTitletip) {
nsIPopupContainer* popupContainer =
nsIPopupContainer::GetPopupContainer(document->GetShell());
nsIPopupContainer::GetPopupContainer(document->GetPresShell());
NS_ENSURE_STATE(popupContainer);
NS_IF_ADDREF(*aTooltip = popupContainer->GetDefaultTooltip());
}

View File

@ -169,6 +169,7 @@ impl Device {
self.document()
.mPresShell
.as_ref()?
._base
.mPresContext
.mRawPtr
.as_ref()

View File

@ -17,7 +17,6 @@
#include "nsPIDOMWindow.h"
#include "nsIURI.h"
#include "nsIDocShell.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "mozilla/dom/Document.h"
#include "nsISelectionController.h"
@ -33,6 +32,7 @@
#include "nsError.h"
#include "nsFocusManager.h"
#include "nsRange.h"
#include "mozilla/PresShell.h"
#include "mozilla/Services.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Selection.h"
@ -324,7 +324,7 @@ void nsWebBrowserFind::SetSelectionAndScroll(nsPIDOMWindowOuter* aWindow,
return;
}
nsIPresShell* presShell = doc->GetShell();
PresShell* presShell = doc->GetPresShell();
if (!presShell) {
return;
}
@ -707,7 +707,7 @@ already_AddRefed<Selection> nsWebBrowserFind::GetFrameSelection(
return nullptr;
}
nsIPresShell* presShell = doc->GetShell();
PresShell* presShell = doc->GetPresShell();
if (!presShell) {
return nullptr;
}
@ -734,8 +734,7 @@ already_AddRefed<Selection> nsWebBrowserFind::GetFrameSelection(
}
}
selCon = do_QueryInterface(presShell);
sel = selCon->GetSelection(nsISelectionController::SELECTION_NORMAL);
sel = presShell->GetSelection(nsISelectionController::SELECTION_NORMAL);
return sel.forget();
}

View File

@ -262,7 +262,7 @@ void SessionStoreUtils::RestoreDocShellCapabilities(
static void CollectCurrentScrollPosition(JSContext* aCx, Document& aDocument,
Nullable<CollectedData>& aRetVal) {
nsIPresShell* presShell = aDocument.GetShell();
PresShell* presShell = aDocument.GetPresShell();
if (!presShell) {
return;
}

View File

@ -8,6 +8,7 @@
#include "nsIServiceManager.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/ModuleUtils.h"
#include "mozilla/PresShell.h"
#include "mozilla/Services.h"
#include "nsIWebBrowserChrome.h"
#include "nsCURILoader.h"
@ -1132,7 +1133,7 @@ nsTypeAheadFind::IsRangeVisible(nsRange* aRange, bool aMustBeInViewPort,
nsCOMPtr<nsINode> node = aRange->GetStartContainer();
Document* doc = node->OwnerDoc();
nsCOMPtr<nsIPresShell> presShell = doc->GetShell();
RefPtr<PresShell> presShell = doc->GetPresShell();
if (!presShell) {
return NS_ERROR_UNEXPECTED;
}
@ -1318,7 +1319,7 @@ NS_IMETHODIMP
nsTypeAheadFind::IsRangeRendered(nsRange* aRange, bool* aResult) {
nsINode* node = aRange->GetStartContainer();
nsCOMPtr<nsIPresShell> presShell = node->OwnerDoc()->GetShell();
RefPtr<PresShell> presShell = node->OwnerDoc()->GetPresShell();
if (!presShell) {
return NS_ERROR_UNEXPECTED;
}

View File

@ -759,12 +759,12 @@ void nsDocLoader::DocLoaderIsEmpty(bool aFlushLayout) {
// Now unsuppress painting on the presshell, if we
// haven't done that yet.
nsCOMPtr<nsIPresShell> shell = doc->GetShell();
if (shell && !shell->IsDestroying()) {
shell->UnsuppressPainting();
RefPtr<PresShell> presShell = doc->GetPresShell();
if (presShell && !presShell->IsDestroying()) {
presShell->UnsuppressPainting();
if (!shell->IsDestroying()) {
shell->LoadComplete();
if (!presShell->IsDestroying()) {
presShell->LoadComplete();
}
}
}

View File

@ -7,11 +7,11 @@
#define GeckoSystemStateListener_h
#include "GeneratedJNINatives.h"
#include "mozilla/Assertions.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/Document.h"
#include "nsIPresShell.h"
#include "nsIWindowMediator.h"
#include "nsPIDOMWindow.h"
#include "mozilla/Assertions.h"
namespace mozilla {
@ -44,7 +44,7 @@ class GeckoSystemStateListener final
continue;
}
if (dom::Document* doc = window->GetExtantDoc()) {
if (nsIPresShell* presShell = doc->GetShell()) {
if (PresShell* presShell = doc->GetPresShell()) {
presShell->ThemeChanged();
}
}

View File

@ -23,6 +23,7 @@
#include "nsRect.h"
#include "nsPoint.h"
#include "nsIIOService.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/Document.h"
#include "nsIContent.h"
#include "nsView.h"
@ -603,11 +604,7 @@ void nsDragService::DragMovedWithView(NSDraggingSession* aSession, NSPoint aPoin
nsPresContext* pc = nullptr;
nsCOMPtr<nsIContent> content = do_QueryInterface(mImage);
if (content) {
RefPtr<dom::Document> document = content->OwnerDoc();
if (document) {
nsIPresShell* shell = document->GetShell();
pc = shell ? shell->GetPresContext() : nullptr;
}
pc = content->OwnerDoc()->GetPresContext();
}
if (pc) {

View File

@ -28,6 +28,7 @@
#include "mozilla/BasicEvents.h"
#include "mozilla/Services.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/PresShell.h"
#include "gfxXlibSurface.h"
#include "gfxContext.h"
@ -261,8 +262,10 @@ static void OnSourceGrabEventAfter(GtkWidget *widget, GdkEvent *event,
static GtkWindow *GetGtkWindow(dom::Document *aDocument) {
if (!aDocument) return nullptr;
nsCOMPtr<nsIPresShell> presShell = aDocument->GetShell();
if (!presShell) return nullptr;
PresShell *presShell = aDocument->GetPresShell();
if (!presShell) {
return nullptr;
}
RefPtr<nsViewManager> vm = presShell->GetViewManager();
if (!vm) return nullptr;

View File

@ -18,7 +18,6 @@
#include "nsFrameLoaderOwner.h"
#include "mozilla/dom/Document.h"
#include "nsIContent.h"
#include "nsIPresShell.h"
#include "nsViewManager.h"
#include "nsINode.h"
#include "nsPresContext.h"
@ -36,6 +35,7 @@
#endif
#include "mozilla/MouseEvents.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/DataTransferItemList.h"
#include "mozilla/dom/DataTransfer.h"
@ -458,7 +458,7 @@ NS_IMETHODIMP
nsBaseDragService::FireDragEventAtSource(EventMessage aEventMessage,
uint32_t aKeyModifiers) {
if (mSourceNode && mSourceDocument && !mSuppressLevel) {
nsCOMPtr<nsIPresShell> presShell = mSourceDocument->GetShell();
RefPtr<PresShell> presShell = mSourceDocument->GetPresShell();
if (presShell) {
nsEventStatus status = nsEventStatus_eIgnore;
WidgetDragEvent event(true, aEventMessage, nullptr);
@ -511,7 +511,7 @@ static nsIPresShell* GetPresShellForContent(nsINode* aDOMNode) {
RefPtr<Document> document = content->GetComposedDoc();
if (document) {
document->FlushPendingNotifications(FlushType::Display);
return document->GetShell();
return document->GetPresShell();
}
return nullptr;