Closed Bug 1410895 Opened 2 years ago Closed 2 years ago

Make XBL know about its insertion point, not insertion point parent.


(Core :: DOM: Core & HTML, enhancement)

Not set



Tracking Status
firefox58 --- fixed


(Reporter: emilio, Assigned: emilio)


(Blocks 1 open bug)



(2 files)

That way we can know which insertion point to look up for distributed siblings.
Comment on attachment 8921059 [details]
Bug 1410895: Make XBL slots hold the insertion point, not the XBL parent.

::: dom/xbl/nsBindingManager.cpp:222
(Diff revision 2)
>      }
>      aContent->SetXBLBinding(nullptr, this);
>    }
>    // Clear out insertion parent and content lists.


::: dom/xbl/nsXBLBinding.cpp:804
(Diff revision 2)
> -      UpdateInsertionParent(mInsertionPoints[i], mBoundElement);
> -    }
> -
> -    // Now that our inserted children no longer think they're inserted
> -    // anywhere, make sure our internal state reflects that as well.
>      ClearInsertionPoints();

It looks like when this code was added (<>) calling ClearInsertionPoints() just cleared the child arrays on the insertion points and did not update the insertion point on the elements inside those insertion points.  Which is why this code had to do the updating.

It also looks like <> changed the behavior to have XBLChildrenElement::ClearInsertedChildren clear out the insertion parent unconditionally on the kids.  It did NOT use the same logic as UpdateInsertionParent, though: it just always set to null instead of sometimes setting to the bound element itself.  After this, the UpdateInsertionParent calls are in fact redundant...
Attachment #8921059 - Flags: review?(bzbarsky) → review+
Blake, do you know what the story was with the changes I mention in comment 4?  Why do we not need to preserve the "correct" insertion parent?
Flags: needinfo?(mrbkap)
Comment on attachment 8921066 [details]
Bug 1410895: Multiple cleanups on top.
Attachment #8921066 - Flags: review?(bzbarsky) → review+
Pushed by
Make XBL slots hold the insertion point, not the XBL parent. r=bz
Multiple cleanups on top. r=bz
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
I can't remember why that code was there. I've done some spelunking in the history but nothing jumped out at me. Sorry.
Flags: needinfo?(mrbkap)
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.