Rename StyleInvalidationAnalysis to Style::Invalidator
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 May 2017 14:04:21 +0000 (14:04 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 May 2017 14:04:21 +0000 (14:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=171601

Reviewed by Žan Doberšek.

Also move it to the 'style' directory.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/StyleInvalidationAnalysis.cpp: Removed.
* css/StyleInvalidationAnalysis.h: Removed.
* dom/ExtensionStyleSheets.cpp:
* style/AttributeChangeInvalidation.cpp:
(WebCore::Style::AttributeChangeInvalidation::invalidateDescendants):
* style/ClassChangeInvalidation.cpp:
(WebCore::Style::ClassChangeInvalidation::invalidateDescendantStyle):
* style/StyleInvalidator.cpp: Copied from Source/WebCore/css/StyleInvalidationAnalysis.cpp.
(WebCore::Style::Invalidator::Invalidator):
(WebCore::Style::Invalidator::invalidateIfNeeded):
(WebCore::Style::Invalidator::invalidateStyleForTree):
(WebCore::Style::Invalidator::invalidateStyle):
(WebCore::shouldDirtyAllStyle): Deleted.
(WebCore::StyleInvalidationAnalysis::StyleInvalidationAnalysis): Deleted.
(WebCore::StyleInvalidationAnalysis::invalidateIfNeeded): Deleted.
(WebCore::StyleInvalidationAnalysis::invalidateStyleForTree): Deleted.
(WebCore::StyleInvalidationAnalysis::invalidateStyle): Deleted.
* style/StyleInvalidator.h: Copied from Source/WebCore/css/StyleInvalidationAnalysis.h.
(WebCore::StyleInvalidationAnalysis::dirtiesAllStyle): Deleted.
(WebCore::StyleInvalidationAnalysis::hasShadowPseudoElementRulesInAuthorSheet): Deleted.
* style/StyleScope.cpp:
(WebCore::Style::Scope::resolver):
(WebCore::Style::Scope::analyzeStyleSheetChange):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216117 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/ExtensionStyleSheets.cpp
Source/WebCore/style/AttributeChangeInvalidation.cpp
Source/WebCore/style/ClassChangeInvalidation.cpp
Source/WebCore/style/StyleInvalidator.cpp [moved from Source/WebCore/css/StyleInvalidationAnalysis.cpp with 89% similarity]
Source/WebCore/style/StyleInvalidator.h [moved from Source/WebCore/css/StyleInvalidationAnalysis.h with 89% similarity]
Source/WebCore/style/StyleScope.cpp

index 40f64e0..1c4b50f 100644 (file)
@@ -1393,7 +1393,6 @@ set(WebCore_SOURCES
     css/SelectorChecker.cpp
     css/SelectorFilter.cpp
     css/StyleColor.cpp
-    css/StyleInvalidationAnalysis.cpp
     css/StyleMedia.cpp
     css/StyleProperties.cpp
     css/StylePropertyShorthand.cpp
@@ -2735,6 +2734,7 @@ set(WebCore_SOURCES
     style/RenderTreeUpdater.cpp
     style/StyleChange.cpp
     style/StyleFontSizeFunctions.cpp
+    style/StyleInvalidator.cpp
     style/StylePendingResources.cpp
     style/StyleRelations.cpp
     style/StyleResolveForDocument.cpp
index 7823f8d..a27d05b 100644 (file)
@@ -1,3 +1,38 @@
+2017-05-03  Antti Koivisto  <antti@apple.com>
+
+        Rename StyleInvalidationAnalysis to Style::Invalidator
+        https://bugs.webkit.org/show_bug.cgi?id=171601
+
+        Reviewed by Žan Doberšek.
+
+        Also move it to the 'style' directory.
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/StyleInvalidationAnalysis.cpp: Removed.
+        * css/StyleInvalidationAnalysis.h: Removed.
+        * dom/ExtensionStyleSheets.cpp:
+        * style/AttributeChangeInvalidation.cpp:
+        (WebCore::Style::AttributeChangeInvalidation::invalidateDescendants):
+        * style/ClassChangeInvalidation.cpp:
+        (WebCore::Style::ClassChangeInvalidation::invalidateDescendantStyle):
+        * style/StyleInvalidator.cpp: Copied from Source/WebCore/css/StyleInvalidationAnalysis.cpp.
+        (WebCore::Style::Invalidator::Invalidator):
+        (WebCore::Style::Invalidator::invalidateIfNeeded):
+        (WebCore::Style::Invalidator::invalidateStyleForTree):
+        (WebCore::Style::Invalidator::invalidateStyle):
+        (WebCore::shouldDirtyAllStyle): Deleted.
+        (WebCore::StyleInvalidationAnalysis::StyleInvalidationAnalysis): Deleted.
+        (WebCore::StyleInvalidationAnalysis::invalidateIfNeeded): Deleted.
+        (WebCore::StyleInvalidationAnalysis::invalidateStyleForTree): Deleted.
+        (WebCore::StyleInvalidationAnalysis::invalidateStyle): Deleted.
+        * style/StyleInvalidator.h: Copied from Source/WebCore/css/StyleInvalidationAnalysis.h.
+        (WebCore::StyleInvalidationAnalysis::dirtiesAllStyle): Deleted.
+        (WebCore::StyleInvalidationAnalysis::hasShadowPseudoElementRulesInAuthorSheet): Deleted.
+        * style/StyleScope.cpp:
+        (WebCore::Style::Scope::resolver):
+        (WebCore::Style::Scope::analyzeStyleSheetChange):
+
 2017-05-02  Andrew Gold  <agold@apple.com>
 
         Typo in AVAudioSessionCaptureDeviceManager.mm
index 54680aa..54d2b3b 100644 (file)
                E46A2B1C17CA65B9000DBCD8 /* TypedElementDescendantIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E46A2B1B17CA65B9000DBCD8 /* TypedElementDescendantIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
                E46A2B1E17CA76B1000DBCD8 /* ElementChildIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E46A2B1D17CA76B1000DBCD8 /* ElementChildIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
                E46B41F91CB24E70008F11DE /* NoEventDispatchAssertion.h in Headers */ = {isa = PBXBuildFile; fileRef = E46B41F81CB24E70008F11DE /* NoEventDispatchAssertion.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               E47127CA163438A100ED6F5A /* StyleInvalidationAnalysis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E47A97CE163059FC005DCD99 /* StyleInvalidationAnalysis.cpp */; };
-               E47127CB163438AE00ED6F5A /* StyleInvalidationAnalysis.h in Headers */ = {isa = PBXBuildFile; fileRef = E47A97CF163059FC005DCD99 /* StyleInvalidationAnalysis.h */; };
+               E47127CA163438A100ED6F5A /* StyleInvalidator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E47A97CE163059FC005DCD99 /* StyleInvalidator.cpp */; };
+               E47127CB163438AE00ED6F5A /* StyleInvalidator.h in Headers */ = {isa = PBXBuildFile; fileRef = E47A97CF163059FC005DCD99 /* StyleInvalidator.h */; };
                E4778B7F115A581A00B5D372 /* JSCustomEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4778B7D115A581A00B5D372 /* JSCustomEvent.cpp */; };
                E4778B80115A581A00B5D372 /* JSCustomEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = E4778B7E115A581A00B5D372 /* JSCustomEvent.h */; };
                E47A3AC31C5EABBE00CCBFA7 /* StyleSharingResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E47A3AC21C5EABBE00CCBFA7 /* StyleSharingResolver.cpp */; };
                E4778B7E115A581A00B5D372 /* JSCustomEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomEvent.h; sourceTree = "<group>"; };
                E47A3AC21C5EABBE00CCBFA7 /* StyleSharingResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleSharingResolver.cpp; sourceTree = "<group>"; };
                E47A3AC41C5EAC7900CCBFA7 /* StyleSharingResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleSharingResolver.h; sourceTree = "<group>"; };
-               E47A97CE163059FC005DCD99 /* StyleInvalidationAnalysis.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleInvalidationAnalysis.cpp; sourceTree = "<group>"; };
-               E47A97CF163059FC005DCD99 /* StyleInvalidationAnalysis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleInvalidationAnalysis.h; sourceTree = "<group>"; };
+               E47A97CE163059FC005DCD99 /* StyleInvalidator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleInvalidator.cpp; sourceTree = "<group>"; };
+               E47A97CF163059FC005DCD99 /* StyleInvalidator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleInvalidator.h; sourceTree = "<group>"; };
                E47B4BE60E71241600038854 /* CachedResourceHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedResourceHandle.h; sourceTree = "<group>"; };
                E47B4BE70E71241600038854 /* CachedResourceHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedResourceHandle.cpp; sourceTree = "<group>"; };
                E47E276416036ED200EE2AFB /* ExtensionStyleSheets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtensionStyleSheets.h; sourceTree = "<group>"; };
                                E401E0A31C3C0B8300F34D10 /* StyleChange.h */,
                                E4D58EB617B4ED8900CBDCA8 /* StyleFontSizeFunctions.cpp */,
                                E4D58EB717B4ED8900CBDCA8 /* StyleFontSizeFunctions.h */,
+                               E47A97CE163059FC005DCD99 /* StyleInvalidator.cpp */,
+                               E47A97CF163059FC005DCD99 /* StyleInvalidator.h */,
                                E4DACE6B1D12E1160075980F /* StylePendingResources.cpp */,
                                E4DACE691D12E10B0075980F /* StylePendingResources.h */,
                                E461802E1C8DD4D20026C02C /* StyleRelations.cpp */,
                                835D363619FF6193004C93AB /* StyleBuilderCustom.h */,
                                941827881D8B242200492764 /* StyleColor.cpp */,
                                941827891D8B242200492764 /* StyleColor.h */,
-                               E47A97CE163059FC005DCD99 /* StyleInvalidationAnalysis.cpp */,
-                               E47A97CF163059FC005DCD99 /* StyleInvalidationAnalysis.h */,
                                0FF5026E102BA9660066F39A /* StyleMedia.cpp */,
                                0FF5026F102BA96A0066F39A /* StyleMedia.h */,
                                0FF50270102BA96A0066F39A /* StyleMedia.idl */,
                                A110DB9B14F5DF7700A03B93 /* StyleGridItemData.h in Headers */,
                                BCEF43CF0E673DA1001C1287 /* StyleImage.h in Headers */,
                                BC2273040E82F1E600E7F975 /* StyleInheritedData.h in Headers */,
-                               E47127CB163438AE00ED6F5A /* StyleInvalidationAnalysis.h in Headers */,
+                               E47127CB163438AE00ED6F5A /* StyleInvalidator.h in Headers */,
                                BC5EB72A0E81DE8100B25965 /* StyleMarqueeData.h in Headers */,
                                0FF50272102BA96A0066F39A /* StyleMedia.h in Headers */,
                                BC5EB74E0E81E06700B25965 /* StyleMultiColData.h in Headers */,
                                A10DC76A14747BAB005E2471 /* StyleGridData.cpp in Sources */,
                                A110DB9D14F5DF8700A03B93 /* StyleGridItemData.cpp in Sources */,
                                BC2273030E82F1E600E7F975 /* StyleInheritedData.cpp in Sources */,
-                               E47127CA163438A100ED6F5A /* StyleInvalidationAnalysis.cpp in Sources */,
+                               E47127CA163438A100ED6F5A /* StyleInvalidator.cpp in Sources */,
                                BC5EB7290E81DE8100B25965 /* StyleMarqueeData.cpp in Sources */,
                                0FF50271102BA96A0066F39A /* StyleMedia.cpp in Sources */,
                                BC5EB74D0E81E06700B25965 /* StyleMultiColData.cpp in Sources */,
index d0d244a..aa1f1cf 100644 (file)
@@ -36,7 +36,7 @@
 #include "ProcessingInstruction.h"
 #include "SVGStyleElement.h"
 #include "Settings.h"
-#include "StyleInvalidationAnalysis.h"
+#include "StyleInvalidator.h"
 #include "StyleResolver.h"
 #include "StyleScope.h"
 #include "StyleSheetContents.h"
index f71c6ea..35dda59 100644 (file)
@@ -29,7 +29,7 @@
 #include "DocumentRuleSets.h"
 #include "ElementIterator.h"
 #include "ShadowRoot.h"
-#include "StyleInvalidationAnalysis.h"
+#include "StyleInvalidator.h"
 #include "StyleResolver.h"
 #include "StyleScope.h"
 
@@ -116,8 +116,8 @@ void AttributeChangeInvalidation::invalidateDescendants()
 {
     if (!m_descendantInvalidationRuleSet)
         return;
-    StyleInvalidationAnalysis invalidationAnalysis(*m_descendantInvalidationRuleSet);
-    invalidationAnalysis.invalidateStyle(m_element);
+    Invalidator invalidator(*m_descendantInvalidationRuleSet);
+    invalidator.invalidateStyle(m_element);
 }
 
 }
index e25fc49..d6660fb 100644 (file)
@@ -30,7 +30,7 @@
 #include "ElementChildIterator.h"
 #include "ShadowRoot.h"
 #include "SpaceSplitString.h"
-#include "StyleInvalidationAnalysis.h"
+#include "StyleInvalidator.h"
 #include "StyleResolver.h"
 #include "StyleScope.h"
 #include <wtf/BitVector.h>
@@ -149,8 +149,8 @@ void ClassChangeInvalidation::invalidateStyle(const SpaceSplitString& oldClasses
 void ClassChangeInvalidation::invalidateDescendantStyle()
 {
     for (auto* ancestorClassRules : m_descendantInvalidationRuleSets) {
-        StyleInvalidationAnalysis invalidationAnalysis(*ancestorClassRules);
-        invalidationAnalysis.invalidateStyle(m_element);
+        Invalidator invalidator(*ancestorClassRules);
+        invalidator.invalidateStyle(m_element);
     }
 }
 
similarity index 89%
rename from Source/WebCore/css/StyleInvalidationAnalysis.cpp
rename to Source/WebCore/style/StyleInvalidator.cpp
index b89eac0..31432ba 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2014, 2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "StyleInvalidationAnalysis.h"
+#include "StyleInvalidator.h"
 
 #include "CSSSelectorList.h"
 #include "Document.h"
@@ -37,6 +37,7 @@
 #include "StyleSheetContents.h"
 
 namespace WebCore {
+namespace Style {
 
 static bool shouldDirtyAllStyle(const Vector<RefPtr<StyleRuleBase>>& rules)
 {
@@ -76,7 +77,7 @@ static bool shouldDirtyAllStyle(const Vector<StyleSheetContents*>& sheets)
     return false;
 }
 
-StyleInvalidationAnalysis::StyleInvalidationAnalysis(const Vector<StyleSheetContents*>& sheets, const MediaQueryEvaluator& mediaQueryEvaluator)
+Invalidator::Invalidator(const Vector<StyleSheetContents*>& sheets, const MediaQueryEvaluator& mediaQueryEvaluator)
     : m_ownedRuleSet(std::make_unique<RuleSet>())
     , m_ruleSet(*m_ownedRuleSet)
     , m_dirtiesAllStyle(shouldDirtyAllStyle(sheets))
@@ -91,13 +92,13 @@ StyleInvalidationAnalysis::StyleInvalidationAnalysis(const Vector<StyleSheetCont
     m_hasShadowPseudoElementRulesInAuthorSheet = m_ruleSet.hasShadowPseudoElementRules();
 }
 
-StyleInvalidationAnalysis::StyleInvalidationAnalysis(const RuleSet& ruleSet)
+Invalidator::Invalidator(const RuleSet& ruleSet)
     : m_ruleSet(ruleSet)
     , m_hasShadowPseudoElementRulesInAuthorSheet(ruleSet.hasShadowPseudoElementRules())
 {
 }
 
-StyleInvalidationAnalysis::CheckDescendants StyleInvalidationAnalysis::invalidateIfNeeded(Element& element, const SelectorFilter* filter)
+Invalidator::CheckDescendants Invalidator::invalidateIfNeeded(Element& element, const SelectorFilter* filter)
 {
     if (m_hasShadowPseudoElementRulesInAuthorSheet) {
         // FIXME: This could do actual rule matching too.
@@ -138,7 +139,7 @@ StyleInvalidationAnalysis::CheckDescendants StyleInvalidationAnalysis::invalidat
     return CheckDescendants::Yes;
 }
 
-void StyleInvalidationAnalysis::invalidateStyleForTree(Element& root, SelectorFilter* filter)
+void Invalidator::invalidateStyleForTree(Element& root, SelectorFilter* filter)
 {
     if (invalidateIfNeeded(root, filter) == CheckDescendants::No)
         return;
@@ -171,7 +172,7 @@ void StyleInvalidationAnalysis::invalidateStyleForTree(Element& root, SelectorFi
     }
 }
 
-void StyleInvalidationAnalysis::invalidateStyle(Document& document)
+void Invalidator::invalidateStyle(Document& document)
 {
     ASSERT(!m_dirtiesAllStyle);
 
@@ -183,7 +184,7 @@ void StyleInvalidationAnalysis::invalidateStyle(Document& document)
     invalidateStyleForTree(*documentElement, &filter);
 }
 
-void StyleInvalidationAnalysis::invalidateStyle(ShadowRoot& shadowRoot)
+void Invalidator::invalidateStyle(ShadowRoot& shadowRoot)
 {
     ASSERT(!m_dirtiesAllStyle);
 
@@ -196,7 +197,7 @@ void StyleInvalidationAnalysis::invalidateStyle(ShadowRoot& shadowRoot)
     }
 }
 
-void StyleInvalidationAnalysis::invalidateStyle(Element& element)
+void Invalidator::invalidateStyle(Element& element)
 {
     ASSERT(!m_dirtiesAllStyle);
 
@@ -205,3 +206,4 @@ void StyleInvalidationAnalysis::invalidateStyle(Element& element)
 }
 
 }
+}
similarity index 89%
rename from Source/WebCore/css/StyleInvalidationAnalysis.h
rename to Source/WebCore/style/StyleInvalidator.h
index 33e25b6..0831b7d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2014, 2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -37,10 +37,12 @@ class SelectorFilter;
 class ShadowRoot;
 class StyleSheetContents;
 
-class StyleInvalidationAnalysis {
+namespace Style {
+
+class Invalidator {
 public:
-    StyleInvalidationAnalysis(const Vector<StyleSheetContents*>&, const MediaQueryEvaluator&);
-    StyleInvalidationAnalysis(const RuleSet&);
+    Invalidator(const Vector<StyleSheetContents*>&, const MediaQueryEvaluator&);
+    Invalidator(const RuleSet&);
 
     bool dirtiesAllStyle() const { return m_dirtiesAllStyle; }
     bool hasShadowPseudoElementRulesInAuthorSheet() const { return m_hasShadowPseudoElementRulesInAuthorSheet; }
@@ -60,4 +62,5 @@ private:
     bool m_didInvalidateHostChildren { false };
 };
 
-} // namespace WebCore
+}
+}
index 597c5d5..6302c55 100644 (file)
@@ -42,7 +42,7 @@
 #include "SVGStyleElement.h"
 #include "Settings.h"
 #include "ShadowRoot.h"
-#include "StyleInvalidationAnalysis.h"
+#include "StyleInvalidator.h"
 #include "StyleResolver.h"
 #include "StyleSheetContents.h"
 #include "StyleSheetList.h"
@@ -403,14 +403,14 @@ Scope::StyleResolverUpdateType Scope::analyzeStyleSheetChange(const Vector<RefPt
     if (!m_document.bodyOrFrameset() || m_document.hasNodesWithNonFinalStyle() || m_document.hasNodesWithMissingStyle())
         return styleResolverUpdateType;
 
-    StyleInvalidationAnalysis invalidationAnalysis(addedSheets, styleResolver.mediaQueryEvaluator());
-    if (invalidationAnalysis.dirtiesAllStyle())
+    Invalidator invalidator(addedSheets, styleResolver.mediaQueryEvaluator());
+    if (invalidator.dirtiesAllStyle())
         return styleResolverUpdateType;
 
     if (m_shadowRoot)
-        invalidationAnalysis.invalidateStyle(*m_shadowRoot);
+        invalidator.invalidateStyle(*m_shadowRoot);
     else
-        invalidationAnalysis.invalidateStyle(m_document);
+        invalidator.invalidateStyle(m_document);
 
     requiresFullStyleRecalc = false;