Bug 1482694 - Don't clear the insertion point from ClearInsertedChildren if we're not the insertion point the node is assigned to. r=smaug
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sun, 12 Aug 2018 18:17:48 +0000
changeset 431183 dc6e00ee89a8fcbd48d5d7cc086db7754e0194e5
parent 431182 42d89a7c8813d51aabc059ac2e28a3ab165fbcc7
child 431184 1fc2147d10ddda062eaafde21e141bd278bb9d8a
push id67671
push useremilio@crisal.io
push dateSun, 12 Aug 2018 22:11:21 +0000
treeherderautoland@dc6e00ee89a8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1482694, 1425362
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1482694 - Don't clear the insertion point from ClearInsertedChildren if we're not the insertion point the node is assigned to. r=smaug What's going on is that nested XBL insertion points are completely unsound, and we leave all sorts of kids in mInsertedChildren when bindings dynamically change. So if bindings change in a particular way so that the innermost insertion point is cleared, but the outermost bindings aren't, like this, we end up with an inconsistent flattened tree. This prevents the inconsistent flattened tree in this case, though what ought to happen in the SetXBLInsertionPoint(nullptr) case is setting the insertion point to the outer insertion point. But we don't keep track of all our insertion points, and I don't think it's worth to fix that given XBL is going away unless it gives us more problems. See also bug 1425362 & co. Differential Revision: https://phabricator.services.mozilla.com/D3163
dom/xbl/XBLChildrenElement.h
--- a/dom/xbl/XBLChildrenElement.h
+++ b/dom/xbl/XBLChildrenElement.h
@@ -68,17 +68,19 @@ public:
     // FIXME: Layout should be told about this before clearing
     // mInsertedChildren, this leaves stale styles and frames in the frame tree.
     MaybeSetupDefaultContent();
   }
 
   void ClearInsertedChildren()
   {
     for (auto* child : mInsertedChildren) {
-      child->SetXBLInsertionPoint(nullptr);
+      if (child->GetXBLInsertionPoint() == this) {
+        child->SetXBLInsertionPoint(nullptr);
+      }
     }
     mInsertedChildren.Clear();
 
     // After clearing inserted children, default content
     // will be projected into this insertion point.
     //
     // FIXME: Layout should be told about this before clearing
     // mInsertedChildren, this leaves stale styles and frames in the frame tree.