Changeset 208610 in webkit
- Timestamp:
- Nov 11, 2016 1:59:33 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r208606 r208610 1 2016-11-11 Antti Koivisto <antti@apple.com> 2 3 Shadow DOM: Toggling class in `.class ::slotted(*)` does not trigger style recalc 4 https://bugs.webkit.org/show_bug.cgi?id=160864 5 6 Reviewed by Ryosuke Niwa. 7 8 * fast/shadow-dom/css-scoping-host-and-slotted-context-invalidation-expected.html: Added. 9 * fast/shadow-dom/css-scoping-host-and-slotted-context-invalidation.html: Added. 10 1 11 2016-11-11 Eric Carlson <eric.carlson@apple.com> 2 12 … … 1201 1211 * fast/shadow-dom/css-scoping-slot-with-id-expected.html: Added. 1202 1212 * fast/shadow-dom/css-scoping-slot-with-id.html: Added. 1213 1203 1214 1204 1215 2016-11-04 Brady Eidson <beidson@apple.com> -
trunk/Source/WebCore/ChangeLog
r208609 r208610 1 2016-11-11 Antti Koivisto <antti@apple.com> 2 3 Shadow DOM: Toggling class in `.class ::slotted(*)` does not trigger style recalc 4 https://bugs.webkit.org/show_bug.cgi?id=160864 5 6 Reviewed by Ryosuke Niwa. 7 8 Also fix similar issue with ::host 9 10 Test: fast/shadow-dom/css-scoping-host-and-slotted-context-invalidation.html 11 12 * css/StyleInvalidationAnalysis.cpp: 13 (WebCore::StyleInvalidationAnalysis::invalidateIfNeeded): 14 15 If we have ::slotted rules and encounter a <slot>, invalidate the slotted host children. 16 17 (WebCore::StyleInvalidationAnalysis::invalidateStyle): 18 19 Invalidate the shadow host if we have ::host rules. 20 21 * css/StyleInvalidationAnalysis.h: 22 * dom/InlineStyleSheetOwner.cpp: 23 (WebCore::InlineStyleSheetOwner::createSheet): 24 25 Fix a bug where it was possible to mutate stylesheets in the inline stylesheet cache. 26 The included test covers this. 27 28 * style/StyleScope.cpp: 29 (WebCore::Style::Scope::updateActiveStyleSheets): 30 31 Handle the full invalidation case. 32 1 33 2016-11-11 Brady Eidson <beidson@apple.com> 2 34 -
trunk/Source/WebCore/css/StyleInvalidationAnalysis.cpp
r207458 r208610 31 31 #include "ElementIterator.h" 32 32 #include "ElementRuleCollector.h" 33 #include "HTMLSlotElement.h" 33 34 #include "SelectorFilter.h" 34 35 #include "ShadowRoot.h" … … 104 105 } 105 106 107 bool shouldCheckForSlots = !m_ruleSet.slottedPseudoElementRules().isEmpty() && !m_didInvalidateHostChildren; 108 if (shouldCheckForSlots && is<HTMLSlotElement>(element)) { 109 auto* containingShadowRoot = element.containingShadowRoot(); 110 if (containingShadowRoot && containingShadowRoot->host()) { 111 for (auto& possiblySlotted : childrenOfType<Element>(*containingShadowRoot->host())) 112 possiblySlotted.invalidateStyle(); 113 } 114 // No need to do this again. 115 m_didInvalidateHostChildren = true; 116 } 117 106 118 switch (element.styleValidity()) { 107 119 case Style::Validity::Valid: { … … 118 130 case Style::Validity::SubtreeInvalid: 119 131 case Style::Validity::SubtreeAndRenderersInvalid: 132 if (shouldCheckForSlots) 133 return CheckDescendants::Yes; 120 134 return CheckDescendants::No; 121 135 } … … 173 187 ASSERT(!m_dirtiesAllStyle); 174 188 189 if (!m_ruleSet.hostPseudoClassRules().isEmpty() && shadowRoot.host()) 190 shadowRoot.host()->invalidateStyle(); 191 175 192 for (auto& child : childrenOfType<Element>(shadowRoot)) { 176 193 SelectorFilter filter; -
trunk/Source/WebCore/css/StyleInvalidationAnalysis.h
r206990 r208610 59 59 bool m_dirtiesAllStyle { false }; 60 60 bool m_hasShadowPseudoElementRulesInAuthorSheet { false }; 61 bool m_didInvalidateHostChildren { false }; 61 62 }; 62 63 -
trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp
r208001 r208610 214 214 215 215 if (cacheKey && contents->isCacheable()) { 216 m_sheet->contents().addedToMemoryCache(); 216 217 inlineStyleSheetCache().add(*cacheKey, &m_sheet->contents()); 217 218 218 219 // Prevent pathological growth. 219 220 const size_t maximumInlineStyleSheetCacheSize = 50; 220 if (inlineStyleSheetCache().size() > maximumInlineStyleSheetCacheSize) 221 if (inlineStyleSheetCache().size() > maximumInlineStyleSheetCacheSize) { 222 inlineStyleSheetCache().begin()->value->removedFromMemoryCache(); 221 223 inlineStyleSheetCache().remove(inlineStyleSheetCache().begin()); 224 } 222 225 } 223 226 } -
trunk/Source/WebCore/style/StyleScope.cpp
r208001 r208610 408 408 } 409 409 410 // FIXME: Move this code somewhere else. 410 411 if (requiresFullStyleRecalc) { 411 412 if (m_shadowRoot) { 412 413 for (auto& shadowChild : childrenOfType<Element>(*m_shadowRoot)) 413 414 shadowChild.invalidateStyleForSubtree(); 415 if (m_shadowRoot->host()) { 416 if (!resolver().ruleSets().authorStyle().hostPseudoClassRules().isEmpty()) 417 m_shadowRoot->host()->invalidateStyle(); 418 if (!resolver().ruleSets().authorStyle().slottedPseudoElementRules().isEmpty()) { 419 for (auto& shadowChild : childrenOfType<Element>(*m_shadowRoot->host())) 420 shadowChild.invalidateStyle(); 421 } 422 } 414 423 } else 415 424 m_document.scheduleForcedStyleRecalc();
Note: See TracChangeset
for help on using the changeset viewer.