Title: [276904] trunk/Source/WebCore
Revision
276904
Author
[email protected]
Date
2021-05-03 10:08:39 -0700 (Mon, 03 May 2021)

Log Message

Move Style::ScopeOrdinal to a header of its own
https://bugs.webkit.org/show_bug.cgi?id=225302

Reviewed by Alan Bujtas.

Se we don't need to include StyleScope.h everywhere via Animation.h.

* WebCore.xcodeproj/project.pbxproj:
* animation/KeyframeEffect.cpp:
* css/DOMCSSRegisterCustomProperty.cpp:
* platform/animation/Animation.h:
* style/ElementRuleCollector.h:
* style/StyleScope.h:
(WebCore::Style::operator++): Deleted.
* style/StyleScopeOrdinal.h: Added.
(WebCore::Style::operator++):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (276903 => 276904)


--- trunk/Source/WebCore/ChangeLog	2021-05-03 16:38:55 UTC (rev 276903)
+++ trunk/Source/WebCore/ChangeLog	2021-05-03 17:08:39 UTC (rev 276904)
@@ -1,3 +1,22 @@
+2021-05-03  Antti Koivisto  <[email protected]>
+
+        Move Style::ScopeOrdinal to a header of its own
+        https://bugs.webkit.org/show_bug.cgi?id=225302
+
+        Reviewed by Alan Bujtas.
+
+        Se we don't need to include StyleScope.h everywhere via Animation.h.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * animation/KeyframeEffect.cpp:
+        * css/DOMCSSRegisterCustomProperty.cpp:
+        * platform/animation/Animation.h:
+        * style/ElementRuleCollector.h:
+        * style/StyleScope.h:
+        (WebCore::Style::operator++): Deleted.
+        * style/StyleScopeOrdinal.h: Added.
+        (WebCore::Style::operator++):
+
 2021-05-03  Zalan Bujtas  <[email protected]>
 
         [Multi-column] Remove spanner placeholder when the spanner becomes nested

Modified: trunk/Source/WebCore/Headers.cmake (276903 => 276904)


--- trunk/Source/WebCore/Headers.cmake	2021-05-03 16:38:55 UTC (rev 276903)
+++ trunk/Source/WebCore/Headers.cmake	2021-05-03 17:08:39 UTC (rev 276904)
@@ -1632,6 +1632,7 @@
 
     style/StyleChange.h
     style/StyleScope.h
+    style/StyleScopeOrdinal.h
     style/StyleUpdate.h
     style/StyleValidity.h
     style/Styleable.h

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (276903 => 276904)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-05-03 16:38:55 UTC (rev 276903)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-05-03 17:08:39 UTC (rev 276904)
@@ -5248,6 +5248,7 @@
 		E4D58EB917B4ED8900CBDCA8 /* StyleFontSizeFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D58EB717B4ED8900CBDCA8 /* StyleFontSizeFunctions.h */; };
 		E4D58EBB17B8F12800CBDCA8 /* ElementTraversal.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D58EBA17B8F12800CBDCA8 /* ElementTraversal.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E4D68EB517B4DBDC00CBDCA8 /* StyleResolveForFontRaw.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D68EB317B4DBDC00CBDCA8 /* StyleResolveForFontRaw.h */; };
+		E4D86E6D2640394C00B62425 /* StyleScopeOrdinal.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D86E6B2640394C00B62425 /* StyleScopeOrdinal.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E4D988B417BFD1F60084FB88 /* TextNodeTraversal.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D988B317BFD1F60084FB88 /* TextNodeTraversal.h */; };
 		E4DACE6A1D12E10B0075980F /* StylePendingResources.h in Headers */ = {isa = PBXBuildFile; fileRef = E4DACE691D12E10B0075980F /* StylePendingResources.h */; };
 		E4DEAA1817A93DC3000E0430 /* StyleTreeResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = E4DEAA1617A93DC3000E0430 /* StyleTreeResolver.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -16617,6 +16618,7 @@
 		E4D58EBA17B8F12800CBDCA8 /* ElementTraversal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementTraversal.h; sourceTree = "<group>"; };
 		E4D68EB217B4DBDC00CBDCA8 /* StyleResolveForFontRaw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleResolveForFontRaw.cpp; sourceTree = "<group>"; };
 		E4D68EB317B4DBDC00CBDCA8 /* StyleResolveForFontRaw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleResolveForFontRaw.h; sourceTree = "<group>"; };
+		E4D86E6B2640394C00B62425 /* StyleScopeOrdinal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleScopeOrdinal.h; sourceTree = "<group>"; };
 		E4D988B317BFD1F60084FB88 /* TextNodeTraversal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextNodeTraversal.h; sourceTree = "<group>"; };
 		E4D988B517BFEB210084FB88 /* TextNodeTraversal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextNodeTraversal.cpp; sourceTree = "<group>"; };
 		E4DACE691D12E10B0075980F /* StylePendingResources.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StylePendingResources.h; sourceTree = "<group>"; };
@@ -29426,6 +29428,7 @@
 				E139866215478474001E3F65 /* StyleResolver.h */,
 				E461D65C1BB0C7F000CB5645 /* StyleScope.cpp */,
 				E461D65E1BB0C80D00CB5645 /* StyleScope.h */,
+				E4D86E6B2640394C00B62425 /* StyleScopeOrdinal.h */,
 				4A4F48A716B0DFC000EDBB29 /* StyleScopeRuleSets.cpp */,
 				4A4F48A816B0DFC000EDBB29 /* StyleScopeRuleSets.h */,
 				E47A3AC21C5EABBE00CCBFA7 /* StyleSharingResolver.cpp */,
@@ -34892,6 +34895,7 @@
 				E46B41F91CB24E70008F11DE /* ScriptDisallowedScope.h in Headers */,
 				4998AED213FB224D0090B1AA /* ScriptedAnimationController.h in Headers */,
 				08A484780E5272C500C3FE76 /* ScriptElement.h in Headers */,
+				E4D86E6D2640394C00B62425 /* StyleScopeOrdinal.h in Headers */,
 				E3E4E2A81E3B17100023BB8A /* ScriptElementCachedScriptFetcher.h in Headers */,
 				E11C9D9B0EB3681200E409DB /* ScriptExecutionContext.h in Headers */,
 				411223BA260244FE00B0A0B6 /* ScriptExecutionContextIdentifier.h in Headers */,

Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (276903 => 276904)


--- trunk/Source/WebCore/animation/KeyframeEffect.cpp	2021-05-03 16:38:55 UTC (rev 276903)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp	2021-05-03 17:08:39 UTC (rev 276904)
@@ -56,6 +56,7 @@
 #include "StyleAdjuster.h"
 #include "StylePendingResources.h"
 #include "StyleResolver.h"
+#include "StyleScope.h"
 #include "TimingFunction.h"
 #include "TranslateTransformOperation.h"
 #include "WillChangeData.h"

Modified: trunk/Source/WebCore/css/DOMCSSRegisterCustomProperty.cpp (276903 => 276904)


--- trunk/Source/WebCore/css/DOMCSSRegisterCustomProperty.cpp	2021-05-03 16:38:55 UTC (rev 276903)
+++ trunk/Source/WebCore/css/DOMCSSRegisterCustomProperty.cpp	2021-05-03 17:08:39 UTC (rev 276904)
@@ -36,6 +36,7 @@
 #include "StyleBuilder.h"
 #include "StyleBuilderConverter.h"
 #include "StyleResolver.h"
+#include "StyleScope.h"
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {

Modified: trunk/Source/WebCore/platform/animation/Animation.h (276903 => 276904)


--- trunk/Source/WebCore/platform/animation/Animation.h	2021-05-03 16:38:55 UTC (rev 276903)
+++ trunk/Source/WebCore/platform/animation/Animation.h	2021-05-03 17:08:39 UTC (rev 276904)
@@ -26,7 +26,7 @@
 
 #include "CSSPropertyNames.h"
 #include "RenderStyleConstants.h"
-#include "StyleScope.h"
+#include "StyleScopeOrdinal.h"
 #include "TimingFunction.h"
 
 namespace WebCore {

Modified: trunk/Source/WebCore/style/ElementRuleCollector.h (276903 => 276904)


--- trunk/Source/WebCore/style/ElementRuleCollector.h	2021-05-03 16:38:55 UTC (rev 276903)
+++ trunk/Source/WebCore/style/ElementRuleCollector.h	2021-05-03 17:08:39 UTC (rev 276904)
@@ -24,7 +24,7 @@
 #include "MediaQueryEvaluator.h"
 #include "RuleSet.h"
 #include "SelectorChecker.h"
-#include "StyleScope.h"
+#include "StyleScopeOrdinal.h"
 #include <memory>
 #include <wtf/RefPtr.h>
 #include <wtf/Vector.h>

Modified: trunk/Source/WebCore/style/StyleScope.h (276903 => 276904)


--- trunk/Source/WebCore/style/StyleScope.h	2021-05-03 16:38:55 UTC (rev 276903)
+++ trunk/Source/WebCore/style/StyleScope.h	2021-05-03 17:08:39 UTC (rev 276904)
@@ -27,9 +27,10 @@
 
 #pragma once
 
-#include "Timer.h"
+#include "StyleScopeOrdinal.h"
 #include <memory>
 #include <wtf/FastMalloc.h>
+#include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 #include <wtf/ListHashSet.h>
 #include <wtf/RefPtr.h>
@@ -53,15 +54,6 @@
 
 class Resolver;
 
-// This is used to identify style scopes that can affect an element.
-// Scopes are in tree-of-trees order. Styles from earlier scopes win over later ones (modulo !important).
-enum class ScopeOrdinal : int {
-    ContainingHost = -1, // ::part rules and author-exposed UA pseudo classes from the host tree scope.
-    Element = 0, // Normal rules in the same tree where the element is.
-    FirstSlot = 1, // ::slotted rules in the parent's shadow tree. Values greater than FirstSlot indicate subsequent slots in the chain.
-    Shadow = std::numeric_limits<int>::max(), // :host rules in element's own shadow tree.
-};
-
 class Scope {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -223,11 +215,5 @@
         flushPendingSelfUpdate();
 }
 
-inline ScopeOrdinal& operator++(ScopeOrdinal& ordinal)
-{
-    ASSERT(ordinal < ScopeOrdinal::Shadow);
-    return ordinal = static_cast<ScopeOrdinal>(static_cast<int>(ordinal) + 1);
 }
-
 }
-}

Added: trunk/Source/WebCore/style/StyleScopeOrdinal.h (0 => 276904)


--- trunk/Source/WebCore/style/StyleScopeOrdinal.h	                        (rev 0)
+++ trunk/Source/WebCore/style/StyleScopeOrdinal.h	2021-05-03 17:08:39 UTC (rev 276904)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace WebCore {
+namespace Style {
+
+// This is used to identify style scopes that can affect an element.
+// Scopes are in tree-of-trees order. Styles from earlier scopes win over later ones (modulo !important).
+enum class ScopeOrdinal : int {
+    ContainingHost = -1, // ::part rules and author-exposed UA pseudo classes from the host tree scope.
+    Element = 0, // Normal rules in the same tree where the element is.
+    FirstSlot = 1, // ::slotted rules in the parent's shadow tree. Values greater than FirstSlot indicate subsequent slots in the chain.
+    Shadow = std::numeric_limits<int>::max(), // :host rules in element's own shadow tree.
+};
+
+inline ScopeOrdinal& operator++(ScopeOrdinal& ordinal)
+{
+    ASSERT(ordinal < ScopeOrdinal::Shadow);
+    return ordinal = static_cast<ScopeOrdinal>(static_cast<int>(ordinal) + 1);
+}
+
+}
+}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to