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.
*** This bug has been marked as a duplicate of bug 160427 ***
This is not a dupe.
Created attachment 294518 [details] patch
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?
(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.
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?
Created attachment 294528 [details] patch for landing
Comment on attachment 294528 [details] patch for landing Clearing flags on attachment: 294528 Committed r208610: <http://trac.webkit.org/changeset/208610>
All reviewed patches have been landed. Closing bug.
<rdar://problem/29226652>