Title: [262897] trunk/Source/WebCore
Revision
262897
Author
[email protected]
Date
2020-06-11 00:52:46 -0700 (Thu, 11 Jun 2020)

Log Message

[Web Animations] Setting the style at the last style change event to null should not create an ElementAnimationRareData object
https://bugs.webkit.org/show_bug.cgi?id=213070
<rdar://problem/63841893>

Reviewed by Tim Horton.

In r262154 we added code that records the pre-animation style for a given element in
Style::TreeResolver::createAnimatedElementUpdate(), which is in Web Animations spec
parlance the style at the last style change event. This style is set on the backing
ElementAnimationRareData object for the given Element. For any element that did not
actually have any animations, we would set this style to null, but the function on
Element acting as a go-between would always create the backing ElementAnimationRareData
even though it would set a null value. We now only creaste the ElementAnimationRareData
object if there is a value to be stored, which fixes a performance regression in the
Speedometer2 test.

* dom/Element.cpp:
(WebCore::Element::setLastStyleChangeEventStyle):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (262896 => 262897)


--- trunk/Source/WebCore/ChangeLog	2020-06-11 07:50:12 UTC (rev 262896)
+++ trunk/Source/WebCore/ChangeLog	2020-06-11 07:52:46 UTC (rev 262897)
@@ -1,3 +1,24 @@
+2020-06-11  Antoine Quint  <[email protected]>
+
+        [Web Animations] Setting the style at the last style change event to null should not create an ElementAnimationRareData object
+        https://bugs.webkit.org/show_bug.cgi?id=213070
+        <rdar://problem/63841893>
+
+        Reviewed by Tim Horton.
+
+        In r262154 we added code that records the pre-animation style for a given element in
+        Style::TreeResolver::createAnimatedElementUpdate(), which is in Web Animations spec
+        parlance the style at the last style change event. This style is set on the backing
+        ElementAnimationRareData object for the given Element. For any element that did not
+        actually have any animations, we would set this style to null, but the function on
+        Element acting as a go-between would always create the backing ElementAnimationRareData
+        even though it would set a null value. We now only creaste the ElementAnimationRareData
+        object if there is a value to be stored, which fixes a performance regression in the
+        Speedometer2 test.
+
+        * dom/Element.cpp:
+        (WebCore::Element::setLastStyleChangeEventStyle):
+
 2020-06-10  Beth Dakin  <[email protected]>
 
         Replace instances of blacklist in WebCore with blocklist

Modified: trunk/Source/WebCore/dom/Element.cpp (262896 => 262897)


--- trunk/Source/WebCore/dom/Element.cpp	2020-06-11 07:50:12 UTC (rev 262896)
+++ trunk/Source/WebCore/dom/Element.cpp	2020-06-11 07:52:46 UTC (rev 262897)
@@ -3909,7 +3909,10 @@
 
 void Element::setLastStyleChangeEventStyle(std::unique_ptr<const RenderStyle>&& style)
 {
-    ensureAnimationRareData().setLastStyleChangeEventStyle(WTFMove(style));
+    if (auto* animationData = animationRareData())
+        animationData->setLastStyleChangeEventStyle(WTFMove(style));
+    else if (style)
+        ensureAnimationRareData().setLastStyleChangeEventStyle(WTFMove(style));
 }
 
 #if ENABLE(RESIZE_OBSERVER)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to