зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1417354 - Introduce nsIDocument::GetPresContext(). r=smaug
It would be convenient to get nsPresContext from nsIDocument. MozReview-Commit-ID: Ei6V3UE8XGr --HG-- extra : rebase_source : 8d2a917eb62cf341e4e1810451fd01c01dbc3bad
This commit is contained in:
Родитель
2ae05eae09
Коммит
1b0cba9367
|
@ -185,11 +185,7 @@ nsCoreUtils::GetAccessKeyFor(nsIContent* aContent)
|
|||
!aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::accesskey))
|
||||
return 0;
|
||||
|
||||
nsIPresShell* presShell = aContent->OwnerDoc()->GetShell();
|
||||
if (!presShell)
|
||||
return 0;
|
||||
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
nsPresContext* presContext = aContent->OwnerDoc()->GetPresContext();
|
||||
if (!presContext)
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -262,12 +262,7 @@ DocumentTimeline::ToTimeStamp(const TimeDuration& aTimeDuration) const
|
|||
nsRefreshDriver*
|
||||
DocumentTimeline::GetRefreshDriver() const
|
||||
{
|
||||
nsIPresShell* presShell = mDocument->GetShell();
|
||||
if (MOZ_UNLIKELY(!presShell)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsPresContext* presContext = presShell->GetPresContext();
|
||||
nsPresContext* presContext = mDocument->GetPresContext();
|
||||
if (MOZ_UNLIKELY(!presContext)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -1951,15 +1951,12 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
|
|||
// we're not leaving behind a pointer to ourselves as the PresContext's
|
||||
// cached provider of the viewport's scrollbar styles.
|
||||
if (document) {
|
||||
nsIPresShell* presShell = document->GetShell();
|
||||
if (presShell) {
|
||||
nsPresContext* presContext = presShell->GetPresContext();
|
||||
if (presContext) {
|
||||
MOZ_ASSERT(this !=
|
||||
presContext->GetViewportScrollbarStylesOverrideElement(),
|
||||
"Leaving behind a raw pointer to this element (as having "
|
||||
"propagated scrollbar styles) - that's dangerous...");
|
||||
}
|
||||
nsPresContext* presContext = document->GetPresContext();
|
||||
if (presContext) {
|
||||
MOZ_ASSERT(this !=
|
||||
presContext->GetViewportScrollbarStylesOverrideElement(),
|
||||
"Leaving behind a raw pointer to this element (as having "
|
||||
"propagated scrollbar styles) - that's dangerous...");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -236,11 +236,7 @@ nsIContent::GetDesiredIMEState()
|
|||
if (!doc) {
|
||||
return IMEState(IMEState::DISABLED);
|
||||
}
|
||||
nsIPresShell* ps = doc->GetShell();
|
||||
if (!ps) {
|
||||
return IMEState(IMEState::DISABLED);
|
||||
}
|
||||
nsPresContext* pc = ps->GetPresContext();
|
||||
nsPresContext* pc = doc->GetPresContext();
|
||||
if (!pc) {
|
||||
return IMEState(IMEState::DISABLED);
|
||||
}
|
||||
|
|
|
@ -848,9 +848,8 @@ Location::Reload(bool aForceget)
|
|||
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
|
||||
nsIPresShell *shell;
|
||||
nsPresContext *pcx;
|
||||
if (doc && (shell = doc->GetShell()) && (pcx = shell->GetPresContext())) {
|
||||
nsPresContext* pcx;
|
||||
if (doc && (pcx = doc->GetPresContext())) {
|
||||
pcx->RebuildAllStyleData(NS_STYLE_HINT_REFLOW, eRestyle_Subtree);
|
||||
}
|
||||
|
||||
|
|
|
@ -195,11 +195,8 @@ PostMessageEvent::Dispatch(nsGlobalWindowInner* aTargetWindow, Event* aEvent)
|
|||
// happen because then untrusted content can call postMessage on a chrome
|
||||
// window if it can get a reference to it.
|
||||
|
||||
nsIPresShell *shell = aTargetWindow->GetExtantDoc()->GetShell();
|
||||
RefPtr<nsPresContext> presContext;
|
||||
if (shell) {
|
||||
presContext = shell->GetPresContext();
|
||||
}
|
||||
RefPtr<nsPresContext> presContext =
|
||||
aTargetWindow->GetExtantDoc()->GetPresContext();
|
||||
|
||||
aEvent->SetTrusted(mTrustedCaller);
|
||||
WidgetEvent* internalEvent = aEvent->WidgetEventPtr();
|
||||
|
|
|
@ -378,8 +378,7 @@ ResponsiveImageSelector::SelectImage(bool aReselect)
|
|||
}
|
||||
|
||||
nsIDocument* doc = Document();
|
||||
nsIPresShell* shell = doc->GetShell();
|
||||
nsPresContext* pctx = shell ? shell->GetPresContext() : nullptr;
|
||||
nsPresContext* pctx = doc->GetPresContext();
|
||||
nsCOMPtr<nsIURI> baseURI = mOwnerNode->GetBaseURI();
|
||||
|
||||
if (!pctx || !baseURI) {
|
||||
|
|
|
@ -6722,11 +6722,8 @@ nsContentUtils::DispatchXULCommand(nsIContent* aTarget,
|
|||
{
|
||||
NS_ENSURE_STATE(aTarget);
|
||||
nsIDocument* doc = aTarget->OwnerDoc();
|
||||
nsIPresShell* shell = doc->GetShell();
|
||||
nsPresContext* presContext = nullptr;
|
||||
if (shell) {
|
||||
presContext = shell->GetPresContext();
|
||||
}
|
||||
nsPresContext* presContext = doc->GetPresContext();
|
||||
|
||||
RefPtr<XULCommandEvent> xulCommand = new XULCommandEvent(doc, presContext,
|
||||
nullptr);
|
||||
xulCommand->InitCommandEvent(NS_LITERAL_STRING("command"), true, true,
|
||||
|
|
|
@ -932,19 +932,11 @@ TransferZoomLevels(nsIDocument* aFromDoc,
|
|||
MOZ_ASSERT(aFromDoc && aToDoc,
|
||||
"transferring zoom levels from/to null doc");
|
||||
|
||||
nsIPresShell* fromShell = aFromDoc->GetShell();
|
||||
if (!fromShell)
|
||||
return;
|
||||
|
||||
nsPresContext* fromCtxt = fromShell->GetPresContext();
|
||||
nsPresContext* fromCtxt = aFromDoc->GetPresContext();
|
||||
if (!fromCtxt)
|
||||
return;
|
||||
|
||||
nsIPresShell* toShell = aToDoc->GetShell();
|
||||
if (!toShell)
|
||||
return;
|
||||
|
||||
nsPresContext* toCtxt = toShell->GetPresContext();
|
||||
nsPresContext* toCtxt = aToDoc->GetPresContext();
|
||||
if (!toCtxt)
|
||||
return;
|
||||
|
||||
|
@ -3697,10 +3689,8 @@ nsDocument::SetDocumentCharacterSet(NotNull<const Encoding*> aEncoding)
|
|||
if (mCharacterSet != aEncoding) {
|
||||
mCharacterSet = aEncoding;
|
||||
|
||||
if (nsIPresShell* shell = GetShell()) {
|
||||
if (nsPresContext* context = shell->GetPresContext()) {
|
||||
context->DispatchCharSetChange(aEncoding);
|
||||
}
|
||||
if (nsPresContext* context = GetPresContext()) {
|
||||
context->DispatchCharSetChange(aEncoding);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5331,14 +5321,11 @@ nsDocument::DispatchContentLoadedEvents()
|
|||
if (innerEvent) {
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
|
||||
nsIPresShell *shell = parent->GetShell();
|
||||
if (shell) {
|
||||
RefPtr<nsPresContext> context = shell->GetPresContext();
|
||||
RefPtr<nsPresContext> context = parent->GetPresContext();
|
||||
|
||||
if (context) {
|
||||
EventDispatcher::Dispatch(parent, context, innerEvent, event,
|
||||
&status);
|
||||
}
|
||||
if (context) {
|
||||
EventDispatcher::Dispatch(parent, context, innerEvent, event,
|
||||
&status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6745,13 +6732,10 @@ nsDocument::GetAnimationController()
|
|||
|
||||
// If there's a presContext then check the animation mode and pause if
|
||||
// necessary.
|
||||
nsIPresShell *shell = GetShell();
|
||||
if (mAnimationController && shell) {
|
||||
nsPresContext *context = shell->GetPresContext();
|
||||
if (context &&
|
||||
context->ImageAnimationMode() == imgIContainer::kDontAnimMode) {
|
||||
mAnimationController->Pause(nsSMILTimeContainer::PAUSE_USERPREF);
|
||||
}
|
||||
nsPresContext* context = GetPresContext();
|
||||
if (mAnimationController && context &&
|
||||
context->ImageAnimationMode() == imgIContainer::kDontAnimMode) {
|
||||
mAnimationController->Pause(nsSMILTimeContainer::PAUSE_USERPREF);
|
||||
}
|
||||
|
||||
// If we're hidden (or being hidden), notify the newly-created animation
|
||||
|
@ -7519,14 +7503,7 @@ already_AddRefed<Event>
|
|||
nsIDocument::CreateEvent(const nsAString& aEventType, CallerType aCallerType,
|
||||
ErrorResult& rv) const
|
||||
{
|
||||
nsIPresShell *shell = GetShell();
|
||||
|
||||
nsPresContext *presContext = nullptr;
|
||||
|
||||
if (shell) {
|
||||
// Retrieve the context
|
||||
presContext = shell->GetPresContext();
|
||||
}
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
|
||||
// Create event even without presContext.
|
||||
RefPtr<Event> ev =
|
||||
|
@ -8568,9 +8545,8 @@ DispatchCustomEventWithFlush(nsINode* aTarget, const nsAString& aEventType,
|
|||
if (aOnlyChromeDispatch) {
|
||||
event->WidgetEventPtr()->mFlags.mOnlyChromeDispatch = true;
|
||||
}
|
||||
if (nsIPresShell* shell = aTarget->OwnerDoc()->GetShell()) {
|
||||
shell->GetPresContext()->
|
||||
RefreshDriver()->ScheduleEventDispatch(aTarget, event);
|
||||
if (nsPresContext* presContext = aTarget->OwnerDoc()->GetPresContext()) {
|
||||
presContext->RefreshDriver()->ScheduleEventDispatch(aTarget, event);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10862,10 +10838,8 @@ nsIDocument::DispatchFullscreenError(const char* aMessage)
|
|||
static void
|
||||
UpdateViewportScrollbarOverrideForFullscreen(nsIDocument* aDoc)
|
||||
{
|
||||
if (nsIPresShell* presShell = aDoc->GetShell()) {
|
||||
if (nsPresContext* presContext = presShell->GetPresContext()) {
|
||||
presContext->UpdateViewportScrollbarStylesOverride();
|
||||
}
|
||||
if (nsPresContext* presContext = aDoc->GetPresContext()) {
|
||||
presContext->UpdateViewportScrollbarStylesOverride();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4398,12 +4398,7 @@ nsGlobalWindowInner::DispatchEvent(nsIDOMEvent* aEvent, bool* aRetVal)
|
|||
}
|
||||
|
||||
// Obtain a presentation shell
|
||||
nsIPresShell *shell = mDoc->GetShell();
|
||||
RefPtr<nsPresContext> presContext;
|
||||
if (shell) {
|
||||
// Retrieve the context
|
||||
presContext = shell->GetPresContext();
|
||||
}
|
||||
RefPtr<nsPresContext> presContext = mDoc->GetPresContext();
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsresult rv = EventDispatcher::DispatchDOMEvent(ToSupports(this), nullptr,
|
||||
|
|
|
@ -189,9 +189,8 @@ nsHistory::Go(int32_t aDelta, ErrorResult& aRv)
|
|||
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
|
||||
nsIPresShell *shell;
|
||||
nsPresContext *pcx;
|
||||
if (doc && (shell = doc->GetShell()) && (pcx = shell->GetPresContext())) {
|
||||
if (doc && (pcx = doc->GetPresContext())) {
|
||||
pcx->RebuildAllStyleData(NS_STYLE_HINT_REFLOW, eRestyle_Subtree);
|
||||
}
|
||||
|
||||
|
|
|
@ -913,6 +913,12 @@ public:
|
|||
? mPresShell : nullptr;
|
||||
}
|
||||
|
||||
nsPresContext* GetPresContext() const
|
||||
{
|
||||
nsIPresShell* shell = GetShell();
|
||||
return shell ? shell->GetPresContext() : nullptr;
|
||||
}
|
||||
|
||||
bool HasShellOrBFCacheEntry() const
|
||||
{
|
||||
return mPresShell || mBFCacheEntry;
|
||||
|
|
|
@ -1263,11 +1263,7 @@ nsINode::DispatchEvent(nsIDOMEvent *aEvent, bool* aRetVal)
|
|||
}
|
||||
|
||||
// Obtain a presentation shell
|
||||
nsIPresShell *shell = document->GetShell();
|
||||
RefPtr<nsPresContext> context;
|
||||
if (shell) {
|
||||
context = shell->GetPresContext();
|
||||
}
|
||||
RefPtr<nsPresContext> context = document->GetPresContext();
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsresult rv =
|
||||
|
|
|
@ -227,12 +227,7 @@ nsStyleLinkElement::CheckPreloadAttrs(const nsAttrValue& aAs,
|
|||
if (!aMedia.IsEmpty()) {
|
||||
RefPtr<MediaList> mediaList = MediaList::Create(aDocument->GetStyleBackendType(),
|
||||
aMedia);
|
||||
nsIPresShell* shell = aDocument->GetShell();
|
||||
if (!shell) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsPresContext* presContext = shell->GetPresContext();
|
||||
nsPresContext* presContext = aDocument->GetPresContext();
|
||||
if (!presContext) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -81,11 +81,8 @@ DispatchCustomDOMEvent(Element* aFrameElement, const nsAString& aEventName,
|
|||
nsEventStatus *aStatus)
|
||||
{
|
||||
NS_ENSURE_TRUE(aFrameElement, false);
|
||||
nsIPresShell *shell = aFrameElement->OwnerDoc()->GetShell();
|
||||
RefPtr<nsPresContext> presContext;
|
||||
if (shell) {
|
||||
presContext = shell->GetPresContext();
|
||||
}
|
||||
RefPtr<nsPresContext> presContext =
|
||||
aFrameElement->OwnerDoc()->GetPresContext();
|
||||
|
||||
RefPtr<CustomEvent> event =
|
||||
NS_NewDOMCustomEvent(aFrameElement, presContext, nullptr);
|
||||
|
|
|
@ -344,9 +344,9 @@ Event::Init(mozilla::dom::EventTarget* aGlobal)
|
|||
nsCOMPtr<nsIDocument> d = w->GetExtantDoc();
|
||||
if (d) {
|
||||
trusted = nsContentUtils::IsChromeDoc(d);
|
||||
nsIPresShell* s = d->GetShell();
|
||||
if (s) {
|
||||
InitPresContextData(s->GetPresContext());
|
||||
nsPresContext* presContext = d->GetPresContext();
|
||||
if (presContext) {
|
||||
InitPresContextData(presContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -175,13 +175,10 @@ HTMLAnchorElement::IsHTMLFocusable(bool aWithMouse,
|
|||
// cannot focus links if there is no link handler
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
if (doc) {
|
||||
nsIPresShell* presShell = doc->GetShell();
|
||||
if (presShell) {
|
||||
nsPresContext* presContext = presShell->GetPresContext();
|
||||
if (presContext && !presContext->GetLinkHandler()) {
|
||||
*aIsFocusable = false;
|
||||
return false;
|
||||
}
|
||||
nsPresContext* presContext = doc->GetPresContext();
|
||||
if (presContext && !presContext->GetLinkHandler()) {
|
||||
*aIsFocusable = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1338,12 +1338,7 @@ HTMLCanvasElement::RegisterFrameCaptureListener(FrameCaptureListener* aListener,
|
|||
doc = doc->GetParentDocument();
|
||||
}
|
||||
|
||||
nsIPresShell* shell = doc->GetShell();
|
||||
if (!shell) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsPresContext* context = shell->GetPresContext();
|
||||
nsPresContext* context = doc->GetPresContext();
|
||||
if (!context) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -70,12 +70,11 @@ HTMLMenuElement::SendShowEvent()
|
|||
event.mFlags.mBubbles = false;
|
||||
event.mFlags.mCancelable = false;
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell = document->GetShell();
|
||||
if (!shell) {
|
||||
RefPtr<nsPresContext> presContext = document->GetPresContext();
|
||||
if (!presContext) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<nsPresContext> presContext = shell->GetPresContext();
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext,
|
||||
&event, nullptr, &status);
|
||||
|
|
|
@ -43,8 +43,7 @@ bool
|
|||
HTMLSourceElement::MatchesCurrentMedia()
|
||||
{
|
||||
if (mMediaList) {
|
||||
nsIPresShell* presShell = OwnerDoc()->GetShell();
|
||||
nsPresContext* pctx = presShell ? presShell->GetPresContext() : nullptr;
|
||||
nsPresContext* pctx = OwnerDoc()->GetPresContext();
|
||||
return pctx && mMediaList->Matches(pctx);
|
||||
}
|
||||
|
||||
|
@ -60,8 +59,7 @@ HTMLSourceElement::WouldMatchMediaForDocument(const nsAString& aMedia,
|
|||
return true;
|
||||
}
|
||||
|
||||
nsIPresShell* presShell = aDocument->GetShell();
|
||||
nsPresContext* pctx = presShell ? presShell->GetPresContext() : nullptr;
|
||||
nsPresContext* pctx = aDocument->GetPresContext();
|
||||
|
||||
RefPtr<MediaList> mediaList =
|
||||
MediaList::Create(aDocument->GetStyleBackendType(), aMedia);
|
||||
|
|
|
@ -730,12 +730,11 @@ ImageDocument::CheckOverflowing(bool changeState)
|
|||
* presentation through style resolution is potentially dangerous.
|
||||
*/
|
||||
{
|
||||
nsIPresShell *shell = GetShell();
|
||||
if (!shell) {
|
||||
nsPresContext* context = GetPresContext();
|
||||
if (!context) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsPresContext *context = shell->GetPresContext();
|
||||
nsRect visibleArea = context->GetVisibleArea();
|
||||
|
||||
mVisibleWidth = nsPresContext::AppUnitsToFloatCSSPixels(visibleArea.width);
|
||||
|
|
|
@ -989,11 +989,7 @@ nsGenericHTMLElement::GetPresContext(PresContextFor aFor)
|
|||
nsIDocument* doc = (aFor == eForComposedDoc) ?
|
||||
GetComposedDoc() : GetUncomposedDoc();
|
||||
if (doc) {
|
||||
// Get presentation shell.
|
||||
nsIPresShell *presShell = doc->GetShell();
|
||||
if (presShell) {
|
||||
return presShell->GetPresContext();
|
||||
}
|
||||
return doc->GetPresContext();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -2460,13 +2456,9 @@ nsGenericHTMLElement::Click(CallerType aCallerType)
|
|||
// Strong in case the event kills it
|
||||
nsCOMPtr<nsIDocument> doc = GetComposedDoc();
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
RefPtr<nsPresContext> context;
|
||||
if (doc) {
|
||||
shell = doc->GetShell();
|
||||
if (shell) {
|
||||
context = shell->GetPresContext();
|
||||
}
|
||||
context = doc->GetPresContext();
|
||||
}
|
||||
|
||||
SetHandlingClick();
|
||||
|
|
|
@ -861,12 +861,9 @@ nsHTMLDocument::SetCompatibilityMode(nsCompatibility aMode)
|
|||
|
||||
mCompatMode = aMode;
|
||||
CSSLoader()->SetCompatibilityMode(mCompatMode);
|
||||
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||
if (shell) {
|
||||
nsPresContext *pc = shell->GetPresContext();
|
||||
if (pc) {
|
||||
pc->CompatibilityModeChanged();
|
||||
}
|
||||
RefPtr<nsPresContext> pc = GetPresContext();
|
||||
if (pc) {
|
||||
pc->CompatibilityModeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1330,12 +1330,9 @@ TabChild::RecvSizeModeChanged(const nsSizeMode& aSizeMode)
|
|||
return IPC_OK();
|
||||
}
|
||||
nsCOMPtr<nsIDocument> document(GetDocument());
|
||||
nsCOMPtr<nsIPresShell> presShell = document->GetShell();
|
||||
if (presShell) {
|
||||
nsPresContext* presContext = presShell->GetPresContext();
|
||||
if (presContext) {
|
||||
presContext->SizeModeChanged(aSizeMode);
|
||||
}
|
||||
nsPresContext* presContext = document->GetPresContext();
|
||||
if (presContext) {
|
||||
presContext->SizeModeChanged(aSizeMode);
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
@ -2380,19 +2377,16 @@ TabChild::RecvHandleAccessKey(const WidgetKeyboardEvent& aEvent,
|
|||
nsTArray<uint32_t>&& aCharCodes)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> document(GetDocument());
|
||||
nsCOMPtr<nsIPresShell> presShell = document->GetShell();
|
||||
if (presShell) {
|
||||
nsPresContext* pc = presShell->GetPresContext();
|
||||
if (pc) {
|
||||
if (!pc->EventStateManager()->
|
||||
HandleAccessKey(&(const_cast<WidgetKeyboardEvent&>(aEvent)),
|
||||
pc, aCharCodes)) {
|
||||
// If no accesskey was found, inform the parent so that accesskeys on
|
||||
// menus can be handled.
|
||||
WidgetKeyboardEvent localEvent(aEvent);
|
||||
localEvent.mWidget = mPuppetWidget;
|
||||
SendAccessKeyNotHandled(localEvent);
|
||||
}
|
||||
RefPtr<nsPresContext> pc = document->GetPresContext();
|
||||
if (pc) {
|
||||
if (!pc->EventStateManager()->
|
||||
HandleAccessKey(&(const_cast<WidgetKeyboardEvent&>(aEvent)),
|
||||
pc, aCharCodes)) {
|
||||
// If no accesskey was found, inform the parent so that accesskeys on
|
||||
// menus can be handled.
|
||||
WidgetKeyboardEvent localEvent(aEvent);
|
||||
localEvent.mWidget = mPuppetWidget;
|
||||
SendAccessKeyNotHandled(localEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3276,12 +3270,9 @@ TabChild::RecvUIResolutionChanged(const float& aDpi,
|
|||
mPuppetWidget->UpdateBackingScaleCache(aDpi, aRounding, aScale);
|
||||
}
|
||||
nsCOMPtr<nsIDocument> document(GetDocument());
|
||||
nsCOMPtr<nsIPresShell> presShell = document->GetShell();
|
||||
if (presShell) {
|
||||
RefPtr<nsPresContext> presContext = presShell->GetPresContext();
|
||||
if (presContext) {
|
||||
presContext->UIResolutionChangedSync();
|
||||
}
|
||||
RefPtr<nsPresContext> presContext = document->GetPresContext();
|
||||
if (presContext) {
|
||||
presContext->UIResolutionChangedSync();
|
||||
}
|
||||
|
||||
ScreenIntSize screenSize = GetInnerSize();
|
||||
|
@ -3304,12 +3295,9 @@ TabChild::RecvThemeChanged(nsTArray<LookAndFeelInt>&& aLookAndFeelIntCache)
|
|||
{
|
||||
LookAndFeel::SetIntCache(aLookAndFeelIntCache);
|
||||
nsCOMPtr<nsIDocument> document(GetDocument());
|
||||
nsCOMPtr<nsIPresShell> presShell = document->GetShell();
|
||||
if (presShell) {
|
||||
RefPtr<nsPresContext> presContext = presShell->GetPresContext();
|
||||
if (presContext) {
|
||||
presContext->ThemeChanged();
|
||||
}
|
||||
RefPtr<nsPresContext> presContext = document->GetPresContext();
|
||||
if (presContext) {
|
||||
presContext->ThemeChanged();
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
|
|
@ -1162,8 +1162,7 @@ TabParent::GetLayoutDeviceToCSSScale()
|
|||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mFrameElement);
|
||||
nsIDocument* doc = (content ? content->OwnerDoc() : nullptr);
|
||||
nsIPresShell* shell = (doc ? doc->GetShell() : nullptr);
|
||||
nsPresContext* ctx = (shell ? shell->GetPresContext() : nullptr);
|
||||
nsPresContext* ctx = (doc ? doc->GetPresContext() : nullptr);
|
||||
return LayoutDeviceToCSSScale(ctx
|
||||
? (float)ctx->AppUnitsPerDevPixel() / nsPresContext::AppUnitsPerCSSPixel()
|
||||
: 0.0f);
|
||||
|
@ -2158,9 +2157,7 @@ TabParent::RecvReplyKeyEvent(const WidgetKeyboardEvent& aEvent)
|
|||
// Here we convert the WidgetEvent that we received to an nsIDOMEvent
|
||||
// to be able to dispatch it to the <browser> element as the target element.
|
||||
nsIDocument* doc = mFrameElement->OwnerDoc();
|
||||
nsIPresShell* presShell = doc->GetShell();
|
||||
NS_ENSURE_TRUE(presShell, IPC_OK());
|
||||
nsPresContext* presContext = presShell->GetPresContext();
|
||||
nsPresContext* presContext = doc->GetPresContext();
|
||||
NS_ENSURE_TRUE(presContext, IPC_OK());
|
||||
|
||||
AutoHandlingUserInputStatePusher userInpStatePusher(localEvent.IsTrusted(),
|
||||
|
|
|
@ -122,9 +122,9 @@ nsMathMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
// Rebuild style data for the presshell, because style system
|
||||
// optimizations may have taken place assuming MathML was disabled.
|
||||
// (See nsRuleNode::CheckSpecifiedProperties.)
|
||||
nsCOMPtr<nsIPresShell> shell = doc->GetShell();
|
||||
if (shell) {
|
||||
shell->GetPresContext()->
|
||||
RefPtr<nsPresContext> presContext = doc->GetPresContext();
|
||||
if (presContext) {
|
||||
presContext->
|
||||
PostRebuildAllStyleDataEvent(nsChangeHint(0), eRestyle_Subtree);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -421,12 +421,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsIPresShell *presShell = doc->GetShell();
|
||||
if (!presShell) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
nsPresContext* presContext = doc->GetPresContext();
|
||||
if (!presContext) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -735,12 +735,7 @@ nsSMILAnimationController::PreTraverseInSubtree(Element* aRoot)
|
|||
return false;
|
||||
}
|
||||
|
||||
nsIPresShell* shell = mDocument->GetShell();
|
||||
if (!shell) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsPresContext* context = shell->GetPresContext();
|
||||
nsPresContext* context = mDocument->GetPresContext();
|
||||
if (!context) {
|
||||
return false;
|
||||
}
|
||||
|
@ -818,12 +813,7 @@ nsSMILAnimationController::GetRefreshDriver()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
nsIPresShell* shell = mDocument->GetShell();
|
||||
if (!shell) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsPresContext* context = shell->GetPresContext();
|
||||
nsPresContext* context = mDocument->GetPresContext();
|
||||
return context ? context->RefreshDriver() : nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -665,8 +665,7 @@ GetPresContextForElement(Element* aElem)
|
|||
// See bug 534975.
|
||||
return nullptr;
|
||||
}
|
||||
nsIPresShell* shell = doc->GetShell();
|
||||
return shell ? shell->GetPresContext() : nullptr;
|
||||
return doc->GetPresContext();
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_STYLE
|
||||
|
|
|
@ -106,10 +106,7 @@ namespace
|
|||
nsPresContext* context = nullptr;
|
||||
nsIDocument* doc = mTarget->GetUncomposedDoc();
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIPresShell> shell = doc->GetShell();
|
||||
if (shell) {
|
||||
context = shell->GetPresContext();
|
||||
}
|
||||
context = doc->GetPresContext();
|
||||
}
|
||||
|
||||
return EventDispatcher::Dispatch(mTarget, context, &event);
|
||||
|
|
|
@ -206,13 +206,10 @@ SVGAElement::IsSVGFocusable(bool* aIsFocusable, int32_t* aTabIndex)
|
|||
// cannot focus links if there is no link handler
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
if (doc) {
|
||||
nsIPresShell* presShell = doc->GetShell();
|
||||
if (presShell) {
|
||||
nsPresContext* presContext = presShell->GetPresContext();
|
||||
if (presContext && !presContext->GetLinkHandler()) {
|
||||
*aIsFocusable = false;
|
||||
return false;
|
||||
}
|
||||
nsPresContext* presContext = doc->GetPresContext();
|
||||
if (presContext && !presContext->GetLinkHandler()) {
|
||||
*aIsFocusable = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -820,14 +820,12 @@ XULDocument::ExecuteOnBroadcastHandlerFor(Element* aBroadcaster,
|
|||
// |onbroadcast| event handler
|
||||
WidgetEvent event(true, eXULBroadcast);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||
if (shell) {
|
||||
RefPtr<nsPresContext> aPresContext = shell->GetPresContext();
|
||||
|
||||
// Handle the DOM event
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
EventDispatcher::Dispatch(child, aPresContext, &event, nullptr,
|
||||
&status);
|
||||
RefPtr<nsPresContext> presContext = GetPresContext();
|
||||
if (presContext) {
|
||||
// Handle the DOM event
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
EventDispatcher::Dispatch(child, presContext, &event, nullptr,
|
||||
&status);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1621,10 +1621,9 @@ nsXULElement::ClickWithInputSource(uint16_t aInputSource, bool aIsTrustedEvent)
|
|||
|
||||
nsCOMPtr<nsIDocument> doc = GetComposedDoc(); // Strong just in case
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIPresShell> shell = doc->GetShell();
|
||||
if (shell) {
|
||||
RefPtr<nsPresContext> context = doc->GetPresContext();
|
||||
if (context) {
|
||||
// strong ref to PresContext so events don't destroy it
|
||||
RefPtr<nsPresContext> context = shell->GetPresContext();
|
||||
|
||||
WidgetMouseEvent eventDown(aIsTrustedEvent, eMouseDown,
|
||||
nullptr, WidgetMouseEvent::eReal);
|
||||
|
@ -1776,14 +1775,12 @@ nsXULElement::HideWindowChrome(bool aShouldHide)
|
|||
if (!doc->IsRootDisplayDocument())
|
||||
return NS_OK;
|
||||
|
||||
nsIPresShell *shell = doc->GetShell();
|
||||
nsPresContext* presContext = doc->GetPresContext();
|
||||
|
||||
if (shell) {
|
||||
if (presContext && presContext->IsChrome()) {
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
|
||||
nsPresContext *presContext = shell->GetPresContext();
|
||||
|
||||
if (frame && presContext && presContext->IsChrome()) {
|
||||
if (frame) {
|
||||
nsView* view = frame->GetClosestView();
|
||||
|
||||
if (view) {
|
||||
|
|
|
@ -223,13 +223,12 @@ nsXULPopupListener::FireFocusOnTargetContent(nsIDOMNode* aTargetNode, bool aIsTo
|
|||
nsCOMPtr<nsIDocument> doc = content->OwnerDoc();
|
||||
|
||||
// Get nsIDOMElement for targetNode
|
||||
nsIPresShell *shell = doc->GetShell();
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// strong reference to keep this from going away between events
|
||||
// XXXbz between what events? We don't use this local at all!
|
||||
RefPtr<nsPresContext> context = shell->GetPresContext();
|
||||
RefPtr<nsPresContext> context = doc->GetPresContext();
|
||||
if (!context) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsIFrame* targetFrame = content->GetPrimaryFrame();
|
||||
if (!targetFrame) return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -8048,13 +8048,11 @@ PresShell::DispatchTouchEventToDOM(WidgetEvent* aEvent,
|
|||
}
|
||||
}
|
||||
|
||||
nsIPresShell *presShell = doc->GetShell();
|
||||
if (!presShell) {
|
||||
nsPresContext *context = doc->GetPresContext();
|
||||
if (!context) {
|
||||
continue;
|
||||
}
|
||||
|
||||
nsPresContext *context = presShell->GetPresContext();
|
||||
|
||||
tmpStatus = nsEventStatus_eIgnore;
|
||||
EventDispatcher::Dispatch(targetPtr, context,
|
||||
&newEvent, nullptr, &tmpStatus, aEventCB);
|
||||
|
@ -10503,9 +10501,9 @@ void PresShell::QueryIsActive()
|
|||
MOZ_ASSERT(!container,
|
||||
"external resource doc shouldn't have its own container");
|
||||
|
||||
nsIPresShell* displayPresShell = displayDoc->GetShell();
|
||||
if (displayPresShell) {
|
||||
container = displayPresShell->GetPresContext()->GetContainerWeak();
|
||||
nsPresContext* displayPresContext = displayDoc->GetPresContext();
|
||||
if (displayPresContext) {
|
||||
container = displayPresContext->GetContainerWeak();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1204,11 +1204,7 @@ nsDocumentViewer::PermitUnloadInternal(uint32_t *aPermitUnloadFlags,
|
|||
|
||||
// Now, fire an BeforeUnload event to the document and see if it's ok
|
||||
// to unload...
|
||||
nsIPresShell* shell = mDocument->GetShell();
|
||||
nsPresContext* presContext = nullptr;
|
||||
if (shell) {
|
||||
presContext = shell->GetPresContext();
|
||||
}
|
||||
nsPresContext* presContext = mDocument->GetPresContext();
|
||||
RefPtr<BeforeUnloadEvent> event =
|
||||
new BeforeUnloadEvent(mDocument, presContext, nullptr);
|
||||
event->InitEvent(NS_LITERAL_STRING("beforeunload"), false, true);
|
||||
|
@ -2664,13 +2660,10 @@ nsDocumentViewer::CreateDeviceContext(nsView* aContainerView)
|
|||
if (doc) {
|
||||
NS_ASSERTION(!aContainerView, "External resource document embedded somewhere?");
|
||||
// We want to use our display document's device context if possible
|
||||
nsIPresShell* shell = doc->GetShell();
|
||||
if (shell) {
|
||||
nsPresContext* ctx = shell->GetPresContext();
|
||||
if (ctx) {
|
||||
mDeviceContext = ctx->DeviceContext();
|
||||
return NS_OK;
|
||||
}
|
||||
nsPresContext* ctx = doc->GetPresContext();
|
||||
if (ctx) {
|
||||
mDeviceContext = ctx->DeviceContext();
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2953,13 +2946,10 @@ static bool
|
|||
SetExtResourceTextZoom(nsIDocument* aDocument, void* aClosure)
|
||||
{
|
||||
// Would it be better to enumerate external resource viewers instead?
|
||||
nsIPresShell* shell = aDocument->GetShell();
|
||||
if (shell) {
|
||||
nsPresContext* ctxt = shell->GetPresContext();
|
||||
if (ctxt) {
|
||||
struct ZoomInfo* ZoomInfo = static_cast<struct ZoomInfo*>(aClosure);
|
||||
ctxt->SetTextZoom(ZoomInfo->mZoom);
|
||||
}
|
||||
nsPresContext* ctxt = aDocument->GetPresContext();
|
||||
if (ctxt) {
|
||||
struct ZoomInfo* ZoomInfo = static_cast<struct ZoomInfo*>(aClosure);
|
||||
ctxt->SetTextZoom(ZoomInfo->mZoom);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -2968,12 +2958,9 @@ SetExtResourceTextZoom(nsIDocument* aDocument, void* aClosure)
|
|||
static bool
|
||||
SetExtResourceMinFontSize(nsIDocument* aDocument, void* aClosure)
|
||||
{
|
||||
nsIPresShell* shell = aDocument->GetShell();
|
||||
if (shell) {
|
||||
nsPresContext* ctxt = shell->GetPresContext();
|
||||
if (ctxt) {
|
||||
ctxt->SetBaseMinFontSize(NS_PTR_TO_INT32(aClosure));
|
||||
}
|
||||
nsPresContext* ctxt = aDocument->GetPresContext();
|
||||
if (ctxt) {
|
||||
ctxt->SetBaseMinFontSize(NS_PTR_TO_INT32(aClosure));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -2983,13 +2970,10 @@ static bool
|
|||
SetExtResourceFullZoom(nsIDocument* aDocument, void* aClosure)
|
||||
{
|
||||
// Would it be better to enumerate external resource viewers instead?
|
||||
nsIPresShell* shell = aDocument->GetShell();
|
||||
if (shell) {
|
||||
nsPresContext* ctxt = shell->GetPresContext();
|
||||
if (ctxt) {
|
||||
struct ZoomInfo* ZoomInfo = static_cast<struct ZoomInfo*>(aClosure);
|
||||
ctxt->SetFullZoom(ZoomInfo->mZoom);
|
||||
}
|
||||
nsPresContext* ctxt = aDocument->GetPresContext();
|
||||
if (ctxt) {
|
||||
struct ZoomInfo* ZoomInfo = static_cast<struct ZoomInfo*>(aClosure);
|
||||
ctxt->SetFullZoom(ZoomInfo->mZoom);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -2998,13 +2982,10 @@ SetExtResourceFullZoom(nsIDocument* aDocument, void* aClosure)
|
|||
static bool
|
||||
SetExtResourceOverrideDPPX(nsIDocument* aDocument, void* aClosure)
|
||||
{
|
||||
nsIPresShell* shell = aDocument->GetShell();
|
||||
if (shell) {
|
||||
nsPresContext* ctxt = shell->GetPresContext();
|
||||
if (ctxt) {
|
||||
struct ZoomInfo* ZoomInfo = static_cast<struct ZoomInfo*>(aClosure);
|
||||
ctxt->SetOverrideDPPX(ZoomInfo->mZoom);
|
||||
}
|
||||
nsPresContext* ctxt = aDocument->GetPresContext();
|
||||
if (ctxt) {
|
||||
struct ZoomInfo* ZoomInfo = static_cast<struct ZoomInfo*>(aClosure);
|
||||
ctxt->SetOverrideDPPX(ZoomInfo->mZoom);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -3273,13 +3254,10 @@ nsDocumentViewer::GetAuthorStyleDisabled(bool* aStyleDisabled)
|
|||
static bool
|
||||
ExtResourceEmulateMedium(nsIDocument* aDocument, void* aClosure)
|
||||
{
|
||||
nsIPresShell* shell = aDocument->GetShell();
|
||||
if (shell) {
|
||||
nsPresContext* ctxt = shell->GetPresContext();
|
||||
if (ctxt) {
|
||||
const nsAString* mediaType = static_cast<nsAString*>(aClosure);
|
||||
ctxt->EmulateMedium(*mediaType);
|
||||
}
|
||||
nsPresContext* ctxt = aDocument->GetPresContext();
|
||||
if (ctxt) {
|
||||
const nsAString* mediaType = static_cast<nsAString*>(aClosure);
|
||||
ctxt->EmulateMedium(*mediaType);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -3311,12 +3289,9 @@ nsDocumentViewer::EmulateMedium(const nsAString& aMediaType)
|
|||
static bool
|
||||
ExtResourceStopEmulatingMedium(nsIDocument* aDocument, void* aClosure)
|
||||
{
|
||||
nsIPresShell* shell = aDocument->GetShell();
|
||||
if (shell) {
|
||||
nsPresContext* ctxt = shell->GetPresContext();
|
||||
if (ctxt) {
|
||||
ctxt->StopEmulatingMedium();
|
||||
}
|
||||
nsPresContext* ctxt = aDocument->GetPresContext();
|
||||
if (ctxt) {
|
||||
ctxt->StopEmulatingMedium();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -8447,9 +8447,9 @@ nsLayoutUtils::PostRestyleEvent(Element* aElement,
|
|||
{
|
||||
nsIDocument* doc = aElement->GetComposedDoc();
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIPresShell> presShell = doc->GetShell();
|
||||
if (presShell) {
|
||||
presShell->GetPresContext()->RestyleManager()->PostRestyleEvent(
|
||||
RefPtr<nsPresContext> presContext = doc->GetPresContext();
|
||||
if (presContext) {
|
||||
presContext->RestyleManager()->PostRestyleEvent(
|
||||
aElement, aRestyleHint, aMinChangeHint);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -907,10 +907,9 @@ nsPresContext::Init(nsDeviceContext* aDeviceContext)
|
|||
mAnimationManager = new nsAnimationManager(this);
|
||||
|
||||
if (mDocument->GetDisplayDocument()) {
|
||||
NS_ASSERTION(mDocument->GetDisplayDocument()->GetShell() &&
|
||||
mDocument->GetDisplayDocument()->GetShell()->GetPresContext(),
|
||||
NS_ASSERTION(mDocument->GetDisplayDocument()->GetPresContext(),
|
||||
"Why are we being initialized?");
|
||||
mRefreshDriver = mDocument->GetDisplayDocument()->GetShell()->
|
||||
mRefreshDriver = mDocument->GetDisplayDocument()->
|
||||
GetPresContext()->RefreshDriver();
|
||||
} else {
|
||||
nsIDocument* parent = mDocument->GetParentDocument();
|
||||
|
@ -921,10 +920,7 @@ nsPresContext::Init(nsDeviceContext* aDeviceContext)
|
|||
NS_ASSERTION(!parent || mDocument->IsStaticDocument() || parent->GetShell(),
|
||||
"How did we end up with a presshell if our parent doesn't "
|
||||
"have one?");
|
||||
if (parent && parent->GetShell()) {
|
||||
NS_ASSERTION(parent->GetShell()->GetPresContext(),
|
||||
"How did we get a presshell?");
|
||||
|
||||
if (parent && parent->GetPresContext()) {
|
||||
// We don't have our container set yet at this point
|
||||
nsCOMPtr<nsIDocShellTreeItem> ourItem = mDocument->GetDocShell();
|
||||
if (ourItem) {
|
||||
|
@ -937,7 +933,7 @@ nsPresContext::Init(nsDeviceContext* aDeviceContext)
|
|||
!containingElement->
|
||||
HasAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::forceOwnRefreshDriver)) {
|
||||
mRefreshDriver = parent->GetShell()->GetPresContext()->RefreshDriver();
|
||||
mRefreshDriver = parent->GetPresContext()->RefreshDriver();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1961,17 +1957,14 @@ nsPresContext::UIResolutionChangedSync()
|
|||
nsPresContext::UIResolutionChangedSubdocumentCallback(nsIDocument* aDocument,
|
||||
void* aData)
|
||||
{
|
||||
nsIPresShell* shell = aDocument->GetShell();
|
||||
if (shell) {
|
||||
nsPresContext* pc = shell->GetPresContext();
|
||||
if (pc) {
|
||||
// For subdocuments, we want to apply the parent's scale, because there
|
||||
// are cases where the subdoc's device context is connected to a widget
|
||||
// that has an out-of-date resolution (it's on a different screen, but
|
||||
// currently hidden, and will not be updated until shown): bug 1249279.
|
||||
double scale = *static_cast<double*>(aData);
|
||||
pc->UIResolutionChangedInternalScale(scale);
|
||||
}
|
||||
nsPresContext* pc = aDocument->GetPresContext();
|
||||
if (pc) {
|
||||
// For subdocuments, we want to apply the parent's scale, because there
|
||||
// are cases where the subdoc's device context is connected to a widget
|
||||
// that has an out-of-date resolution (it's on a different screen, but
|
||||
// currently hidden, and will not be updated until shown): bug 1249279.
|
||||
double scale = *static_cast<double*>(aData);
|
||||
pc->UIResolutionChangedInternalScale(scale);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -2122,10 +2115,8 @@ static bool
|
|||
MediaFeatureValuesChangedAllDocumentsCallback(nsIDocument* aDocument, void* aChange)
|
||||
{
|
||||
auto* change = static_cast<const MediaFeatureChange*>(aChange);
|
||||
if (nsIPresShell* shell = aDocument->GetShell()) {
|
||||
if (nsPresContext* pc = shell->GetPresContext()) {
|
||||
pc->MediaFeatureValuesChangedAllDocuments(*change);
|
||||
}
|
||||
if (nsPresContext* pc = aDocument->GetPresContext()) {
|
||||
pc->MediaFeatureValuesChangedAllDocuments(*change);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -2494,16 +2485,13 @@ static bool
|
|||
MayHavePaintEventListenerSubdocumentCallback(nsIDocument* aDocument, void* aData)
|
||||
{
|
||||
bool *result = static_cast<bool*>(aData);
|
||||
nsIPresShell* shell = aDocument->GetShell();
|
||||
if (shell) {
|
||||
nsPresContext* pc = shell->GetPresContext();
|
||||
if (pc) {
|
||||
*result = pc->MayHavePaintEventListenerInSubDocument();
|
||||
nsPresContext* pc = aDocument->GetPresContext();
|
||||
if (pc) {
|
||||
*result = pc->MayHavePaintEventListenerInSubDocument();
|
||||
|
||||
// If we found a paint event listener, then we can stop enumerating
|
||||
// sub documents.
|
||||
return !*result;
|
||||
}
|
||||
// If we found a paint event listener, then we can stop enumerating
|
||||
// sub documents.
|
||||
return !*result;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -2690,13 +2678,10 @@ nsPresContext::NotifyDidPaintSubdocumentCallback(nsIDocument* aDocument, void* a
|
|||
{
|
||||
NotifyDidPaintSubdocumentCallbackClosure* closure =
|
||||
static_cast<NotifyDidPaintSubdocumentCallbackClosure*>(aData);
|
||||
nsIPresShell* shell = aDocument->GetShell();
|
||||
if (shell) {
|
||||
nsPresContext* pc = shell->GetPresContext();
|
||||
if (pc) {
|
||||
pc->NotifyDidPaintForSubtree(closure->mTransactionId,
|
||||
closure->mTimeStamp);
|
||||
}
|
||||
nsPresContext* pc = aDocument->GetPresContext();
|
||||
if (pc) {
|
||||
pc->NotifyDidPaintForSubtree(closure->mTransactionId,
|
||||
closure->mTimeStamp);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -25,11 +25,11 @@ EventStateManager*
|
|||
inLayoutUtils::GetEventStateManagerFor(Element& aElement)
|
||||
{
|
||||
nsIDocument* doc = aElement.OwnerDoc();
|
||||
nsIPresShell* shell = doc->GetShell();
|
||||
if (!shell)
|
||||
nsPresContext* presContext = doc->GetPresContext();
|
||||
if (!presContext)
|
||||
return nullptr;
|
||||
|
||||
return shell->GetPresContext()->EventStateManager();
|
||||
return presContext->EventStateManager();
|
||||
}
|
||||
|
||||
nsIDOMDocument*
|
||||
|
|
|
@ -1889,8 +1889,7 @@ FontFaceSet::GetPresContext()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
nsIPresShell* shell = mDocument->GetShell();
|
||||
return shell ? shell->GetPresContext() : nullptr;
|
||||
return mDocument->GetPresContext();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -306,12 +306,7 @@ ImageLoader::GetPresContext()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
nsIPresShell* shell = mDocument->GetShell();
|
||||
if (!shell) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return shell->GetPresContext();
|
||||
return mDocument->GetPresContext();
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
|
@ -155,13 +155,7 @@ MediaQueryList::RecomputeMatches()
|
|||
}
|
||||
}
|
||||
|
||||
nsIPresShell* shell = mDocument->GetShell();
|
||||
if (!shell) {
|
||||
// XXXbz What's the right behavior here? Spec doesn't say.
|
||||
return;
|
||||
}
|
||||
|
||||
nsPresContext* presContext = shell->GetPresContext();
|
||||
nsPresContext* presContext = mDocument->GetPresContext();
|
||||
if (!presContext) {
|
||||
// XXXbz What's the right behavior here? Spec doesn't say.
|
||||
return;
|
||||
|
|
|
@ -571,10 +571,10 @@ Gecko_GetAnimationRule(RawGeckoElementBorrowed aElement,
|
|||
MOZ_ASSERT(aElement);
|
||||
|
||||
nsIDocument* doc = aElement->GetComposedDoc();
|
||||
if (!doc || !doc->GetShell()) {
|
||||
if (!doc) {
|
||||
return false;
|
||||
}
|
||||
nsPresContext* presContext = doc->GetShell()->GetPresContext();
|
||||
nsPresContext* presContext = doc->GetPresContext();
|
||||
if (!presContext || !presContext->IsDynamic()) {
|
||||
// For print or print preview, ignore animations.
|
||||
return false;
|
||||
|
|
|
@ -34,10 +34,8 @@ ServoSpecifiedValues::SetIdentAtomValue(nsCSSPropertyID aId, nsAtom* aValue)
|
|||
// FIXME(emilio): Can we move mapped attribute declarations across
|
||||
// documents? Isn't this wrong in that case? This is pretty out of place
|
||||
// anyway.
|
||||
if (nsIPresShell* shell = mDocument->GetShell()) {
|
||||
if (nsPresContext* pc = shell->GetPresContext()) {
|
||||
pc->ForceCacheLang(aValue);
|
||||
}
|
||||
if (nsPresContext* pc = mDocument->GetPresContext()) {
|
||||
pc->ForceCacheLang(aValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,12 +124,7 @@ ServoStyleSet::GetPresContext()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
auto* shell = mDocument->GetShell();
|
||||
if (!shell) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return shell->GetPresContext();
|
||||
return mDocument->GetPresContext();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -510,8 +510,7 @@ nsHTMLStyleSheet::ImplLinkColorSetter(
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
RestyleManager* restyle =
|
||||
mDocument->GetShell()->GetPresContext()->RestyleManager();
|
||||
RestyleManager* restyle = mDocument->GetPresContext()->RestyleManager();
|
||||
|
||||
if (restyle->IsServo()) {
|
||||
MOZ_ASSERT(!ServoStyleSet::IsInServoTraversal());
|
||||
|
|
|
@ -87,22 +87,11 @@ const OperatingSystemVersionInfo kOsVersionStrings[] = {
|
|||
};
|
||||
#endif
|
||||
|
||||
static nsPresContext*
|
||||
GetPresContext(nsIDocument* aDocument)
|
||||
{
|
||||
nsIPresShell* presShell = aDocument->GetShell();
|
||||
if (!presShell) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return presShell->GetPresContext();
|
||||
}
|
||||
|
||||
// A helper for four features below
|
||||
static nsSize
|
||||
GetSize(nsIDocument* aDocument)
|
||||
{
|
||||
nsPresContext* pc = GetPresContext(aDocument);
|
||||
nsPresContext* pc = aDocument->GetPresContext();
|
||||
|
||||
// Per spec, return a 0x0 viewport if we're not being rendered. See:
|
||||
//
|
||||
|
@ -158,7 +147,7 @@ GetDeviceSize(nsIDocument* aDocument)
|
|||
return GetSize(aDocument);
|
||||
}
|
||||
|
||||
nsPresContext* pc = GetPresContext(aDocument);
|
||||
nsPresContext* pc = aDocument->GetPresContext();
|
||||
// NOTE(emilio): We should probably figure out how to return an appropriate
|
||||
// device size here, though in a multi-screen world that makes no sense
|
||||
// really.
|
||||
|
@ -252,7 +241,7 @@ GetDeviceAspectRatio(nsIDocument* aDocument, const nsMediaFeature*,
|
|||
static nsDeviceContext*
|
||||
GetDeviceContextFor(nsIDocument* aDocument)
|
||||
{
|
||||
nsPresContext* pc = GetPresContext(aDocument);
|
||||
nsPresContext* pc = aDocument->GetPresContext();
|
||||
if (!pc) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -86,12 +86,7 @@ private:
|
|||
NS_IMETHODIMP
|
||||
nsImageBoxFrameEvent::Run()
|
||||
{
|
||||
nsIPresShell *pres_shell = mContent->OwnerDoc()->GetShell();
|
||||
if (!pres_shell) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
RefPtr<nsPresContext> pres_context = pres_shell->GetPresContext();
|
||||
RefPtr<nsPresContext> pres_context = mContent->OwnerDoc()->GetPresContext();
|
||||
if (!pres_context) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -2791,13 +2791,10 @@ nsXULPopupHidingEvent::Run()
|
|||
|
||||
nsIDocument *document = mPopup->GetUncomposedDoc();
|
||||
if (pm && document) {
|
||||
nsIPresShell* presShell = document->GetShell();
|
||||
if (presShell) {
|
||||
nsPresContext* context = presShell->GetPresContext();
|
||||
if (context) {
|
||||
pm->FirePopupHidingEvent(mPopup, mNextPopup, mLastPopup,
|
||||
context, mPopupType, mDeselectMenu, mIsRollup);
|
||||
}
|
||||
nsPresContext* context = document->GetPresContext();
|
||||
if (context) {
|
||||
pm->FirePopupHidingEvent(mPopup, mNextPopup, mLastPopup,
|
||||
context, mPopupType, mDeselectMenu, mIsRollup);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,11 +28,7 @@ nsHtml5SVGLoadDispatcher::Run()
|
|||
// That is, should this code flush or something? Does it really matter?
|
||||
// For that matter, do we really want to try getting the prescontext?
|
||||
// Does this event ever want one?
|
||||
RefPtr<nsPresContext> ctx;
|
||||
nsCOMPtr<nsIPresShell> shell = mElement->OwnerDoc()->GetShell();
|
||||
if (shell) {
|
||||
ctx = shell->GetPresContext();
|
||||
}
|
||||
RefPtr<nsPresContext> ctx = mElement->OwnerDoc()->GetPresContext();
|
||||
EventDispatcher::Dispatch(mElement, ctx, &event);
|
||||
// Unblocking onload on the same document that it was blocked even if
|
||||
// the element has moved between docs since blocking.
|
||||
|
|
|
@ -2266,10 +2266,8 @@ nsWindowWatcher::SizeOpenedWindow(nsIDocShellTreeOwner* aTreeOwner,
|
|||
if (aParent && aOpenerFullZoom.isNothing()) {
|
||||
nsCOMPtr<nsPIDOMWindowOuter> piWindow = nsPIDOMWindowOuter::From(aParent);
|
||||
if (nsIDocument* doc = piWindow->GetDoc()) {
|
||||
if (nsIPresShell* shell = doc->GetShell()) {
|
||||
if (nsPresContext* presContext = shell->GetPresContext()) {
|
||||
openerZoom = presContext->GetFullZoom();
|
||||
}
|
||||
if (nsPresContext* presContext = doc->GetPresContext()) {
|
||||
openerZoom = presContext->GetFullZoom();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -691,13 +691,10 @@ void nsDocLoader::DocLoaderIsEmpty(bool aFlushLayout)
|
|||
// no matter what. If we have user fonts, we also need to flush layout,
|
||||
// since the reflow is what starts font loads.
|
||||
mozilla::FlushType flushType = mozilla::FlushType::Style;
|
||||
nsIPresShell* shell = doc->GetShell();
|
||||
if (shell) {
|
||||
// Be safe in case this presshell is in teardown now
|
||||
nsPresContext* presContext = shell->GetPresContext();
|
||||
if (presContext && presContext->GetUserFontSet()) {
|
||||
flushType = mozilla::FlushType::Layout;
|
||||
}
|
||||
// Be safe in case this presshell is in teardown now
|
||||
nsPresContext* presContext = doc->GetPresContext();
|
||||
if (presContext && presContext->GetUserFontSet()) {
|
||||
flushType = mozilla::FlushType::Layout;
|
||||
}
|
||||
mDontFlushLayout = mIsFlushingLayout = true;
|
||||
doc->FlushPendingNotifications(flushType);
|
||||
|
|
Загрузка…
Ссылка в новой задаче