Title: [288907] trunk/Source/WebCore
Revision
288907
Author
[email protected]
Date
2022-02-01 13:06:43 -0800 (Tue, 01 Feb 2022)

Log Message

Refactor KeyframesRuleMap to use AtomString for the key
https://bugs.webkit.org/show_bug.cgi?id=235962

Reviewed by Antti Koivisto.

It was noted during review of https://bugs.webkit.org/show_bug.cgi?id=229437 that we
ought to use an AtomString instead of an AtomStringImpl* as a key for m_keyframesRuleMap.

* style/StyleResolver.cpp:
(WebCore::Style::Resolver::addKeyframeStyle):
(WebCore::Style::Resolver::isAnimationNameValid):
(WebCore::Style::Resolver::keyframeRulesForName const):
* style/StyleResolver.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (288906 => 288907)


--- trunk/Source/WebCore/ChangeLog	2022-02-01 20:34:28 UTC (rev 288906)
+++ trunk/Source/WebCore/ChangeLog	2022-02-01 21:06:43 UTC (rev 288907)
@@ -1,3 +1,19 @@
+2022-02-01  Antoine Quint  <[email protected]>
+
+        Refactor KeyframesRuleMap to use AtomString for the key
+        https://bugs.webkit.org/show_bug.cgi?id=235962
+
+        Reviewed by Antti Koivisto.
+
+        It was noted during review of https://bugs.webkit.org/show_bug.cgi?id=229437 that we
+        ought to use an AtomString instead of an AtomStringImpl* as a key for m_keyframesRuleMap.
+
+        * style/StyleResolver.cpp:
+        (WebCore::Style::Resolver::addKeyframeStyle):
+        (WebCore::Style::Resolver::isAnimationNameValid):
+        (WebCore::Style::Resolver::keyframeRulesForName const):
+        * style/StyleResolver.h:
+
 2022-02-01  Antti Koivisto  <[email protected]>
 
         [CSS Container Queries] Ensure query containers have valid layout before resolving the subtree

Modified: trunk/Source/WebCore/style/StyleResolver.cpp (288906 => 288907)


--- trunk/Source/WebCore/style/StyleResolver.cpp	2022-02-01 20:34:28 UTC (rev 288906)
+++ trunk/Source/WebCore/style/StyleResolver.cpp	2022-02-01 21:06:43 UTC (rev 288907)
@@ -195,8 +195,8 @@
 // This is a simplified style setting function for keyframe styles
 void Resolver::addKeyframeStyle(Ref<StyleRuleKeyframes>&& rule)
 {
-    AtomString animationName(rule->name());
-    m_keyframesRuleMap.set(animationName.impl(), WTFMove(rule));
+    auto& animationName = rule->name();
+    m_keyframesRuleMap.set(animationName, WTFMove(rule));
     m_document.keyframesRuleDidChange(animationName);
 }
 
@@ -307,7 +307,7 @@
 
 bool Resolver::isAnimationNameValid(const String& name)
 {
-    return m_keyframesRuleMap.find(AtomString(name).impl()) != m_keyframesRuleMap.end();
+    return m_keyframesRuleMap.find(AtomString(name)) != m_keyframesRuleMap.end();
 }
 
 Vector<Ref<StyleRuleKeyframe>> Resolver::keyframeRulesForName(const AtomString& animationName) const
@@ -317,7 +317,7 @@
 
     m_keyframesRuleMap.checkConsistency();
 
-    auto it = m_keyframesRuleMap.find(animationName.impl());
+    auto it = m_keyframesRuleMap.find(animationName);
     if (it == m_keyframesRuleMap.end())
         return { };
 

Modified: trunk/Source/WebCore/style/StyleResolver.h (288906 => 288907)


--- trunk/Source/WebCore/style/StyleResolver.h	2022-02-01 20:34:28 UTC (rev 288906)
+++ trunk/Source/WebCore/style/StyleResolver.h	2022-02-01 21:06:43 UTC (rev 288907)
@@ -164,7 +164,7 @@
 
     ScopeRuleSets m_ruleSets;
 
-    typedef HashMap<AtomStringImpl*, RefPtr<StyleRuleKeyframes>> KeyframesRuleMap;
+    typedef HashMap<AtomString, RefPtr<StyleRuleKeyframes>> KeyframesRuleMap;
     KeyframesRuleMap m_keyframesRuleMap;
 
     MediaQueryEvaluator m_mediaQueryEvaluator;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to