Title: [285421] trunk/Source/WebCore
Revision
285421
Author
[email protected]
Date
2021-11-08 11:44:23 -0800 (Mon, 08 Nov 2021)

Log Message

Unreviewed, reverting r285392.
https://bugs.webkit.org/show_bug.cgi?id=232828

4% Speedometer2 regression

Reverted changeset:

"Use narrower types for style scope ordinal and cascade layer
priority"
https://bugs.webkit.org/show_bug.cgi?id=232797
https://commits.webkit.org/r285392

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (285420 => 285421)


--- trunk/Source/WebCore/ChangeLog	2021-11-08 19:34:25 UTC (rev 285420)
+++ trunk/Source/WebCore/ChangeLog	2021-11-08 19:44:23 UTC (rev 285421)
@@ -1,3 +1,17 @@
+2021-11-08  Commit Queue  <[email protected]>
+
+        Unreviewed, reverting r285392.
+        https://bugs.webkit.org/show_bug.cgi?id=232828
+
+        4% Speedometer2 regression
+
+        Reverted changeset:
+
+        "Use narrower types for style scope ordinal and cascade layer
+        priority"
+        https://bugs.webkit.org/show_bug.cgi?id=232797
+        https://commits.webkit.org/r285392
+
 2021-11-08  Chris Dumez  <[email protected]>
 
         Unreviewed, reverting r284883.

Modified: trunk/Source/WebCore/style/ElementRuleCollector.cpp (285420 => 285421)


--- trunk/Source/WebCore/style/ElementRuleCollector.cpp	2021-11-08 19:34:25 UTC (rev 285420)
+++ trunk/Source/WebCore/style/ElementRuleCollector.cpp	2021-11-08 19:44:23 UTC (rev 285421)
@@ -289,9 +289,6 @@
 
         MatchRequest scopeMatchRequest(&scopeAuthorRules, styleScopeOrdinal);
         collectMatchingRulesForList(&scopeAuthorRules.slottedPseudoElementRules(), scopeMatchRequest);
-
-        if (styleScopeOrdinal == ScopeOrdinal::SlotLimit)
-            break;
     }
 }
 
@@ -326,9 +323,6 @@
         // Element may only be exposed to styling from enclosing scopes via exportparts attributes.
         if (element != &partMatchingElement && element->shadowRoot()->partMappings().isEmpty())
             break;
-
-        if (styleScopeOrdinal == ScopeOrdinal::ContainingHostLimit)
-            break;
     }
 }
 

Modified: trunk/Source/WebCore/style/ElementRuleCollector.h (285420 => 285421)


--- trunk/Source/WebCore/style/ElementRuleCollector.h	2021-11-08 19:34:25 UTC (rev 285420)
+++ trunk/Source/WebCore/style/ElementRuleCollector.h	2021-11-08 19:44:23 UTC (rev 285421)
@@ -63,7 +63,7 @@
     const RuleData* ruleData;
     unsigned specificity;
     ScopeOrdinal styleScopeOrdinal;
-    CascadeLayerPriority cascadeLayerPriority;
+    unsigned cascadeLayerPriority;
 };
 
 enum class FromStyleAttribute : bool { No, Yes };

Modified: trunk/Source/WebCore/style/RuleSet.h (285420 => 285421)


--- trunk/Source/WebCore/style/RuleSet.h	2021-11-08 19:34:25 UTC (rev 285420)
+++ trunk/Source/WebCore/style/RuleSet.h	2021-11-08 19:44:23 UTC (rev 285421)
@@ -43,8 +43,6 @@
 class Resolver;
 class RuleSet;
 
-using CascadeLayerPriority = uint16_t;
-
 using InvalidationRuleSetVector = Vector<RefPtr<const RuleSet>, 1>;
 
 struct DynamicMediaQueryEvaluationChanges {
@@ -105,8 +103,8 @@
     bool hasShadowPseudoElementRules() const { return !m_shadowPseudoElementRules.isEmpty(); }
     bool hasHostPseudoClassRulesMatchingInShadowTree() const { return m_hasHostPseudoClassRulesMatchingInShadowTree; }
 
-    static constexpr auto cascadeLayerPriorityForUnlayered = std::numeric_limits<CascadeLayerPriority>::max();
-    CascadeLayerPriority cascadeLayerPriorityFor(const RuleData&) const;
+    static constexpr auto cascadeLayerPriorityForUnlayered = std::numeric_limits<unsigned>::max();
+    unsigned cascadeLayerPriorityFor(const RuleData&) const;
 
 private:
     friend class RuleSetBuilder;
@@ -134,11 +132,11 @@
     struct CascadeLayer {
         CascadeLayerName resolvedName;
         CascadeLayerIdentifier parentIdentifier;
-        CascadeLayerPriority priority { 0 };
+        unsigned priority { 0 };
     };
     CascadeLayer& cascadeLayerForIdentifier(CascadeLayerIdentifier identifier) { return m_cascadeLayers[identifier - 1]; }
     const CascadeLayer& cascadeLayerForIdentifier(CascadeLayerIdentifier identifier) const { return m_cascadeLayers[identifier - 1]; }
-    CascadeLayerPriority cascadeLayerPriorityForIdentifier(CascadeLayerIdentifier) const;
+    unsigned cascadeLayerPriorityForIdentifier(CascadeLayerIdentifier) const;
 
     struct DynamicMediaQueryRules {
         Vector<Ref<const MediaQuerySet>> mediaQuerySets;
@@ -195,7 +193,7 @@
     return tagRules->get(key);
 }
 
-inline CascadeLayerPriority RuleSet::cascadeLayerPriorityForIdentifier(CascadeLayerIdentifier identifier) const
+inline unsigned RuleSet::cascadeLayerPriorityForIdentifier(CascadeLayerIdentifier identifier) const
 {
     if (!identifier)
         return cascadeLayerPriorityForUnlayered;
@@ -202,7 +200,7 @@
     return cascadeLayerForIdentifier(identifier).priority;
 }
 
-inline CascadeLayerPriority RuleSet::cascadeLayerPriorityFor(const RuleData& ruleData) const
+inline unsigned RuleSet::cascadeLayerPriorityFor(const RuleData& ruleData) const
 {
     if (m_cascadeLayerIdentifierForRulePosition.size() <= ruleData.position())
         return cascadeLayerPriorityForUnlayered;

Modified: trunk/Source/WebCore/style/RuleSetBuilder.cpp (285420 => 285421)


--- trunk/Source/WebCore/style/RuleSetBuilder.cpp	2021-11-08 19:34:25 UTC (rev 285420)
+++ trunk/Source/WebCore/style/RuleSetBuilder.cpp	2021-11-08 19:44:23 UTC (rev 285421)
@@ -270,10 +270,8 @@
 
     std::sort(layersInPriorityOrder.begin(), layersInPriorityOrder.end(), compare);
 
-    for (unsigned i = 0; i < layerCount; ++i) {
-        auto priority = std::min<unsigned>(i, RuleSet::cascadeLayerPriorityForUnlayered - 1);
-        m_ruleSet->cascadeLayerForIdentifier(layersInPriorityOrder[i]).priority = priority;
-    }
+    for (unsigned priority = 0; priority < layerCount; ++priority)
+        m_ruleSet->cascadeLayerForIdentifier(layersInPriorityOrder[priority]).priority = priority;
 }
 
 void RuleSetBuilder::addMutatingRulesToResolver()

Modified: trunk/Source/WebCore/style/StyleScopeOrdinal.h (285420 => 285421)


--- trunk/Source/WebCore/style/StyleScopeOrdinal.h	2021-11-08 19:34:25 UTC (rev 285420)
+++ trunk/Source/WebCore/style/StyleScopeOrdinal.h	2021-11-08 19:44:23 UTC (rev 285421)
@@ -29,25 +29,23 @@
 
 // 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 : int8_t {
-    ContainingHostLimit = std::numeric_limits<int8_t>::min(),
+enum class ScopeOrdinal : int {
     ContainingHost = -1, // ::part rules and author-exposed UA pseudo classes from the host tree scope. Values less than ContainingHost indicate enclosing scopes.
     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.
-    SlotLimit = std::numeric_limits<int8_t>::max() - 1,
-    Shadow = std::numeric_limits<int8_t>::max(), // :host rules in element's own shadow tree.
+    Shadow = std::numeric_limits<int>::max(), // :host rules in element's own shadow tree.
 };
 
 inline ScopeOrdinal& operator++(ScopeOrdinal& ordinal)
 {
-    ASSERT(ordinal < ScopeOrdinal::SlotLimit);
-    return ordinal = static_cast<ScopeOrdinal>(static_cast<int8_t>(ordinal) + 1);
+    ASSERT(ordinal < ScopeOrdinal::Shadow);
+    return ordinal = static_cast<ScopeOrdinal>(static_cast<int>(ordinal) + 1);
 }
 
 inline ScopeOrdinal& operator--(ScopeOrdinal& ordinal)
 {
-    ASSERT(ordinal > ScopeOrdinal::ContainingHostLimit);
-    return ordinal = static_cast<ScopeOrdinal>(static_cast<int8_t>(ordinal) - 1);
+    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