Title: [175944] releases/WebKitGTK/webkit-2.6
Revision
175944
Author
[email protected]
Date
2014-11-11 09:32:09 -0800 (Tue, 11 Nov 2014)

Log Message

Merge r175525 - Fix animation of orient attribute on marker element
https://bugs.webkit.org/show_bug.cgi?id=137942

Source/WebCore:

Patch by Nikos Andronikos <[email protected]> on 2014-11-04
Reviewed by Dirk Schulze.

Fixed implementation of SVG animated angles and the SVG
marker element orient attribute.
SVG animated angle was missing the logic to support animation
from auto to a numeric angle value - this is now added.
The SVG marker element getter for orientType was not returning
the animated value for orientType so in some cases (i.e. when
the initial value and the animated values were of different types)
the animation was not being rendered - although it was running.

Tests: svg/animations/animate-marker-orienttype-1.html
       svg/animations/animate-marker-orienttype-2.html
       svg/animations/animate-marker-orienttype-3.html

* svg/SVGAnimatedAngle.cpp:
(WebCore::SVGAnimatedAngleAnimator::calculateAnimatedValue):
Added logic to support auto to angle animation.
* svg/SVGMarkerElement.cpp:
(WebCore::SVGMarkerElement::orientType):
This method now returns the animated value if an animation is
running.
* svg/SVGMarkerElement.h:

LayoutTests:

Patch by Nikos Andrkos Andronikos <[email protected]> on 2014-11-04
Reviewed by Dirk Schulze.

Test the rendered result of the animation of the orient attribute.
Existing tests were only testing the animated value in the DOM.

* svg/animations/animate-marker-orienttype-1-expected.txt: Added.
* svg/animations/animate-marker-orienttype-1.html: Added.
* svg/animations/animate-marker-orienttype-2-expected.txt: Added.
* svg/animations/animate-marker-orienttype-2.html: Added.
* svg/animations/animate-marker-orienttype-3-expected.txt: Added.
* svg/animations/animate-marker-orienttype-3.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.6/LayoutTests/ChangeLog (175943 => 175944)


--- releases/WebKitGTK/webkit-2.6/LayoutTests/ChangeLog	2014-11-11 17:25:14 UTC (rev 175943)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/ChangeLog	2014-11-11 17:32:09 UTC (rev 175944)
@@ -1,3 +1,20 @@
+2014-11-04  Nikos Andrkos Andronikos  <[email protected]>
+
+        Fix animation of orient attribute on marker element
+        https://bugs.webkit.org/show_bug.cgi?id=137942
+
+        Reviewed by Dirk Schulze.
+
+        Test the rendered result of the animation of the orient attribute.
+        Existing tests were only testing the animated value in the DOM.
+
+        * svg/animations/animate-marker-orienttype-1-expected.txt: Added.
+        * svg/animations/animate-marker-orienttype-1.html: Added.
+        * svg/animations/animate-marker-orienttype-2-expected.txt: Added.
+        * svg/animations/animate-marker-orienttype-2.html: Added.
+        * svg/animations/animate-marker-orienttype-3-expected.txt: Added.
+        * svg/animations/animate-marker-orienttype-3.html: Added.
+
 2014-10-31  Benjamin Poulain  <[email protected]>
 
         Pseudo classes with an escaped parenthesis generate invalid rules

Added: releases/WebKitGTK/webkit-2.6/LayoutTests/svg/animations/animate-marker-orienttype-1-expected.txt (0 => 175944)


--- releases/WebKitGTK/webkit-2.6/LayoutTests/svg/animations/animate-marker-orienttype-1-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/svg/animations/animate-marker-orienttype-1-expected.txt	2014-11-11 17:32:09 UTC (rev 175944)
@@ -0,0 +1,11 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x520
+  RenderBlock {HTML} at (0,0) size 800x520
+    RenderBody {BODY} at (8,8) size 784x504
+      RenderSVGRoot {svg} at (58,58) size 218x218
+        RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+          RenderSVGResourceMarker {marker} [id="arrow"] [markerUnits=strokeWidth] [ref at (0,0)] [angle=180.00]
+            RenderSVGPath {path} at (8,8) size 17x17 [opacity=0.50] [fill={[type=SOLID] [color=#008000]}] [data="" 5 0 L 0 -5 L 0 5 Z"]
+        RenderSVGPath {path} at (58,58) size 218x218 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#000000]}] [start marker=arrow] [data="" 20 20 L 80 80"]
+      RenderText {#text} at (0,0) size 0x0

Added: releases/WebKitGTK/webkit-2.6/LayoutTests/svg/animations/animate-marker-orienttype-1.html (0 => 175944)


--- releases/WebKitGTK/webkit-2.6/LayoutTests/svg/animations/animate-marker-orienttype-1.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/svg/animations/animate-marker-orienttype-1.html	2014-11-11 17:32:09 UTC (rev 175944)
@@ -0,0 +1,25 @@
+<!doctype html>
+<!--
+  Test that the renderer uses the animated value of orientType.
+  To test this, the final animated value must be of a different type than the initial value.
+  To verify rendering, DumpRenderTree output must be examined, not DOM values.
+ -->
+<script>
+function doTest() {
+    if (testRunner) {
+        var svg = document.querySelector("svg");
+        svg.pauseAnimations();
+        svg.setCurrentTime(5);
+    }
+}
+</script>
+<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 150 150" width="500" height="500" _onload_="doTest()">
+    <defs>
+        <marker id="arrow" orient="auto" markerWidth="10" markerHeight="10" style="overflow:visible">
+            <path d="M5,0 L 0,-5 L0,5 z" fill="green" opacity="0.5" />
+            <animate attributeName="orient" from="0" to="180" begin="0s" dur="1s" fill="freeze"/>
+        </marker>
+    </defs>
+    <path d="M 20,20 L 80,80" marker-start="url(#arrow)" stroke="black"/>
+</svg>
+

Added: releases/WebKitGTK/webkit-2.6/LayoutTests/svg/animations/animate-marker-orienttype-2-expected.txt (0 => 175944)


--- releases/WebKitGTK/webkit-2.6/LayoutTests/svg/animations/animate-marker-orienttype-2-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/svg/animations/animate-marker-orienttype-2-expected.txt	2014-11-11 17:32:09 UTC (rev 175944)
@@ -0,0 +1,11 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x520
+  RenderBlock {HTML} at (0,0) size 800x520
+    RenderBody {BODY} at (8,8) size 784x504
+      RenderSVGRoot {svg} at (58,71) size 218x205
+        RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+          RenderSVGResourceMarker {marker} [id="arrow"] [markerUnits=strokeWidth] [ref at (0,0)] [angle=80.00]
+            RenderSVGPath {path} at (8,8) size 17x17 [opacity=0.50] [fill={[type=SOLID] [color=#008000]}] [data="" 5 0 L 0 -5 L 0 5 Z"]
+        RenderSVGPath {path} at (58,71) size 218x205 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#000000]}] [start marker=arrow] [data="" 20 20 L 80 80"]
+      RenderText {#text} at (0,0) size 0x0

Added: releases/WebKitGTK/webkit-2.6/LayoutTests/svg/animations/animate-marker-orienttype-2.html (0 => 175944)


--- releases/WebKitGTK/webkit-2.6/LayoutTests/svg/animations/animate-marker-orienttype-2.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/svg/animations/animate-marker-orienttype-2.html	2014-11-11 17:32:09 UTC (rev 175944)
@@ -0,0 +1,25 @@
+<!doctype html>
+<!--
+  Test that the renderer uses the animated value of orientType.
+  To test this, the final animated value must be of a different type than the initial value.
+  To verify rendering, DumpRenderTree output must be examined, not DOM values.
+ -->
+<script>
+function doTest() {
+    if (testRunner) {
+        var svg = document.querySelector("svg");
+        svg.pauseAnimations();
+        svg.setCurrentTime(5);
+    }
+}
+</script>
+<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 150 150" width="500" height="500" _onload_="doTest()">
+    <defs>
+        <marker id="arrow" orient="auto" markerWidth="10" markerHeight="10" style="overflow:visible">
+            <path d="M5,0 L 0,-5 L0,5 z" fill="green" opacity="0.5" />
+            <animate attributeName="orient" from="auto" to="80" begin="0s" dur="1s" fill="freeze"/>
+        </marker>
+    </defs>
+    <path d="M 20,20 L 80,80" marker-start="url(#arrow)" stroke="black"/>
+</svg>
+

Added: releases/WebKitGTK/webkit-2.6/LayoutTests/svg/animations/animate-marker-orienttype-3-expected.txt (0 => 175944)


--- releases/WebKitGTK/webkit-2.6/LayoutTests/svg/animations/animate-marker-orienttype-3-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/svg/animations/animate-marker-orienttype-3-expected.txt	2014-11-11 17:32:09 UTC (rev 175944)
@@ -0,0 +1,11 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x520
+  RenderBlock {HTML} at (0,0) size 800x520
+    RenderBody {BODY} at (8,8) size 784x504
+      RenderSVGRoot {svg} at (62,62) size 214x214
+        RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+          RenderSVGResourceMarker {marker} [id="arrow"] [markerUnits=strokeWidth] [ref at (0,0)] [angle=auto]
+            RenderSVGPath {path} at (8,8) size 17x17 [opacity=0.50] [fill={[type=SOLID] [color=#008000]}] [data="" 5 0 L 0 -5 L 0 5 Z"]
+        RenderSVGPath {path} at (62,62) size 214x214 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#000000]}] [start marker=arrow] [data="" 20 20 L 80 80"]
+      RenderText {#text} at (0,0) size 0x0

Added: releases/WebKitGTK/webkit-2.6/LayoutTests/svg/animations/animate-marker-orienttype-3.html (0 => 175944)


--- releases/WebKitGTK/webkit-2.6/LayoutTests/svg/animations/animate-marker-orienttype-3.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/svg/animations/animate-marker-orienttype-3.html	2014-11-11 17:32:09 UTC (rev 175944)
@@ -0,0 +1,25 @@
+<!doctype html>
+<!--
+  Test that the renderer uses the animated value of orientType.
+  To test this, the final animated value must be of a different type than the initial value.
+  To verify rendering, DumpRenderTree output must be examined, not DOM values.
+ -->
+<script>
+function doTest() {
+    if (testRunner) {
+        var svg = document.querySelector("svg");
+        svg.pauseAnimations();
+        svg.setCurrentTime(5);
+    }
+}
+</script>
+<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 150 150" width="500" height="500" _onload_="doTest()">
+    <defs>
+        <marker id="arrow" orient="45" markerWidth="10" markerHeight="10" style="overflow:visible">
+            <path d="M5,0 L 0,-5 L0,5 z" fill="green" opacity="0.5" />
+            <animate attributeName="orient" from="135" to="auto" begin="0s" dur="1s" fill="freeze"/>
+        </marker>
+    </defs>
+    <path d="M 20,20 L 80,80" marker-start="url(#arrow)" stroke="black"/>
+</svg>
+

Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog (175943 => 175944)


--- releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog	2014-11-11 17:25:14 UTC (rev 175943)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog	2014-11-11 17:32:09 UTC (rev 175944)
@@ -1,3 +1,32 @@
+2014-11-04  Nikos Andronikos  <[email protected]>
+
+        Fix animation of orient attribute on marker element
+        https://bugs.webkit.org/show_bug.cgi?id=137942
+
+        Reviewed by Dirk Schulze.
+
+        Fixed implementation of SVG animated angles and the SVG
+        marker element orient attribute.
+        SVG animated angle was missing the logic to support animation
+        from auto to a numeric angle value - this is now added.
+        The SVG marker element getter for orientType was not returning
+        the animated value for orientType so in some cases (i.e. when
+        the initial value and the animated values were of different types)
+        the animation was not being rendered - although it was running.
+
+        Tests: svg/animations/animate-marker-orienttype-1.html
+               svg/animations/animate-marker-orienttype-2.html
+               svg/animations/animate-marker-orienttype-3.html
+
+        * svg/SVGAnimatedAngle.cpp:
+        (WebCore::SVGAnimatedAngleAnimator::calculateAnimatedValue):
+        Added logic to support auto to angle animation.
+        * svg/SVGMarkerElement.cpp:
+        (WebCore::SVGMarkerElement::orientType):
+        This method now returns the animated value if an animation is
+        running.
+        * svg/SVGMarkerElement.h:
+
 2014-11-03  Andreas Kling  <[email protected]>
 
         RenderCounter shouldn't need a pre-destructor hook.

Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/svg/SVGAnimatedAngle.cpp (175943 => 175944)


--- releases/WebKitGTK/webkit-2.6/Source/WebCore/svg/SVGAnimatedAngle.cpp	2014-11-11 17:25:14 UTC (rev 175943)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/svg/SVGAnimatedAngle.cpp	2014-11-11 17:32:09 UTC (rev 175944)
@@ -96,23 +96,21 @@
     std::pair<SVGAngle, unsigned>& animatedAngleAndEnumeration = animated->angleAndEnumeration();
 
     if (fromAngleAndEnumeration.second != toAngleAndEnumeration.second) {
-        // Animating from eg. auto to 90deg, or auto to 90deg.
-        if (fromAngleAndEnumeration.second == SVGMarkerOrientAngle) {
-            // Animating from an angle value to eg. 'auto' - this disabled additive as 'auto' is a keyword..
-            if (toAngleAndEnumeration.second == SVGMarkerOrientAuto) {
-                if (percentage < 0.5f) {
-                    animatedAngleAndEnumeration.first = fromAngleAndEnumeration.first;
-                    animatedAngleAndEnumeration.second = SVGMarkerOrientAngle;
-                    return;
-                }
+        // Discrete animation - no linear interpolation possible between values (e.g. auto to angle).
+        if (percentage < 0.5f) {
+            animatedAngleAndEnumeration.second = fromAngleAndEnumeration.second;
+            if (fromAngleAndEnumeration.second == SVGMarkerOrientAngle)
+                animatedAngleAndEnumeration.first = fromAngleAndEnumeration.first;
+            else
                 animatedAngleAndEnumeration.first.setValue(0);
-                animatedAngleAndEnumeration.second = SVGMarkerOrientAuto;
-                return;
-            }
-            animatedAngleAndEnumeration.first.setValue(0);
-            animatedAngleAndEnumeration.second = SVGMarkerOrientUnknown;
             return;
         }
+        animatedAngleAndEnumeration.second = toAngleAndEnumeration.second;
+        if (toAngleAndEnumeration.second == SVGMarkerOrientAngle)
+            animatedAngleAndEnumeration.first = toAngleAndEnumeration.first;
+        else
+            animatedAngleAndEnumeration.first.setValue(0);
+        return;
     }
 
     // From 'auto' to 'auto'.

Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/svg/SVGMarkerElement.cpp (175943 => 175944)


--- releases/WebKitGTK/webkit-2.6/Source/WebCore/svg/SVGMarkerElement.cpp	2014-11-11 17:25:14 UTC (rev 175943)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/svg/SVGMarkerElement.cpp	2014-11-11 17:32:09 UTC (rev 175944)
@@ -248,7 +248,18 @@
     return SVGAnimatedProperty::lookupOrCreateWrapper<SVGMarkerElement, SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>, SVGMarkerOrientType>
            (ownerType, orientTypePropertyInfo(), ownerType->m_orientType.value);
 }
-  
+
+SVGMarkerOrientType& SVGMarkerElement::orientType() const
+{
+    if (SVGAnimatedEnumeration* wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, SVGAnimatedEnumeration>(this, orientTypePropertyInfo())) {
+        if (wrapper->isAnimating()) {
+            ASSERT(wrapper->currentAnimatedValue() >= 0 && wrapper->currentAnimatedValue() < SVGMarkerOrientMax);
+            return reinterpret_cast<SVGMarkerOrientType&>(wrapper->currentAnimatedValue());
+        }
+    }
+    return m_orientType.value;
+}
+
 PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> SVGMarkerElement::orientTypeAnimated()
 {
     m_orientType.shouldSynchronize = true;

Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/svg/SVGMarkerElement.h (175943 => 175944)


--- releases/WebKitGTK/webkit-2.6/Source/WebCore/svg/SVGMarkerElement.h	2014-11-11 17:25:14 UTC (rev 175943)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/svg/SVGMarkerElement.h	2014-11-11 17:32:09 UTC (rev 175944)
@@ -42,7 +42,10 @@
 enum SVGMarkerOrientType {
     SVGMarkerOrientUnknown = 0,
     SVGMarkerOrientAuto,
-    SVGMarkerOrientAngle
+    SVGMarkerOrientAngle,
+
+    // Add new elements before here.
+    SVGMarkerOrientMax
 };
 
 template<>
@@ -155,7 +158,7 @@
     // Custom 'orientType' property.
     static void synchronizeOrientType(SVGElement* contextElement);
     static PassRefPtr<SVGAnimatedProperty> lookupOrCreateOrientTypeWrapper(SVGElement* contextElement);
-    SVGMarkerOrientType& orientType() const { return m_orientType.value; }
+    SVGMarkerOrientType& orientType() const;
     SVGMarkerOrientType& orientTypeBaseValue() const { return m_orientType.value; }
     void setOrientTypeBaseValue(const SVGMarkerOrientType& type) { m_orientType.value = type; }
     PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> orientTypeAnimated();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to