Changeset 202227 in webkit
- Timestamp:
- Jun 20, 2016, 1:52:10 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r202223 r202227 1 2016-06-19 Antti Koivisto <antti@apple.com> 2 3 Updating class name of a shadow host does not update the style applied by :host() 4 https://bugs.webkit.org/show_bug.cgi?id=158900 5 <rdar://problem/26883707> 6 7 Reviewed by Simon Fraser. 8 9 * fast/shadow-dom/shadow-host-style-update-expected.html: Added. 10 * fast/shadow-dom/shadow-host-style-update.html: Added. 11 1 12 2016-06-19 Alexey Proskuryakov <ap@apple.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r202218 r202227 1 2016-06-19 Antti Koivisto <antti@apple.com> 2 3 Updating class name of a shadow host does not update the style applied by :host() 4 https://bugs.webkit.org/show_bug.cgi?id=158900 5 <rdar://problem/26883707> 6 7 Reviewed by Simon Fraser. 8 9 Test: fast/shadow-dom/shadow-host-style-update.html 10 11 Teach style invalidation optimization code about :host. 12 13 * style/AttributeChangeInvalidation.cpp: 14 (WebCore::Style::mayBeAffectedByHostStyle): 15 (WebCore::Style::AttributeChangeInvalidation::invalidateStyle): 16 * style/ClassChangeInvalidation.cpp: 17 (WebCore::Style::computeClassChange): 18 (WebCore::Style::mayBeAffectedByHostStyle): 19 (WebCore::Style::ClassChangeInvalidation::invalidateStyle): 20 * style/IdChangeInvalidation.cpp: 21 (WebCore::Style::mayBeAffectedByHostStyle): 22 (WebCore::Style::IdChangeInvalidation::invalidateStyle): 23 1 24 2016-06-19 Gavin & Ellie Barraclough <barraclough@apple.com> 2 25 -
trunk/Source/WebCore/style/AttributeChangeInvalidation.cpp
r196629 r202227 29 29 #include "DocumentRuleSets.h" 30 30 #include "ElementIterator.h" 31 #include "ShadowRoot.h" 31 32 #include "StyleInvalidationAnalysis.h" 32 33 #include "StyleResolver.h" … … 34 35 namespace WebCore { 35 36 namespace Style { 37 38 static bool mayBeAffectedByHostStyle(ShadowRoot& shadowRoot, bool isHTML, const QualifiedName& attributeName) 39 { 40 auto& shadowRuleSets = shadowRoot.styleResolver().ruleSets(); 41 if (shadowRuleSets.authorStyle()->hostPseudoClassRules().isEmpty()) 42 return false; 43 44 auto& nameSet = isHTML ? shadowRuleSets.features().attributeCanonicalLocalNamesInRules : shadowRuleSets.features().attributeLocalNamesInRules; 45 return nameSet.contains(attributeName.localName().impl()); 46 } 36 47 37 48 void AttributeChangeInvalidation::invalidateStyle(const QualifiedName& attributeName, const AtomicString& oldValue, const AtomicString& newValue) … … 44 55 45 56 auto& nameSet = isHTML ? ruleSets.features().attributeCanonicalLocalNamesInRules : ruleSets.features().attributeLocalNamesInRules; 46 bool shouldInvalidate = nameSet.contains(attributeName.localName().impl()); 47 if (!shouldInvalidate) 57 bool mayAffectStyle = nameSet.contains(attributeName.localName().impl()); 58 59 auto* shadowRoot = m_element.shadowRoot(); 60 if (!mayAffectStyle && shadowRoot && mayBeAffectedByHostStyle(*shadowRoot, isHTML, attributeName)) 61 mayAffectStyle = true; 62 63 if (!mayAffectStyle) 48 64 return; 49 65 -
trunk/Source/WebCore/style/ClassChangeInvalidation.cpp
r202167 r202227 29 29 #include "DocumentRuleSets.h" 30 30 #include "ElementChildIterator.h" 31 #include "ShadowRoot.h" 31 32 #include "SpaceSplitString.h" 32 33 #include "StyleInvalidationAnalysis.h" … … 85 86 } 86 87 88 static bool mayBeAffectedByHostStyle(ShadowRoot& shadowRoot, AtomicStringImpl* changedClass) 89 { 90 auto& shadowRuleSets = shadowRoot.styleResolver().ruleSets(); 91 if (shadowRuleSets.authorStyle()->hostPseudoClassRules().isEmpty()) 92 return false; 93 return shadowRuleSets.features().classesInRules.contains(changedClass); 94 } 95 87 96 void ClassChangeInvalidation::invalidateStyle(const SpaceSplitString& oldClasses, const SpaceSplitString& newClasses) 88 97 { … … 90 99 91 100 auto& ruleSets = m_element.styleResolver().ruleSets(); 101 auto* shadowRoot = m_element.shadowRoot(); 92 102 93 103 ClassChangeVector changedClassesAffectingStyle; 94 104 for (auto* changedClass : changedClasses) { 95 if (ruleSets.features().classesInRules.contains(changedClass)) 105 bool mayAffectStyle = ruleSets.features().classesInRules.contains(changedClass); 106 107 if (!mayAffectStyle && shadowRoot && mayBeAffectedByHostStyle(*shadowRoot, changedClass)) 108 mayAffectStyle = true; 109 110 if (mayAffectStyle) 96 111 changedClassesAffectingStyle.append(changedClass); 97 112 }; … … 100 115 return; 101 116 102 if ( m_element.shadowRoot()&& ruleSets.authorStyle()->hasShadowPseudoElementRules()) {117 if (shadowRoot && ruleSets.authorStyle()->hasShadowPseudoElementRules()) { 103 118 m_element.setNeedsStyleRecalc(FullStyleChange); 104 119 return; -
trunk/Source/WebCore/style/IdChangeInvalidation.cpp
r196636 r202227 29 29 #include "DocumentRuleSets.h" 30 30 #include "ElementChildIterator.h" 31 #include "ShadowRoot.h" 31 32 #include "StyleResolver.h" 32 33 33 34 namespace WebCore { 34 35 namespace Style { 36 37 static bool mayBeAffectedByHostStyle(ShadowRoot& shadowRoot, const AtomicString& changedId) 38 { 39 auto& shadowRuleSets = shadowRoot.styleResolver().ruleSets(); 40 if (shadowRuleSets.authorStyle()->hostPseudoClassRules().isEmpty()) 41 return false; 42 43 return shadowRuleSets.features().idsInRules.contains(changedId.impl()); 44 } 35 45 36 46 void IdChangeInvalidation::invalidateStyle(const AtomicString& changedId) … … 42 52 43 53 bool mayAffectStyle = ruleSets.features().idsInRules.contains(changedId.impl()); 54 55 auto* shadowRoot = m_element.shadowRoot(); 56 if (!mayAffectStyle && shadowRoot && mayBeAffectedByHostStyle(*shadowRoot, changedId)) 57 mayAffectStyle = true; 58 44 59 if (!mayAffectStyle) 45 60 return;
Note:
See TracChangeset
for help on using the changeset viewer.