Make ShadowRoot not be a mutation observer of its host.
Categories
(Core :: DOM: Core & HTML, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox70 | --- | fixed |
People
(Reporter: emilio, Assigned: emilio)
References
Details
Attachments
(3 files)
Instead, do the state tracking from UnbindFromTree / BindFromTree / AfterSetAttr.
Explanation for that incoming.
Assignee | ||
Comment 1•5 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=5abe517c45601b96a178fe119eaf522dc18b579b
(Ignore all the fission orange which is not my fault)
Assignee | ||
Comment 2•5 years ago
|
||
Assignee | ||
Comment 3•5 years ago
|
||
This was in preparation to implement CSS Shadow Parts, where I'm going to need
to keep track of all the parts in the shadow tree.
Unlike slotted children (which can only be direct children of the host), parts
can be anywhere in the shadow tree.
That means that the regular nsIMutationObserver notifications don't quite cut
it, since we'd need notified only of subtree roots and we'd need to tree-walk
around in order to figure out if we have any new part.
As a preparation to make the ShadowRoot keep track of which parts does it have,
and given that the checks are quite similar, I wanted to move the shadow-DOM
related checks to work in BindToTree / UnbindFromTree instead, so they remain
all together.
The AttributeChanged notifications could just work as-is for part too, though
I've moved them to Element::AfterSetAttr just for consistency. It adds a
null-check in a somewhat hot part of the code, but I think it should be ok, and
for the case shadow DOM is used it'll be much faster.
However, as part of writing this patch, I realized that I wasn't going to be
able to share as much code as I wanted, really.
This penalizes a bit non-shadow-DOM content, in exchange of making Shadow DOM
slightly faster as well. So not sure where the bar is or whether we should take
this patch.
Depends on D32638
Assignee | ||
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/849ba4e85044 Some miscellaneous cleanups while I was going through this code. r=edgar
Comment 5•5 years ago
|
||
bugherder |
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 6•5 years ago
|
||
After addressing review comments in the other patch of this bug, debug builds
assert all the time here when called from UnbindFromTree() on an already-unbound
subtree.
We clear the binding parent on unbind, so this is only guaranteed to match for
connected nodes, as far as I can tell.
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2a619224d379 Don't use nsIMutationObserver for ShadowRoot. r=smaug https://hg.mozilla.org/integration/autoland/rev/43e96d742919 Fix an assertion that starts firing with the previous patch after addressing review feedback. r=smaug
Comment 8•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/2a619224d379
https://hg.mozilla.org/mozilla-central/rev/43e96d742919
Pushed by emilio@crisal.io: https://hg.mozilla.org/integration/autoland/rev/73353f375d1d followup: Add a null-check since XBL can call into UnbindFromTree at odd times. a=Aryx,btara
Comment 10•5 years ago
|
||
bugherder |
Description
•