summaryrefslogtreecommitdiffstats
path: root/layout/base/nsPresShell.cpp
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-04-17 06:14:10 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-04-17 06:14:10 -0400
commite482e335bb8de6630a171cd0a784b420d91106b2 (patch)
tree70d27fa03ec0624a04e3418fb20ac1a434dcc3e5 /layout/base/nsPresShell.cpp
parentf4a1d0123c41647f2f05aeaa2ae14bd1806fbb5c (diff)
downloadUXP-e482e335bb8de6630a171cd0a784b420d91106b2.tar
UXP-e482e335bb8de6630a171cd0a784b420d91106b2.tar.gz
UXP-e482e335bb8de6630a171cd0a784b420d91106b2.tar.lz
UXP-e482e335bb8de6630a171cd0a784b420d91106b2.tar.xz
UXP-e482e335bb8de6630a171cd0a784b420d91106b2.zip
Bug 1389743 - Only reconstruct frames synchronously from ContentRemoved when called from frame construction
Tag #1375
Diffstat (limited to 'layout/base/nsPresShell.cpp')
-rw-r--r--layout/base/nsPresShell.cpp44
1 files changed, 9 insertions, 35 deletions
diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp
index 0839f6bb7..f861e7b06 100644
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -2828,10 +2828,9 @@ PresShell::CancelAllPendingReflows()
}
void
-PresShell::DestroyFramesFor(nsIContent* aContent,
- nsIContent** aDestroyedFramesFor)
+PresShell::DestroyFramesFor(Element* aElement)
{
- MOZ_ASSERT(aContent);
+ MOZ_ASSERT(aElement);
NS_ENSURE_TRUE_VOID(mPresContext);
if (!mDidInitialize) {
return;
@@ -2843,43 +2842,18 @@ PresShell::DestroyFramesFor(nsIContent* aContent,
++mChangeNestCount;
nsCSSFrameConstructor* fc = FrameConstructor();
+ bool didReconstruct;
fc->BeginUpdate();
- fc->DestroyFramesFor(aContent, aDestroyedFramesFor);
+ fc->DestroyFramesFor(aElement, &didReconstruct);
fc->EndUpdate();
- --mChangeNestCount;
-}
-
-void
-PresShell::CreateFramesFor(nsIContent* aContent)
-{
- NS_ENSURE_TRUE_VOID(mPresContext);
- if (!mDidInitialize) {
- // Nothing to do here. In fact, if we proceed and aContent is the
- // root we will crash.
- return;
+ // XXXmats doesn't frame state need to be restored in this case?
+ if (!didReconstruct) {
+ PostRecreateFramesFor(aElement);
}
- // Don't call RecreateFramesForContent since that is not exported and we want
- // to keep the number of entrypoints down.
-
- NS_ASSERTION(mViewManager, "Should have view manager");
- MOZ_ASSERT(aContent);
-
- // Have to make sure that the content notifications are flushed before we
- // start messing with the frame model; otherwise we can get content doubling.
- mDocument->FlushPendingNotifications(Flush_ContentAndNotify);
-
- nsAutoScriptBlocker scriptBlocker;
-
- // Mark ourselves as not safe to flush while we're doing frame construction.
- ++mChangeNestCount;
-
- nsCSSFrameConstructor* fc = FrameConstructor();
- nsILayoutHistoryState* layoutState = fc->GetLastCapturedLayoutHistoryState();
- fc->BeginUpdate();
- fc->ContentInserted(aContent->GetParent(), aContent, layoutState, false);
- fc->EndUpdate();
+ mPresContext->RestyleManager()->PostRestyleEvent(
+ aElement, eRestyle_Subtree, nsChangeHint(0));
--mChangeNestCount;
}