summaryrefslogtreecommitdiff
path: root/dom
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 /dom
parentf4a1d0123c41647f2f05aeaa2ae14bd1806fbb5c (diff)
downloaduxp-e482e335bb8de6630a171cd0a784b420d91106b2.tar.gz
Bug 1389743 - Only reconstruct frames synchronously from ContentRemoved when called from frame construction
Tag #1375
Diffstat (limited to 'dom')
-rw-r--r--dom/base/Element.cpp19
-rw-r--r--dom/xbl/nsXBLService.cpp32
2 files changed, 5 insertions, 46 deletions
diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp
index 31af0c1db4..a2b78092ad 100644
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -1112,12 +1112,9 @@ Element::CreateShadowRoot(ErrorResult& aError)
return nullptr;
}
- nsIDocument* doc = GetComposedDoc();
- nsIContent* destroyedFramesFor = nullptr;
- if (doc) {
- nsIPresShell* shell = doc->GetShell();
- if (shell) {
- shell->DestroyFramesFor(this, &destroyedFramesFor);
+ if (nsIDocument* doc = GetComposedDoc()) {
+ if (nsIPresShell* shell = doc->GetShell()) {
+ shell->DestroyFramesFor(this);
MOZ_ASSERT(!shell->FrameManager()->GetDisplayContentsStyleFor(this));
}
}
@@ -1160,16 +1157,6 @@ Element::CreateShadowRoot(ErrorResult& aError)
SetXBLBinding(xblBinding);
- // Recreate the frame for the bound content because binding a ShadowRoot
- // changes how things are rendered.
- if (doc) {
- MOZ_ASSERT(doc == GetComposedDoc());
- nsIPresShell* shell = doc->GetShell();
- if (shell) {
- shell->CreateFramesFor(destroyedFramesFor);
- }
- }
-
return shadowRoot.forget();
}
diff --git a/dom/xbl/nsXBLService.cpp b/dom/xbl/nsXBLService.cpp
index 3f98eefe0d..ef0d205643 100644
--- a/dom/xbl/nsXBLService.cpp
+++ b/dom/xbl/nsXBLService.cpp
@@ -124,38 +124,10 @@ public:
// 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.
- nsIContent* destroyedFramesFor = nullptr;
- nsIPresShell* shell = doc->GetShell();
- if (shell) {
- shell->DestroyFramesFor(mBoundElement, &destroyedFramesFor);
+ if (nsIPresShell* shell = doc->GetShell()) {
+ shell->DestroyFramesFor(mBoundElement->AsElement());
}
MOZ_ASSERT(!mBoundElement->GetPrimaryFrame());
-
- // If |mBoundElement| is (in addition to having binding |mBinding|)
- // also a descendant of another element with binding |mBinding|,
- // then we might have just constructed it due to the
- // notification of its parent. (We can know about both if the
- // binding loads were triggered from the DOM rather than frame
- // construction.) So we have to check both whether the element
- // has a primary frame and whether it's in the frame manager maps
- // before sending a ContentInserted notification, or bad things
- // will happen.
- MOZ_ASSERT(shell == doc->GetShell());
- if (shell) {
- nsIFrame* childFrame = mBoundElement->GetPrimaryFrame();
- if (!childFrame) {
- // Check to see if it's in the undisplayed content map...
- nsFrameManager* fm = shell->FrameManager();
- nsStyleContext* sc = fm->GetUndisplayedContent(mBoundElement);
- if (!sc) {
- // or in the display:contents map.
- sc = fm->GetDisplayContentsStyleFor(mBoundElement);
- }
- if (!sc) {
- shell->CreateFramesFor(destroyedFramesFor);
- }
- }
- }
}
nsXBLBindingRequest(nsIURI* aURI, nsIContent* aBoundElement)