Title: [275610] trunk/Source/WebCore
Revision
275610
Author
[email protected]
Date
2021-04-07 10:06:09 -0700 (Wed, 07 Apr 2021)

Log Message

Wasted vector capacity in StyleRuleKeyframes
https://bugs.webkit.org/show_bug.cgi?id=224264

Reviewed by Antti Koivisto.

Shrink StyleRuleKeyframes::m_keyframes. Saves 23KB on youtube.com.

* css/CSSKeyframesRule.cpp:
(WebCore::StyleRuleKeyframes::shrinkToFit):
* css/CSSKeyframesRule.h:
* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::consumeKeyframesRule):
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::consumeAnimationShorthand):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (275609 => 275610)


--- trunk/Source/WebCore/ChangeLog	2021-04-07 16:56:14 UTC (rev 275609)
+++ trunk/Source/WebCore/ChangeLog	2021-04-07 17:06:09 UTC (rev 275610)
@@ -1,5 +1,22 @@
 2021-04-07  Simon Fraser  <[email protected]>
 
+        Wasted vector capacity in StyleRuleKeyframes
+        https://bugs.webkit.org/show_bug.cgi?id=224264
+
+        Reviewed by Antti Koivisto.
+
+        Shrink StyleRuleKeyframes::m_keyframes. Saves 23KB on youtube.com.
+
+        * css/CSSKeyframesRule.cpp:
+        (WebCore::StyleRuleKeyframes::shrinkToFit):
+        * css/CSSKeyframesRule.h:
+        * css/parser/CSSParserImpl.cpp:
+        (WebCore::CSSParserImpl::consumeKeyframesRule):
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::CSSPropertyParser::consumeAnimationShorthand):
+
+2021-04-07  Simon Fraser  <[email protected]>
+
         Wasted vector capacity in StyleSheetContents
         https://bugs.webkit.org/show_bug.cgi?id=224250
 

Modified: trunk/Source/WebCore/css/CSSKeyframesRule.cpp (275609 => 275610)


--- trunk/Source/WebCore/css/CSSKeyframesRule.cpp	2021-04-07 16:56:14 UTC (rev 275609)
+++ trunk/Source/WebCore/css/CSSKeyframesRule.cpp	2021-04-07 17:06:09 UTC (rev 275610)
@@ -118,6 +118,11 @@
     return WTF::nullopt;
 }
 
+void StyleRuleKeyframes::shrinkToFit()
+{
+    m_keyframes.shrinkToFit();
+}
+
 CSSKeyframesRule::CSSKeyframesRule(StyleRuleKeyframes& keyframesRule, CSSStyleSheet* parent)
     : CSSRule(parent)
     , m_keyframesRule(keyframesRule)

Modified: trunk/Source/WebCore/css/CSSKeyframesRule.h (275609 => 275610)


--- trunk/Source/WebCore/css/CSSKeyframesRule.h	2021-04-07 16:56:14 UTC (rev 275609)
+++ trunk/Source/WebCore/css/CSSKeyframesRule.h	2021-04-07 17:06:09 UTC (rev 275610)
@@ -60,6 +60,8 @@
 
     Ref<StyleRuleKeyframes> copy() const { return adoptRef(*new StyleRuleKeyframes(*this)); }
 
+    void shrinkToFit();
+
 private:
     explicit StyleRuleKeyframes(const AtomString&);
     StyleRuleKeyframes(const AtomString&, std::unique_ptr<DeferredStyleGroupRuleList>&&);

Modified: trunk/Source/WebCore/css/parser/CSSParserImpl.cpp (275609 => 275610)


--- trunk/Source/WebCore/css/parser/CSSParserImpl.cpp	2021-04-07 16:56:14 UTC (rev 275609)
+++ trunk/Source/WebCore/css/parser/CSSParserImpl.cpp	2021-04-07 17:06:09 UTC (rev 275610)
@@ -630,6 +630,8 @@
 
     // FIXME-NEWPARSER: Find out why this is done. Behavior difference when prefixed?
     // keyframeRule->setVendorPrefixed(webkitPrefixed);
+    
+    keyframeRule->shrinkToFit();
     return keyframeRule;
 }
 

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (275609 => 275610)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2021-04-07 16:56:14 UTC (rev 275609)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2021-04-07 17:06:09 UTC (rev 275610)
@@ -1668,7 +1668,7 @@
                 if (parsedLonghand[i])
                     continue;
 
-                if (RefPtr<CSSValue> value = consumeAnimationValue(shorthand.properties()[i], m_range, m_context)) {
+                if (auto value = consumeAnimationValue(shorthand.properties()[i], m_range, m_context)) {
                     parsedLonghand[i] = true;
                     foundProperty = true;
                     longhands[i]->append(*value);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to