Changeset 196636 in webkit
- Timestamp:
- Feb 16, 2016 9:24:01 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r196635 r196636 1 2016-02-16 Antti Koivisto <antti@apple.com> 2 3 Factor id mutation style invalidation code into a class 4 https://bugs.webkit.org/show_bug.cgi?id=154287 5 6 Reviewed by Andreas Kling. 7 8 * fast/css/style-invalidation-id-change-descendants-expected.txt: Added. 9 * fast/css/style-invalidation-id-change-descendants.html: Added. 10 1 11 2016-02-16 Ryan Haddad <ryanhaddad@apple.com> 2 12 -
trunk/LayoutTests/fast/css/style-invalidation-attribute-change-descendants-expected.txt
r196629 r196636 1 Test that we invalidate the element subtree minimally on classattribute change1 Test that we invalidate the element subtree minimally on attribute change 2 2 3 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -
trunk/LayoutTests/fast/css/style-invalidation-attribute-change-descendants.html
r196629 r196636 77 77 <script> 78 78 79 description('Test that we invalidate the element subtree minimally on classattribute change');79 description('Test that we invalidate the element subtree minimally on attribute change'); 80 80 81 81 function testStyleChangeType(tag, type) -
trunk/Source/WebCore/CMakeLists.txt
r196629 r196636 2633 2633 style/AttributeChangeInvalidation.cpp 2634 2634 style/ClassChangeInvalidation.cpp 2635 style/IdChangeInvalidation.cpp 2635 2636 style/InlineTextBoxStyle.cpp 2636 2637 style/RenderTreePosition.cpp -
trunk/Source/WebCore/ChangeLog
r196633 r196636 1 2016-02-16 Antti Koivisto <antti@apple.com> 2 3 Factor id mutation style invalidation code into a class 4 https://bugs.webkit.org/show_bug.cgi?id=154287 5 6 Reviewed by Andreas Kling. 7 8 Also add a cheap basic optimization that avoids descendant invalidation if they can not be affected. 9 10 It would be easy to implement fine grained invalidation like with classes and attribute selectors. 11 However dynamic id changes are not common enough (nor recommended) to pay the memory cost of 12 the required data structures. 13 14 Test: fast/css/style-invalidation-id-change-descendants.html 15 16 * CMakeLists.txt: 17 * WebCore.vcxproj/WebCore.vcxproj: 18 * WebCore.xcodeproj/project.pbxproj: 19 * css/RuleFeature.cpp: 20 (WebCore::RuleFeatureSet::recursivelyCollectFeaturesFromSelector): 21 (WebCore::RuleFeatureSet::add): 22 (WebCore::RuleFeatureSet::clear): 23 * css/RuleFeature.h: 24 * dom/Element.cpp: 25 (WebCore::makeIdForStyleResolution): 26 (WebCore::Element::attributeChanged): 27 (WebCore::checkNeedsStyleInvalidationForIdChange): Deleted. 28 * style/IdChangeInvalidation.cpp: Added. 29 (WebCore::Style::IdChangeInvalidation::invalidateStyle): 30 * style/IdChangeInvalidation.h: Added. 31 (WebCore::Style::IdChangeInvalidation::IdChangeInvalidation): 32 (WebCore::Style::IdChangeInvalidation::~IdChangeInvalidation): 33 1 34 2016-02-16 Andreas Kling <akling@apple.com> 2 35 -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
r196629 r196636 19298 19298 <ClCompile Include="..\style\AttributeChangeInvalidation.cpp" /> 19299 19299 <ClCompile Include="..\style\ClassChangeInvalidation.cpp" /> 19300 <ClCompile Include="..\style\IdChangeInvalidation.cpp" /> 19300 19301 <ClCompile Include="..\style\InlineTextBoxStyle.cpp" /> 19301 19302 <ClCompile Include="..\style\RenderTreePosition.cpp" /> … … 22869 22870 <ClInclude Include="..\style\AttributeChangeInvalidation.h" /> 22870 22871 <ClInclude Include="..\style\ClassChangeInvalidation.h" /> 22872 <ClInclude Include="..\style\IdChangeInvalidation.h" /> 22871 22873 <ClInclude Include="..\style\InlineTextBoxStyle.h" /> 22872 22874 <ClInclude Include="..\style\RenderTreePosition.h" /> -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r196629 r196636 6640 6640 E4A814D81C70E10500BF85AC /* AttributeChangeInvalidation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4A814D71C70E10500BF85AC /* AttributeChangeInvalidation.cpp */; }; 6641 6641 E4A814DA1C70E10D00BF85AC /* AttributeChangeInvalidation.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A814D91C70E10D00BF85AC /* AttributeChangeInvalidation.h */; }; 6642 E4A814DE1C7338D100BF85AC /* IdChangeInvalidation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4A814DD1C7338D100BF85AC /* IdChangeInvalidation.cpp */; }; 6643 E4A814E01C7338EB00BF85AC /* IdChangeInvalidation.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A814DF1C7338EB00BF85AC /* IdChangeInvalidation.h */; }; 6642 6644 E4AE7C1617D1BB950009FB31 /* ElementIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AE7C1517D1BB950009FB31 /* ElementIterator.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6643 6645 E4AE7C1A17D232350009FB31 /* ElementAncestorIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AE7C1917D232350009FB31 /* ElementAncestorIterator.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 10549 10551 83D35AEA1C7187ED00F70D5A /* XMLHttpRequestEventTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLHttpRequestEventTarget.h; sourceTree = "<group>"; }; 10550 10552 83D35AEB1C7187ED00F70D5A /* XMLHttpRequestEventTarget.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XMLHttpRequestEventTarget.idl; sourceTree = "<group>"; }; 10551 83D35AEF1C718D8400F70D5A /* JSXMLHttpRequestEventTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSXMLHttpRequestEventTarget.cpp;path = JSXMLHttpRequestEventTarget.cpp; sourceTree = "<group>"; };10552 83D35AF01C718D8400F70D5A /* JSXMLHttpRequestEventTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSXMLHttpRequestEventTarget.h;path = JSXMLHttpRequestEventTarget.h; sourceTree = "<group>"; };10553 83D35AEF1C718D8400F70D5A /* JSXMLHttpRequestEventTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLHttpRequestEventTarget.cpp; sourceTree = "<group>"; }; 10554 83D35AF01C718D8400F70D5A /* JSXMLHttpRequestEventTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSXMLHttpRequestEventTarget.h; sourceTree = "<group>"; }; 10553 10555 83E359A01BB1031D002CEB98 /* JSHTMLTimeElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLTimeElement.h; sourceTree = "<group>"; }; 10554 10556 83E359A11BB1031D002CEB98 /* JSHTMLTimeElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLTimeElement.cpp; sourceTree = "<group>"; }; … … 14648 14650 E4A814D71C70E10500BF85AC /* AttributeChangeInvalidation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AttributeChangeInvalidation.cpp; sourceTree = "<group>"; }; 14649 14651 E4A814D91C70E10D00BF85AC /* AttributeChangeInvalidation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AttributeChangeInvalidation.h; sourceTree = "<group>"; }; 14652 E4A814DD1C7338D100BF85AC /* IdChangeInvalidation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IdChangeInvalidation.cpp; sourceTree = "<group>"; }; 14653 E4A814DF1C7338EB00BF85AC /* IdChangeInvalidation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdChangeInvalidation.h; sourceTree = "<group>"; }; 14650 14654 E4AE7C1517D1BB950009FB31 /* ElementIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementIterator.h; sourceTree = "<group>"; }; 14651 14655 E4AE7C1917D232350009FB31 /* ElementAncestorIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementAncestorIterator.h; sourceTree = "<group>"; }; … … 23442 23446 E4A814D51C6DEE8D00BF85AC /* ClassChangeInvalidation.cpp */, 23443 23447 E4A814D31C6DEC4000BF85AC /* ClassChangeInvalidation.h */, 23448 E4A814DD1C7338D100BF85AC /* IdChangeInvalidation.cpp */, 23449 E4A814DF1C7338EB00BF85AC /* IdChangeInvalidation.h */, 23444 23450 1C0106FE192594DF008A4201 /* InlineTextBoxStyle.cpp */, 23445 23451 1C0106FF192594DF008A4201 /* InlineTextBoxStyle.h */, … … 27867 27873 E401E0A41C3C0B8300F34D10 /* StyleChange.h in Headers */, 27868 27874 9DAC7C571AF2CB6400437C44 /* StyleContentAlignmentData.h in Headers */, 27875 E4A814E01C7338EB00BF85AC /* IdChangeInvalidation.h in Headers */, 27869 27876 BC779E171BB227CA00CAA8BF /* StyleCustomPropertyData.h in Headers */, 27870 27877 BC5EB67F0E81D4A700B25965 /* StyleDashboardRegion.h in Headers */, … … 30488 30495 B2FA3D5C0AB75A6F000E5AC4 /* JSSVGColor.cpp in Sources */, 30489 30496 B2FA3D5E0AB75A6F000E5AC4 /* JSSVGComponentTransferFunctionElement.cpp in Sources */, 30497 E4A814DE1C7338D100BF85AC /* IdChangeInvalidation.cpp in Sources */, 30490 30498 B2FA3D600AB75A6F000E5AC4 /* JSSVGCursorElement.cpp in Sources */, 30491 30499 B2FA3D620AB75A6F000E5AC4 /* JSSVGDefsElement.cpp in Sources */, -
trunk/Source/WebCore/css/RuleFeature.cpp
r196629 r196636 40 40 const CSSSelector* selector = &firstSelector; 41 41 do { 42 if (selector->match() == CSSSelector::Id) 42 if (selector->match() == CSSSelector::Id) { 43 43 idsInRules.add(selector->value().impl()); 44 else if (selector->match() == CSSSelector::Class) { 44 if (matchesAncestor) 45 idsMatchingAncestorsInRules.add(selector->value().impl()); 46 } else if (selector->match() == CSSSelector::Class) { 45 47 classesInRules.add(selector->value().impl()); 46 48 if (matchesAncestor) … … 119 121 { 120 122 idsInRules.add(other.idsInRules.begin(), other.idsInRules.end()); 123 idsMatchingAncestorsInRules.add(other.idsMatchingAncestorsInRules.begin(), other.idsMatchingAncestorsInRules.end()); 121 124 classesInRules.add(other.classesInRules.begin(), other.classesInRules.end()); 122 125 attributeCanonicalLocalNamesInRules.add(other.attributeCanonicalLocalNamesInRules.begin(), other.attributeCanonicalLocalNamesInRules.end()); … … 147 150 { 148 151 idsInRules.clear(); 152 idsMatchingAncestorsInRules.clear(); 149 153 classesInRules.clear(); 150 154 attributeCanonicalLocalNamesInRules.clear(); -
trunk/Source/WebCore/css/RuleFeature.h
r196629 r196636 53 53 54 54 HashSet<AtomicStringImpl*> idsInRules; 55 HashSet<AtomicStringImpl*> idsMatchingAncestorsInRules; 55 56 HashSet<AtomicStringImpl*> classesInRules; 56 57 HashSet<AtomicStringImpl*> attributeCanonicalLocalNamesInRules; -
trunk/Source/WebCore/dom/Element.cpp
r196629 r196636 58 58 #include "HTMLSelectElement.h" 59 59 #include "HTMLTemplateElement.h" 60 #include "IdChangeInvalidation.h" 60 61 #include "IdTargetObserverRegistry.h" 61 62 #include "KeyboardEvent.h" … … 1217 1218 } 1218 1219 1219 static bool checkNeedsStyleInvalidationForIdChange(const AtomicString& oldId, const AtomicString& newId, StyleResolver* styleResolver)1220 {1221 ASSERT(newId != oldId);1222 if (!oldId.isEmpty() && styleResolver->hasSelectorForId(oldId))1223 return true;1224 if (!newId.isEmpty() && styleResolver->hasSelectorForId(newId))1225 return true;1226 return false;1227 }1228 1229 1220 void Element::attributeChanged(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& newValue, AttributeModificationReason) 1230 1221 { 1231 1222 bool valueIsSameAsBefore = oldValue == newValue; 1232 1233 StyleResolver* styleResolver = document().styleResolverIfExists();1234 bool testShouldInvalidateStyle = inRenderedDocument() && styleResolver && styleChangeType() < FullStyleChange;1235 1236 bool shouldInvalidateStyle = false;1237 1223 1238 1224 if (!valueIsSameAsBefore) { … … 1246 1232 AtomicString newId = makeIdForStyleResolution(newValue, document().inQuirksMode()); 1247 1233 if (newId != oldId) { 1234 Style::IdChangeInvalidation styleInvalidation(*this, oldId, newId); 1248 1235 elementData()->setIdForStyleResolution(newId); 1249 shouldInvalidateStyle = testShouldInvalidateStyle && checkNeedsStyleInvalidationForIdChange(oldId, newId, styleResolver);1250 1236 } 1251 1237 } else if (name == classAttr) … … 1253 1239 else if (name == HTMLNames::nameAttr) 1254 1240 elementData()->setHasNameAttribute(!newValue.isNull()); 1255 else if (name == HTMLNames::pseudoAttr) 1256 shouldInvalidateStyle |= testShouldInvalidateStyle && isInShadowTree(); 1241 else if (name == HTMLNames::pseudoAttr) { 1242 if (needsStyleInvalidation() && isInShadowTree()) 1243 setNeedsStyleRecalc(FullStyleChange); 1244 } 1257 1245 #if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT) 1258 1246 else if (name == HTMLNames::slotAttr) { … … 1273 1261 1274 1262 invalidateNodeListAndCollectionCachesInAncestors(&name, this); 1275 1276 if (shouldInvalidateStyle)1277 setNeedsStyleRecalc();1278 1263 1279 1264 if (AXObjectCache* cache = document().existingAXObjectCache())
Note: See TracChangeset
for help on using the changeset viewer.