зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1411754: Rename PresShell::DestroyFramesFor to DestroyFramesForAndRestyle. r=mats
I'm drive-by removing the comment about the frame tree state because I looked into it, and the answer is: we properly restore it. The gotcha is that we retain it too much, indeed, we retain it enough that it can leak. See bug 1397239. MozReview-Commit-ID: LP6bXkduEZ4 --HG-- extra : rebase_source : f7e18fc35e48b75c07fcc84b939614d379926828
This commit is contained in:
Родитель
d454491418
Коммит
4deb3bee3b
|
@ -1169,7 +1169,7 @@ Element::CreateShadowRoot(ErrorResult& aError)
|
|||
|
||||
if (nsIDocument* doc = GetComposedDoc()) {
|
||||
if (nsIPresShell* shell = doc->GetShell()) {
|
||||
shell->DestroyFramesFor(this);
|
||||
shell->DestroyFramesForAndRestyle(this);
|
||||
MOZ_ASSERT(!shell->FrameManager()->GetDisplayContentsStyleFor(this));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -267,8 +267,7 @@ ShadowRoot::DistributionChanged()
|
|||
return;
|
||||
}
|
||||
|
||||
// FIXME(emilio): Rename this to DestroyFramesForAndRestyle?
|
||||
shell->DestroyFramesFor(host);
|
||||
shell->DestroyFramesForAndRestyle(host);
|
||||
}
|
||||
|
||||
const HTMLContentElement*
|
||||
|
@ -513,7 +512,7 @@ ShadowRoot::AttributeChanged(nsIDocument* aDocument,
|
|||
return;
|
||||
}
|
||||
|
||||
shell->DestroyFramesFor(aElement);
|
||||
shell->DestroyFramesForAndRestyle(aElement);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -126,7 +126,7 @@ public:
|
|||
// since if the binding fetch fails then we don't want to destroy the
|
||||
// frames.
|
||||
if (nsIPresShell* shell = doc->GetShell()) {
|
||||
shell->DestroyFramesFor(mBoundElement->AsElement());
|
||||
shell->DestroyFramesForAndRestyle(mBoundElement->AsElement());
|
||||
}
|
||||
MOZ_ASSERT(!mBoundElement->GetPrimaryFrame());
|
||||
}
|
||||
|
|
|
@ -2922,7 +2922,7 @@ PresShell::CancelAllPendingReflows()
|
|||
}
|
||||
|
||||
void
|
||||
PresShell::DestroyFramesFor(Element* aElement)
|
||||
PresShell::DestroyFramesForAndRestyle(Element* aElement)
|
||||
{
|
||||
MOZ_ASSERT(aElement);
|
||||
NS_ENSURE_TRUE_VOID(mPresContext);
|
||||
|
@ -2940,21 +2940,15 @@ PresShell::DestroyFramesFor(Element* aElement)
|
|||
bool didReconstruct = fc->DestroyFramesFor(aElement);
|
||||
fc->EndUpdate();
|
||||
|
||||
// XXXmats doesn't frame state need to be restored in this case?
|
||||
if (!didReconstruct) {
|
||||
PostRecreateFramesFor(aElement);
|
||||
}
|
||||
auto changeHint = didReconstruct
|
||||
? nsChangeHint(0)
|
||||
: nsChangeHint_ReconstructFrame;
|
||||
|
||||
// NOTE(emilio): This is needed to force also a full subtree restyle for the
|
||||
// content (in Stylo, where the existence of frames != the existence of
|
||||
// styles).
|
||||
//
|
||||
// It's a bit out of place in a function called DestroyFramesFor,
|
||||
// however the two only callers of this code really need this (given they
|
||||
// shuffle the flattened tree around), and this avoids exposing additional
|
||||
// APIs on the pres shell.
|
||||
// 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(
|
||||
aElement, eRestyle_Subtree, nsChangeHint(0));
|
||||
aElement, eRestyle_Subtree, changeHint);
|
||||
|
||||
--mChangeNestCount;
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ public:
|
|||
virtual bool IsSafeToFlush() const override;
|
||||
virtual void DoFlushPendingNotifications(mozilla::FlushType aType) override;
|
||||
virtual void DoFlushPendingNotifications(mozilla::ChangesToFlush aType) override;
|
||||
virtual void DestroyFramesFor(mozilla::dom::Element* aElement) override;
|
||||
virtual void DestroyFramesForAndRestyle(mozilla::dom::Element* aElement) override;
|
||||
|
||||
/**
|
||||
* Post a callback that should be handled after reflow has finished.
|
||||
|
|
|
@ -528,7 +528,7 @@ public:
|
|||
*
|
||||
* 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;
|
||||
|
||||
void PostRecreateFramesFor(mozilla::dom::Element* aElement);
|
||||
void RestyleForAnimation(mozilla::dom::Element* aElement,
|
||||
|
|
Загрузка…
Ссылка в новой задаче