WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
160864
Shadow DOM: Toggling class in `.class ::slotted(*)` does not trigger style recalc
https://bugs.webkit.org/show_bug.cgi?id=160864
Summary
Shadow DOM: Toggling class in `.class ::slotted(*)` does not trigger style re...
Keanu Lee
Reported
2016-08-15 14:32:52 PDT
Repro:
http://jsbin.com/pureji/2/edit?html,output
If I have this style rule: .class ::slotted(*) { background: green; } Toggling .class does not cause style recalc.
Attachments
patch
(10.04 KB, patch)
2016-11-11 12:18 PST
,
Antti Koivisto
rniwa
: review+
Details
Formatted Diff
Diff
patch for landing
(10.16 KB, patch)
2016-11-11 13:37 PST
,
Antti Koivisto
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Ryosuke Niwa
Comment 1
2016-08-15 22:58:29 PDT
*** This bug has been marked as a duplicate of
bug 160427
***
Antti Koivisto
Comment 2
2016-11-11 11:53:53 PST
This is not a dupe.
Antti Koivisto
Comment 3
2016-11-11 12:18:59 PST
Created
attachment 294518
[details]
patch
Ryosuke Niwa
Comment 4
2016-11-11 12:32:08 PST
Comment on
attachment 294518
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=294518&action=review
> Source/WebCore/css/StyleInvalidationAnalysis.cpp:114 > + m_didInvalidateHostChildren = true;
It seems like we don't need to set m_didInvalidateHostChildren if the slot isn't in a shadow tree? Or is this a kind of optimization to avoid checking whether element is in the shadow tree or not?
> Source/WebCore/css/StyleInvalidationAnalysis.cpp:132 > + if (shouldCheckForSlots) > + return CheckDescendants::Yes;
Don't we need to check the descendants of a 2nd, 3rd, etc... slot elements? i.e. don't we need to check just !m_ruleSet.slottedPseudoElementRules().isEmpty()? Put it another way, does this work if a single shadow root had multiple slots each of which had to be invalidated?
Antti Koivisto
Comment 5
2016-11-11 13:02:52 PST
(In reply to
comment #4
)
> Comment on
attachment 294518
[details]
> patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=294518&action=review
> > > Source/WebCore/css/StyleInvalidationAnalysis.cpp:114 > > + m_didInvalidateHostChildren = true; > > It seems like we don't need to set m_didInvalidateHostChildren if the slot > isn't in a shadow tree? > Or is this a kind of optimization to avoid checking whether element is in > the shadow tree or not?
It is used to avoid O(slots*host children) traversal if there are tons of slots/children.
> Don't we need to check the descendants of a 2nd, 3rd, etc... slot elements? > i.e. don't we need to check just > !m_ruleSet.slottedPseudoElementRules().isEmpty()? > Put it another way, does this work if a single shadow root had multiple slots > each of which had to be invalidated?
It works because we invalidate all host children when we find the first slot. I don't think optimising more is important at this point.
Ryosuke Niwa
Comment 6
2016-11-11 13:08:16 PST
Comment on
attachment 294518
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=294518&action=review
>>> Source/WebCore/css/StyleInvalidationAnalysis.cpp:114 >>> + m_didInvalidateHostChildren = true; >> >> It seems like we don't need to set m_didInvalidateHostChildren if the slot isn't in a shadow tree? >> Or is this a kind of optimization to avoid checking whether element is in the shadow tree or not? > > It is used to avoid O(slots*host children) traversal if there are tons of slots/children.
Might be worth a comment. Otherwise, someone might come around and *fix* it.
> LayoutTests/fast/shadow-dom/css-scoping-host-and-slotted-context-invalidation.html:81 > +
Can we add a test case with multiple slots in a single shadow tree?
Antti Koivisto
Comment 7
2016-11-11 13:37:13 PST
Created
attachment 294528
[details]
patch for landing
WebKit Commit Bot
Comment 8
2016-11-11 14:02:40 PST
Comment on
attachment 294528
[details]
patch for landing Clearing flags on attachment: 294528 Committed
r208610
: <
http://trac.webkit.org/changeset/208610
>
WebKit Commit Bot
Comment 9
2016-11-11 14:02:45 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 10
2016-11-11 14:40:31 PST
<
rdar://problem/29226652
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug