Title: [239090] trunk
Revision
239090
Author
[email protected]
Date
2018-12-11 14:34:40 -0800 (Tue, 11 Dec 2018)

Log Message

Don't attempt to compute animated values when there is no relevant animation
https://bugs.webkit.org/show_bug.cgi?id=192591
<rdar://problem/34336946>

Reviewed by Dean Jackson.

Source/WebCore:

Check if the property is supposed to be animated, or has animatable features, before
attempting to calculate the current animated value.

Test: svg/animations/avoid-calculating-for-non-animating-elements.html

* svg/SVGAnimateElementBase.cpp:
(WebCore::SVGAnimateElementBase::calculateAnimatedValue):

LayoutTests:

* svg/animations/avoid-calculating-for-non-animating-elements-expected.txt: Added.
* svg/animations/avoid-calculating-for-non-animating-elements.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (239089 => 239090)


--- trunk/LayoutTests/ChangeLog	2018-12-11 22:00:30 UTC (rev 239089)
+++ trunk/LayoutTests/ChangeLog	2018-12-11 22:34:40 UTC (rev 239090)
@@ -1,3 +1,14 @@
+2018-12-11  Brent Fulgham  <[email protected]>
+
+        Don't attempt to compute animated values when there is no relevant animation
+        https://bugs.webkit.org/show_bug.cgi?id=192591
+        <rdar://problem/34336946>
+
+        Reviewed by Dean Jackson.
+
+        * svg/animations/avoid-calculating-for-non-animating-elements-expected.txt: Added.
+        * svg/animations/avoid-calculating-for-non-animating-elements.html: Added.
+
 2018-12-11  Chris Dumez  <[email protected]>
 
         Unreviewed, fix typos in console log from r239087.

Added: trunk/LayoutTests/svg/animations/avoid-calculating-for-non-animating-elements-expected.txt (0 => 239090)


--- trunk/LayoutTests/svg/animations/avoid-calculating-for-non-animating-elements-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/animations/avoid-calculating-for-non-animating-elements-expected.txt	2018-12-11 22:34:40 UTC (rev 239090)
@@ -0,0 +1,4 @@
+The test passes if it does not crash.
+
+A certain amount of content is needed in the page to trigger the bug. A certain amount of content is needed in the page to trigger the bug. A certain amount of content is needed in the page to trigger the bug. A certain amount of content is needed in the page to trigger the bug. A certain amount of content is needed in the page to trigger the bug. A certain amount of content is needed in the page to trigger the bug. A certain amount of content is needed in the page to trigger the bug. A certain amount of content is needed in the page to trigger the bug. A certain amount of content is needed in the page to trigger the bug. A certain amount of content is needed in the page to trigger the bug. A certain amount of content is needed in the page to trigger the bug. A certain amount of content is needed in the page to trigger the bug.
+

Added: trunk/LayoutTests/svg/animations/avoid-calculating-for-non-animating-elements.html (0 => 239090)


--- trunk/LayoutTests/svg/animations/avoid-calculating-for-non-animating-elements.html	                        (rev 0)
+++ trunk/LayoutTests/svg/animations/avoid-calculating-for-non-animating-elements.html	2018-12-11 22:34:40 UTC (rev 239090)
@@ -0,0 +1,32 @@
+<!DOCTYPE html> 
+<html>
+<head>
+    <title>Test request animation value for non-animating element</title>
+    <script>
+    if (window.testRunner)
+        testRunner.dumpAsText(true);
+    </script>
+</head>
+<body>
+    <p>The test passes if it does not crash.</p>
+    <div>
+        A certain amount of content is needed in the page to trigger the bug.
+        A certain amount of content is needed in the page to trigger the bug.
+        A certain amount of content is needed in the page to trigger the bug.
+        A certain amount of content is needed in the page to trigger the bug.
+        A certain amount of content is needed in the page to trigger the bug.
+        A certain amount of content is needed in the page to trigger the bug.
+        A certain amount of content is needed in the page to trigger the bug.
+        A certain amount of content is needed in the page to trigger the bug.
+        A certain amount of content is needed in the page to trigger the bug.
+        A certain amount of content is needed in the page to trigger the bug.
+        A certain amount of content is needed in the page to trigger the bug.
+        A certain amount of content is needed in the page to trigger the bug.
+    </div>
+    <svg>
+        <textPath>
+            <animate to="1px" from="0px" attributeName="x" attributeType="XML" />
+        </textPath>
+    </svg>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (239089 => 239090)


--- trunk/Source/WebCore/ChangeLog	2018-12-11 22:00:30 UTC (rev 239089)
+++ trunk/Source/WebCore/ChangeLog	2018-12-11 22:34:40 UTC (rev 239090)
@@ -1,3 +1,19 @@
+2018-12-11  Brent Fulgham  <[email protected]>
+
+        Don't attempt to compute animated values when there is no relevant animation
+        https://bugs.webkit.org/show_bug.cgi?id=192591
+        <rdar://problem/34336946>
+
+        Reviewed by Dean Jackson.
+
+        Check if the property is supposed to be animated, or has animatable features, before
+        attempting to calculate the current animated value.
+
+        Test: svg/animations/avoid-calculating-for-non-animating-elements.html
+
+        * svg/SVGAnimateElementBase.cpp:
+        (WebCore::SVGAnimateElementBase::calculateAnimatedValue):
+
 2018-12-11  Chris Dumez  <[email protected]>
 
         Unreviewed, fix typos in console log from r239087.

Modified: trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp (239089 => 239090)


--- trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp	2018-12-11 22:00:30 UTC (rev 239089)
+++ trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp	2018-12-11 22:34:40 UTC (rev 239090)
@@ -91,6 +91,12 @@
     if (!targetElement)
         return;
 
+    const QualifiedName& attributeName = this->attributeName();
+    ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement.get(), attributeName);
+    
+    if (shouldApply == DontApplyAnimation)
+        return;
+
     ASSERT(m_animatedPropertyType == determineAnimatedPropertyType(*targetElement));
 
     ASSERT(percentage >= 0 && percentage <= 1);
@@ -102,6 +108,12 @@
     ASSERT(m_fromType->type() == m_animatedPropertyType);
     ASSERT(m_toType);
 
+    if (shouldApply == ApplyXMLAnimation || shouldApply == ApplyXMLandCSSAnimation) {
+        // SVG DOM animVal animation code-path.
+        if (m_animator->findAnimatedPropertiesForAttributeName(*targetElement, attributeName).isEmpty())
+            return;
+    }
+
     SVGAnimateElementBase& resultAnimationElement = downcast<SVGAnimateElementBase>(*resultElement);
     ASSERT(resultAnimationElement.m_animatedType);
     ASSERT(resultAnimationElement.m_animatedPropertyType == m_animatedPropertyType);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to