Bug 1411754 - Rename PresShell::DestroyFramesFor to DestroyFramesForAndRestyle

Tag #1375
This commit is contained in:
Matt A. Tobin 2020-04-17 06:41:41 -04:00 • committed by Roy Tam
commit efb5979ad5
6 changed files with 14 additions and 13 deletions

View file

@ -1119,7 +1119,7 @@ Element::CreateShadowRoot(ErrorResult& aError)
if (nsIDocument* doc = GetComposedDoc()) { if (nsIDocument* doc = GetComposedDoc()) {
if (nsIPresShell* shell = doc->GetShell()) { if (nsIPresShell* shell = doc->GetShell()) {
shell->DestroyFramesFor(this); shell->DestroyFramesForAndRestyle(this);
MOZ_ASSERT(!shell->FrameManager()->GetDisplayContentsStyleFor(this)); MOZ_ASSERT(!shell->FrameManager()->GetDisplayContentsStyleFor(this));
} }
} }

View file

@ -265,8 +265,7 @@ ShadowRoot::DistributionChanged()
return; return;
} }
// FIXME(emilio): Rename this to DestroyFramesForAndRestyle? shell->DestroyFramesForAndRestyle(host);
shell->DestroyFramesFor(host);
} }
const HTMLContentElement* const HTMLContentElement*
@ -513,7 +512,7 @@ ShadowRoot::AttributeChanged(nsIDocument* aDocument,
return; return;
} }
shell->DestroyFramesFor(aElement); shell->DestroyFramesForAndRestyle(aElement);
} }
bool bool

View file

@ -125,7 +125,7 @@ public:
// since if the binding fetch fails then we don't want to destroy the // since if the binding fetch fails then we don't want to destroy the
// frames. // frames.
if (nsIPresShell* shell = doc->GetShell()) { if (nsIPresShell* shell = doc->GetShell()) {
shell->DestroyFramesFor(mBoundElement->AsElement()); shell->DestroyFramesForAndRestyle(mBoundElement->AsElement());
} }
MOZ_ASSERT(!mBoundElement->GetPrimaryFrame()); MOZ_ASSERT(!mBoundElement->GetPrimaryFrame());
} }

View file

@ -544,7 +544,7 @@ public:
* *
* Note that this may destroy frames for an ancestor instead. * Note that this may destroy frames for an ancestor instead.
*/ */
virtual void DestroyFramesFor(mozilla::dom::Element* aElement) = 0; virtual void DestroyFramesForAndRestyle(mozilla::dom::Element* aElement) = 0;
/** /**
* Recreates the frames for a node * Recreates the frames for a node

View file

@ -2828,7 +2828,7 @@ PresShell::CancelAllPendingReflows()
} }
void void
PresShell::DestroyFramesFor(Element* aElement) PresShell::DestroyFramesForAndRestyle(Element* aElement)
{ {
MOZ_ASSERT(aElement); MOZ_ASSERT(aElement);
NS_ENSURE_TRUE_VOID(mPresContext); NS_ENSURE_TRUE_VOID(mPresContext);
@ -2847,13 +2847,15 @@ PresShell::DestroyFramesFor(Element* aElement)
fc->DestroyFramesFor(aElement, &didReconstruct); fc->DestroyFramesFor(aElement, &didReconstruct);
fc->EndUpdate(); fc->EndUpdate();
// XXXmats doesn't frame state need to be restored in this case? auto changeHint = didReconstruct
if (!didReconstruct) { ? nsChangeHint(0)
PostRecreateFramesFor(aElement); : nsChangeHint_ReconstructFrame;
}
// NOTE(emilio): eRestyle_Subtree is needed to force also a full subtree
// restyle for the content (in Stylo, where the existence of frames != the
// existence of styles).
mPresContext->RestyleManager()->PostRestyleEvent( mPresContext->RestyleManager()->PostRestyleEvent(
aElement, eRestyle_Subtree, nsChangeHint(0)); aElement, eRestyle_Subtree, changeHint);
--mChangeNestCount; --mChangeNestCount;
} }

View file

@ -139,7 +139,7 @@ public:
virtual bool IsSafeToFlush() const override; virtual bool IsSafeToFlush() const override;
virtual void FlushPendingNotifications(mozFlushType aType) override; virtual void FlushPendingNotifications(mozFlushType aType) override;
virtual void FlushPendingNotifications(mozilla::ChangesToFlush aType) override; virtual void FlushPendingNotifications(mozilla::ChangesToFlush aType) override;
virtual void DestroyFramesFor(mozilla::dom::Element* aElement) override; virtual void DestroyFramesForAndRestyle(mozilla::dom::Element* aElement) override;
/** /**
* Recreates the frames for a node * Recreates the frames for a node