<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[197738] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/197738">197738</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-03-08 00:20:22 -0800 (Tue, 08 Mar 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>[SVG2] Implement marker orient='auto-start-reverse'
https://bugs.webkit.org/show_bug.cgi?id=138456
Patch by Nikos Andronikos <nikos.andronikos-webkit@cisra.canon.com.au> on 2016-03-08
Reviewed by Darin Adler.
Source/WebCore:
https://www.w3.org/TR/SVG2/painting.html#OrientAttribute
marker-start markers must be oriented at 180 degrees to the direction of the path when
the orient attribute of the marker is set to 'auto-start-reverse'.
To acheive this the SVGMarkerData class which calculates the angles for each marker on
a path must know whether the orient type is set to reverse the start marker.
Tests: svg/animations/animate-marker-orient-from-angle-to-autostartreverse.html
svg/animations/animate-marker-orienttype-4.html
svg/custom/marker-auto-start-reverse.html
* rendering/svg/RenderSVGShape.cpp:
(WebCore::RenderSVGShape::processMarkerPositions):
Create marker data, using animated value of orient to determine
if first marker should be reversed.
* rendering/svg/SVGMarkerData.h:
(WebCore::SVGMarkerData::SVGMarkerData):
Constructor now requires boolean indicating if start marker is
reversed.
(WebCore::SVGMarkerData::currentAngle):
Take into account whether start marker should be reversed.
* rendering/svg/SVGResources.cpp:
(WebCore::SVGResources::markerReverseStart):
New function to query whether start marker should be reversed.
* rendering/svg/SVGResources.h:
Add declaration for new function.
* svg/SVGAnimatedAngle.cpp:
(WebCore::SVGAnimatedAngleAnimator::calculateAnimatedValue):
Support animation including the value auto-start-reverse.
* svg/SVGMarkerElement.cpp:
(WebCore::SVGMarkerElement::setOrient):
Combine duplicated functionality into one private method
(WebCore::SVGMarkerElement::setOrientToAuto):
Set orient type and angle correctly for orient=auto. Uses setOrient.
(WebCore::SVGMarkerElement::setOrientToAngle):
Set orient type and angle correctly for orient=<angle>. Uses setOrient.
(WebCore::SVGMarkerElement::synchronizeOrientType):
Support auto-start-reverse as a possible case.
* svg/SVGMarkerElement.h:
(WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue):
Limit the orient DOM property so that the new enum value
required for auto-start-reverse is not exposed.
(WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue):
Support auto-start-reverse.
(WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString):
Support auto-start-reverse.
LayoutTests:
* svg/animations/animate-marker-orient-from-angle-to-autostartreverse-expected.txt: Added.
* svg/animations/animate-marker-orient-from-angle-to-autostartreverse.html: Added.
* svg/animations/animate-marker-orienttype-4-expected.html: Added.
* svg/animations/animate-marker-orienttype-4.html: Added.
Verify output after animation has run - ensure animation reflected in visual result.
* svg/animations/script-tests/animate-marker-orient-from-angle-to-autostartreverse.js: Added.
Test DOM values at various snap-shot times throughout the animation.
(sample1):
(sample2):
(sample3):
(executeTest):
* svg/custom/marker-auto-start-reverse-expected.html: Added.
* svg/custom/marker-auto-start-reverse.html: Added.
Verify static result - start marker is oriented at 180 degrees to direction of path.
* svg/dom/SVGAnimatedEnumeration-SVGMarkerElement-expected.txt:
* svg/dom/script-tests/SVGAnimatedEnumeration-SVGMarkerElement.js:
Check attributes are treated as case sensitive.
Check UNKNOWN is returned for enum value when auto-start-reverse set.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestssvgdomSVGAnimatedEnumerationSVGMarkerElementexpectedtxt">trunk/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGMarkerElement-expected.txt</a></li>
<li><a href="#trunkLayoutTestssvgdomscripttestsSVGAnimatedEnumerationSVGMarkerElementjs">trunk/LayoutTests/svg/dom/script-tests/SVGAnimatedEnumeration-SVGMarkerElement.js</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgRenderSVGShapecpp">trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgSVGMarkerDatah">trunk/Source/WebCore/rendering/svg/SVGMarkerData.h</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgSVGResourcescpp">trunk/Source/WebCore/rendering/svg/SVGResources.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgSVGResourcesh">trunk/Source/WebCore/rendering/svg/SVGResources.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGAnimatedAnglecpp">trunk/Source/WebCore/svg/SVGAnimatedAngle.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGMarkerElementcpp">trunk/Source/WebCore/svg/SVGMarkerElement.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGMarkerElementh">trunk/Source/WebCore/svg/SVGMarkerElement.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestssvganimationsanimatemarkerorientfromangletoautostartreverseexpectedtxt">trunk/LayoutTests/svg/animations/animate-marker-orient-from-angle-to-autostartreverse-expected.txt</a></li>
<li><a href="#trunkLayoutTestssvganimationsanimatemarkerorientfromangletoautostartreversehtml">trunk/LayoutTests/svg/animations/animate-marker-orient-from-angle-to-autostartreverse.html</a></li>
<li><a href="#trunkLayoutTestssvganimationsanimatemarkerorienttype4expectedhtml">trunk/LayoutTests/svg/animations/animate-marker-orienttype-4-expected.html</a></li>
<li><a href="#trunkLayoutTestssvganimationsanimatemarkerorienttype4html">trunk/LayoutTests/svg/animations/animate-marker-orienttype-4.html</a></li>
<li><a href="#trunkLayoutTestssvganimationsscripttestsanimatemarkerorientfromangletoautostartreversejs">trunk/LayoutTests/svg/animations/script-tests/animate-marker-orient-from-angle-to-autostartreverse.js</a></li>
<li><a href="#trunkLayoutTestssvgcustommarkerautostartreverseexpectedhtml">trunk/LayoutTests/svg/custom/marker-auto-start-reverse-expected.html</a></li>
<li><a href="#trunkLayoutTestssvgcustommarkerautostartreversehtml">trunk/LayoutTests/svg/custom/marker-auto-start-reverse.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (197737 => 197738)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-03-08 08:16:29 UTC (rev 197737)
+++ trunk/LayoutTests/ChangeLog        2016-03-08 08:20:22 UTC (rev 197738)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2016-03-08 Nikos Andronikos <nikos.andronikos-webkit@cisra.canon.com.au>
+
+ [SVG2] Implement marker orient='auto-start-reverse'
+ https://bugs.webkit.org/show_bug.cgi?id=138456
+
+ Reviewed by Darin Adler.
+
+ * svg/animations/animate-marker-orient-from-angle-to-autostartreverse-expected.txt: Added.
+ * svg/animations/animate-marker-orient-from-angle-to-autostartreverse.html: Added.
+ * svg/animations/animate-marker-orienttype-4-expected.html: Added.
+ * svg/animations/animate-marker-orienttype-4.html: Added.
+ Verify output after animation has run - ensure animation reflected in visual result.
+ * svg/animations/script-tests/animate-marker-orient-from-angle-to-autostartreverse.js: Added.
+ Test DOM values at various snap-shot times throughout the animation.
+ (sample1):
+ (sample2):
+ (sample3):
+ (executeTest):
+ * svg/custom/marker-auto-start-reverse-expected.html: Added.
+ * svg/custom/marker-auto-start-reverse.html: Added.
+ Verify static result - start marker is oriented at 180 degrees to direction of path.
+ * svg/dom/SVGAnimatedEnumeration-SVGMarkerElement-expected.txt:
+ * svg/dom/script-tests/SVGAnimatedEnumeration-SVGMarkerElement.js:
+ Check attributes are treated as case sensitive.
+ Check UNKNOWN is returned for enum value when auto-start-reverse set.
+
</ins><span class="cx"> 2016-03-07 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Stop clamping HTMLElement.tabIndex to the range of a short
</span></span></pre></div>
<a id="trunkLayoutTestssvganimationsanimatemarkerorientfromangletoautostartreverseexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/animations/animate-marker-orient-from-angle-to-autostartreverse-expected.txt (0 => 197738)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/animations/animate-marker-orient-from-angle-to-autostartreverse-expected.txt         (rev 0)
+++ trunk/LayoutTests/svg/animations/animate-marker-orient-from-angle-to-autostartreverse-expected.txt        2016-03-08 08:20:22 UTC (rev 197738)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+SVG 2 dynamic animation tests
+
+Animate SVGMarkerElement orientAttr from an angle to auto-start-reverse.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS SVGMarkerElement.SVG_MARKER_ORIENT_AUTOSTARTREVERSE is undefined
+PASS marker.orientType.baseVal = 3 threw exception Error: SVG_INVALID_VALUE_ERR: DOM SVG Exception 1.
+PASS marker.orientAngle.animVal.value is 0
+PASS marker.orientAngle.baseVal.value is 0
+PASS marker.orientType.animVal is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
+PASS marker.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
+PASS marker.orientAngle.animVal.value is 90
+PASS marker.orientAngle.baseVal.value is 0
+PASS marker.orientType.animVal is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
+PASS marker.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
+PASS marker.orientAngle.animVal.value is 90
+PASS marker.orientAngle.baseVal.value is 0
+PASS marker.orientType.animVal is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
+PASS marker.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
+PASS marker.orientAngle.animVal.value is 0
+PASS marker.orientAngle.baseVal.value is 0
+PASS marker.orientType.animVal is SVGMarkerElement.SVG_MARKER_ORIENT_UNKNOWN
+PASS marker.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
+PASS marker.orientAngle.animVal.value is 0
+PASS marker.orientAngle.baseVal.value is 0
+PASS marker.orientType.animVal is SVGMarkerElement.SVG_MARKER_ORIENT_UNKNOWN
+PASS marker.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
+PASS marker.orientAngle.animVal.value is 0
+PASS marker.orientAngle.baseVal.value is 0
+PASS marker.orientType.animVal is SVGMarkerElement.SVG_MARKER_ORIENT_UNKNOWN
+PASS marker.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestssvganimationsanimatemarkerorientfromangletoautostartreversehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/animations/animate-marker-orient-from-angle-to-autostartreverse.html (0 => 197738)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/animations/animate-marker-orient-from-angle-to-autostartreverse.html         (rev 0)
+++ trunk/LayoutTests/svg/animations/animate-marker-orient-from-angle-to-autostartreverse.html        2016-03-08 08:20:22 UTC (rev 197738)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+<!doctype html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../dynamic-updates/resources/SVGTestCase.js"></script>
+<script src="resources/SVGAnimationTestCase.js"></script>
+</head>
+<body onload="runSMILTest()">
+<h1>SVG 2 dynamic animation tests</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/animate-marker-orient-from-angle-to-autostartreverse.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestssvganimationsanimatemarkerorienttype4expectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/animations/animate-marker-orienttype-4-expected.html (0 => 197738)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/animations/animate-marker-orienttype-4-expected.html         (rev 0)
+++ trunk/LayoutTests/svg/animations/animate-marker-orienttype-4-expected.html        2016-03-08 08:20:22 UTC (rev 197738)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+<!doctype html>
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000" width="500" height="500">
+ <defs>
+ <marker id="arrow1" orient="auto" markerWidth="10" markerHeight="10" style="overflow:visible">
+ <path d="M50,0 L 0,-50 L0,50 z" fill="skyblue" />
+ </marker>
+ <marker id="arrow2" orient="auto-start-reverse" markerWidth="10" markerHeight="10" style="overflow:visible">
+ <path d="M50,0 L 0,-50 L0,50 z" fill="skyblue" />
+ </marker>
+ <marker id="arrow3" orient="77" markerWidth="10" markerHeight="10" style="overflow:visible">
+ <path d="M50,0 L 0,-50 L0,50 z" fill="skyblue" />
+ </marker>
+ <marker id="arrow4" orient="auto-start-reverse" markerWidth="10" markerHeight="10" style="overflow:visible">
+ <path d="M50,0 L 0,-50 L0,50 z" fill="skyblue" />
+ </marker>
+ </defs>
+ <path d="M 200,200 h 600" marker-start="url(#arrow1)" marker-end="url(#arrow1)" stroke="black"/>
+ <path d="M 200,400 h 600" marker-start="url(#arrow2)" marker-end="url(#arrow2)" stroke="black"/>
+ <path d="M 200,600 h 600" marker-start="url(#arrow3)" marker-end="url(#arrow3)" stroke="black"/>
+ <path d="M 200,800 h 600" marker-start="url(#arrow4)" marker-end="url(#arrow4)" stroke="black"/>
+</svg>
+
</ins></span></pre></div>
<a id="trunkLayoutTestssvganimationsanimatemarkerorienttype4html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/animations/animate-marker-orienttype-4.html (0 => 197738)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/animations/animate-marker-orienttype-4.html         (rev 0)
+++ trunk/LayoutTests/svg/animations/animate-marker-orienttype-4.html        2016-03-08 08:20:22 UTC (rev 197738)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+<!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.
+ -->
+<script>
+function doTest() {
+ if (window.testRunner)
+ testRunner.waitUntilDone();
+ var svg = document.querySelector("#svg");
+ svg.setCurrentTime(5);
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+</script>
+<svg id="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000" width="500" height="500" onload="doTest()">
+ <defs>
+ <marker id="arrow1" orient="auto-start-reverse" markerWidth="10" markerHeight="10" style="overflow:visible">
+ <path d="M50,0 L 0,-50 L0,50 z" fill="skyblue"/>
+ <animate attributeName="orient" from="auto-start-reverse" to="auto" begin="0s" dur="1s" fill="freeze"/>
+ </marker>
+ <marker id="arrow2" orient="90" markerWidth="10" markerHeight="10" style="overflow:visible">
+ <path d="M50,0 L 0,-50 L0,50 z" fill="skyblue"/>
+ <animate attributeName="orient" from="auto" to="auto-start-reverse" begin="0s" dur="1s" fill="freeze"/>
+ </marker>
+ <marker id="arrow3" orient="auto" markerWidth="10" markerHeight="10" style="overflow:visible">
+ <path d="M50,0 L 0,-50 L0,50 z" fill="skyblue"/>
+ <animate attributeName="orient" from="auto-start-reverse" to="77" begin="0s" dur="1s" fill="freeze"/>
+ </marker>
+ <marker id="arrow4" orient="123" markerWidth="10" markerHeight="10" style="overflow:visible">
+ <path d="M50,0 L 0,-50 L0,50 z" fill="skyblue"/>
+ <animate attributeName="orient" from="123" to="auto-start-reverse" begin="0s" dur="1s" fill="freeze"/>
+ </marker>
+ <path d="M50,0 L 0,-50 L0,50 z" transform="scale(0.8) translate(5)" id="pointer" fill="red"/>
+ </defs>
+ <use xlink:href="#pointer" transform="translate(200,200) rotate(0)"/>
+ <use xlink:href="#pointer" transform="translate(800,200) rotate(0)"/>
+ <path d="M 200,200 h 600" marker-start="url(#arrow1)" marker-end="url(#arrow1)" stroke="black"/>
+ <use xlink:href="#pointer" transform="translate(200,400) rotate(180)"/>
+ <use xlink:href="#pointer" transform="translate(800,400) rotate(0)"/>
+ <path d="M 200,400 h 600" marker-start="url(#arrow2)" marker-end="url(#arrow2)" stroke="black"/>
+ <use xlink:href="#pointer" transform="translate(200,600) rotate(77)"/>
+ <use xlink:href="#pointer" transform="translate(800,600) rotate(77)"/>
+ <path d="M 200,600 h 600" marker-start="url(#arrow3)" marker-end="url(#arrow3)" stroke="black"/>
+ <use xlink:href="#pointer" transform="translate(200,800) rotate(180)"/>
+ <use xlink:href="#pointer" transform="translate(800,800) rotate(0)"/>
+ <path d="M 200,800 h 600" marker-start="url(#arrow4)" marker-end="url(#arrow4)" stroke="black"/>
+</svg>
</ins></span></pre></div>
<a id="trunkLayoutTestssvganimationsscripttestsanimatemarkerorientfromangletoautostartreversejs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/animations/script-tests/animate-marker-orient-from-angle-to-autostartreverse.js (0 => 197738)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/animations/script-tests/animate-marker-orient-from-angle-to-autostartreverse.js         (rev 0)
+++ trunk/LayoutTests/svg/animations/script-tests/animate-marker-orient-from-angle-to-autostartreverse.js        2016-03-08 08:20:22 UTC (rev 197738)
</span><span class="lines">@@ -0,0 +1,91 @@
</span><ins>+description("Animate SVGMarkerElement orientAttr from an angle to auto-start-reverse.");
+createSVGTestCase();
+
+// Setup test document.
+
+var marker = createSVGElement("marker");
+marker.setAttribute("id", "marker");
+marker.setAttribute("viewBox", "0 0 10 10");
+marker.setAttribute("markerWidth", "2");
+marker.setAttribute("markerHeight", "2");
+marker.setAttribute("refX", "5");
+marker.setAttribute("refY", "5");
+marker.setAttribute("markerUnits", "strokeWidth");
+
+var markerPath = createSVGElement("path");
+markerPath.setAttribute("fill", "blue");
+markerPath.setAttribute("d", "M 5 0 L 10 10 L 0 10 Z");
+marker.appendChild(markerPath);
+
+var defsElement = createSVGElement("defs");
+defsElement.appendChild(marker);
+rootSVGElement.appendChild(defsElement);
+
+var path = createSVGElement("path");
+path.setAttribute("id", "path");
+path.setAttribute("onclick", "executeTest()");
+path.setAttribute("fill", "none");
+path.setAttribute("stroke", "green");
+path.setAttribute("stroke-width", "10");
+path.setAttribute("marker-start", "url(#marker)");
+path.setAttribute("marker-end", "url(#marker)");
+path.setAttribute("d", "M 130 135 L 180 135 L 180 185");
+path.setAttribute("transform", "translate(-130, -120)");
+rootSVGElement.appendChild(path);
+
+var animate1 = createSVGElement("animate");
+animate1.setAttribute("id", "animation");
+animate1.setAttribute("attributeName", "orient");
+animate1.setAttribute("begin", "path.click");
+animate1.setAttribute("dur", "4s");
+animate1.setAttribute("from", "90deg");
+animate1.setAttribute("to", "auto-start-reverse");
+animate1.setAttribute("fill", "freeze");
+marker.appendChild(animate1);
+
+// Setup animation test.
+function sample1() {
+ shouldBeCloseEnough("marker.orientAngle.animVal.value", "0");
+ shouldBe("marker.orientAngle.baseVal.value", "0");
+
+ shouldBe("marker.orientType.animVal", "SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE");
+ shouldBe("marker.orientType.baseVal", "SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE");
+}
+
+function sample2() {
+ shouldBeCloseEnough("marker.orientAngle.animVal.value", "90");
+ shouldBe("marker.orientAngle.baseVal.value", "0");
+
+ shouldBe("marker.orientType.animVal", "SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE");
+ shouldBe("marker.orientType.baseVal", "SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE");
+}
+
+function sample3() {
+ shouldBeCloseEnough("marker.orientAngle.animVal.value", "0");
+ shouldBe("marker.orientAngle.baseVal.value", "0");
+
+ shouldBe("marker.orientType.animVal", "SVGMarkerElement.SVG_MARKER_ORIENT_UNKNOWN");
+ shouldBe("marker.orientType.baseVal", "SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE");
+}
+
+function executeTest() {
+ const expectedValues = [
+ // [animationId, time, sampleCallback]
+ ["animation", 0.0, sample1],
+ ["animation", 0.001, sample2],
+ ["animation", 1.999, sample2],
+ ["animation", 2.001, sample3],
+ ["animation", 3.999, sample3],
+ ["animation", 4.001, sample3]
+ ];
+
+ // Ensure new enum value is not exposed through the IDL
+ shouldBe("SVGMarkerElement.SVG_MARKER_ORIENT_AUTOSTARTREVERSE", "undefined");
+
+ // Ensure we cannot set autostartreverse through the orient property.
+ shouldThrow("marker.orientType.baseVal = 3");
+
+ runAnimationTest(expectedValues);
+}
+
+var successfullyParsed = true;
</ins></span></pre></div>
<a id="trunkLayoutTestssvgcustommarkerautostartreverseexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/custom/marker-auto-start-reverse-expected.html (0 => 197738)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/custom/marker-auto-start-reverse-expected.html         (rev 0)
+++ trunk/LayoutTests/svg/custom/marker-auto-start-reverse-expected.html        2016-03-08 08:20:22 UTC (rev 197738)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+<!doctype html>
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="300" height="300">
+ <defs>
+ <marker id="arrow" orient="225" markerWidth="10" markerHeight="10" style="overflow:visible">
+ <path d="M5,0 L 0,-5 L0,5 z" fill="green"/>
+ </marker>
+ <marker id="arrow2" orient="auto" markerWidth="10" markerHeight="10" style="overflow:visible">
+ <path d="M5,0 L 0,-5 L0,5 z" fill="green"/>
+ </marker>
+ </defs>
+ <path d="M 20,20 L50,50 L 80,80" marker-start="url(#arrow)" marker-mid="url(#arrow2)" marker-end="url(#arrow2)" stroke="black"/>
+</svg>
</ins></span></pre></div>
<a id="trunkLayoutTestssvgcustommarkerautostartreversehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/custom/marker-auto-start-reverse.html (0 => 197738)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/custom/marker-auto-start-reverse.html         (rev 0)
+++ trunk/LayoutTests/svg/custom/marker-auto-start-reverse.html        2016-03-08 08:20:22 UTC (rev 197738)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+<!doctype html>
+<!--
+Reftest for auto-start-reverse value for orient property of marker element.
+Markers at each end of the path should point outwards. Middle marker should point along the direction of the path.
+-->
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="300" height="300">
+ <defs>
+ <!-- Correct definition - uses lower case -->
+ <marker id="arrow" orient="auto-start-reverse" markerWidth="10" markerHeight="10" style="overflow:visible">
+ <path d="M5,0 L 0,-5 L0,5 z" fill="green"/>
+ </marker>
+ </defs>
+ <path d="M 20,20 l30,30 30,30" marker-start="url(#arrow)" marker-mid="url(#arrow)" marker-end="url(#arrow)" stroke="black"/>
+</svg>
</ins></span></pre></div>
<a id="trunkLayoutTestssvgdomSVGAnimatedEnumerationSVGMarkerElementexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGMarkerElement-expected.txt (197737 => 197738)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGMarkerElement-expected.txt        2016-03-08 08:16:29 UTC (rev 197737)
+++ trunk/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGMarkerElement-expected.txt        2016-03-08 08:20:22 UTC (rev 197738)
</span><span class="lines">@@ -37,6 +37,13 @@
</span><span class="cx"> PASS markerElement.orientAngle.baseVal.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
</span><span class="cx"> PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_AUTO
</span><span class="cx">
</span><ins>+Switch to 'auto-start-reverse' value - by modifying the orient attribute.
+PASS markerElement.setAttribute('orient', 'auto-start-reverse') did not throw exception.
+PASS markerElement.orientAngle.baseVal.value is 0
+PASS markerElement.orientAngle.baseVal.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
+PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_UNKNOWN
+PASS markerElement.getAttribute('orient') is "auto-start-reverse"
+
</ins><span class="cx"> Switch to 'Pi/2 rad' value - via setOrientToAngle()
</span><span class="cx"> PASS anglePiHalfRad = svgElement.createSVGAngle(); anglePiHalfRad.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_RAD, (Math.PI / 2).toFixed(2)) is undefined.
</span><span class="cx"> PASS markerElement.setOrientToAngle(anglePiHalfRad) is undefined.
</span><span class="lines">@@ -92,6 +99,14 @@
</span><span class="cx"> PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
</span><span class="cx"> PASS markerElement.getAttribute('orient') is "10deg"
</span><span class="cx">
</span><ins>+Test case sensitivity of attributes - try setting invalid values
+PASS markerElement.setAttribute('orient', 'AUTO-START-REVERSE') did not throw exception.
+FAIL markerElement.getAttribute('orient') should be AUTO-START-REVERSE. Was 10deg.
+PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
+PASS markerElement.setAttribute('orient', 'AUTO') did not throw exception.
+FAIL markerElement.getAttribute('orient') should be AUTO. Was 10deg.
+PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
+
</ins><span class="cx"> Switch back to 'auto' value
</span><span class="cx"> PASS markerElement.orientType.baseVal = SVGMarkerElement.SVG_MARKER_ORIENT_AUTO is SVGMarkerElement.SVG_MARKER_ORIENT_AUTO
</span><span class="cx"> PASS markerElement.orientAngle.baseVal.value is 10
</span></span></pre></div>
<a id="trunkLayoutTestssvgdomscripttestsSVGAnimatedEnumerationSVGMarkerElementjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/svg/dom/script-tests/SVGAnimatedEnumeration-SVGMarkerElement.js (197737 => 197738)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/dom/script-tests/SVGAnimatedEnumeration-SVGMarkerElement.js        2016-03-08 08:16:29 UTC (rev 197737)
+++ trunk/LayoutTests/svg/dom/script-tests/SVGAnimatedEnumeration-SVGMarkerElement.js        2016-03-08 08:20:22 UTC (rev 197738)
</span><span class="lines">@@ -49,6 +49,14 @@
</span><span class="cx"> shouldBe("markerElement.orientType.baseVal", "SVGMarkerElement.SVG_MARKER_ORIENT_AUTO");
</span><span class="cx">
</span><span class="cx"> debug("");
</span><ins>+debug("Switch to 'auto-start-reverse' value - by modifying the orient attribute.");
+shouldNotThrow("markerElement.setAttribute('orient', 'auto-start-reverse')");
+shouldBe("markerElement.orientAngle.baseVal.value", "0");
+shouldBe("markerElement.orientAngle.baseVal.unitType", "SVGAngle.SVG_ANGLETYPE_UNSPECIFIED");
+shouldBe("markerElement.orientType.baseVal", "SVGMarkerElement.SVG_MARKER_ORIENT_UNKNOWN");
+shouldBeEqualToString("markerElement.getAttribute('orient')", "auto-start-reverse");
+
+debug("");
</ins><span class="cx"> debug("Switch to 'Pi/2 rad' value - via setOrientToAngle()");
</span><span class="cx"> shouldBeUndefined("anglePiHalfRad = svgElement.createSVGAngle(); anglePiHalfRad.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_RAD, (Math.PI / 2).toFixed(2))");
</span><span class="cx"> shouldBeUndefined("markerElement.setOrientToAngle(anglePiHalfRad)");
</span><span class="lines">@@ -113,6 +121,22 @@
</span><span class="cx"> shouldBeEqualToString("markerElement.getAttribute('orient')", "10deg");
</span><span class="cx">
</span><span class="cx"> debug("");
</span><ins>+debug("Test case sensitivity of attributes - try setting invalid values");
+shouldNotThrow("markerElement.setAttribute('orient', 'AUTO-START-REVERSE')");
+// The line below fails as a result of https://bugs.webkit.org/show_bug.cgi?id=154141
+// The attribute value is not updated to the invalid value.
+// The expected result recognises this and should be updated when the above bug
+// is resolved.
+// What's important here though is that the DOM values are unchanged, and this
+// is demonstrated correctly.
+shouldBeEqualToString("markerElement.getAttribute('orient')", "AUTO-START-REVERSE");
+shouldBe("markerElement.orientType.baseVal", "SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE");
+
+shouldNotThrow("markerElement.setAttribute('orient', 'AUTO')");
+shouldBeEqualToString("markerElement.getAttribute('orient')", "AUTO");
+shouldBe("markerElement.orientType.baseVal", "SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE");
+
+debug("");
</ins><span class="cx"> debug("Switch back to 'auto' value");
</span><span class="cx"> shouldBe("markerElement.orientType.baseVal = SVGMarkerElement.SVG_MARKER_ORIENT_AUTO", "SVGMarkerElement.SVG_MARKER_ORIENT_AUTO");
</span><span class="cx"> shouldBe("markerElement.orientAngle.baseVal.value", "10");
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (197737 => 197738)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-08 08:16:29 UTC (rev 197737)
+++ trunk/Source/WebCore/ChangeLog        2016-03-08 08:20:22 UTC (rev 197738)
</span><span class="lines">@@ -1,3 +1,57 @@
</span><ins>+2016-03-08 Nikos Andronikos <nikos.andronikos-webkit@cisra.canon.com.au>
+
+ [SVG2] Implement marker orient='auto-start-reverse'
+ https://bugs.webkit.org/show_bug.cgi?id=138456
+
+ Reviewed by Darin Adler.
+
+ https://www.w3.org/TR/SVG2/painting.html#OrientAttribute
+ marker-start markers must be oriented at 180 degrees to the direction of the path when
+ the orient attribute of the marker is set to 'auto-start-reverse'.
+
+ To acheive this the SVGMarkerData class which calculates the angles for each marker on
+ a path must know whether the orient type is set to reverse the start marker.
+
+ Tests: svg/animations/animate-marker-orient-from-angle-to-autostartreverse.html
+ svg/animations/animate-marker-orienttype-4.html
+ svg/custom/marker-auto-start-reverse.html
+
+ * rendering/svg/RenderSVGShape.cpp:
+ (WebCore::RenderSVGShape::processMarkerPositions):
+ Create marker data, using animated value of orient to determine
+ if first marker should be reversed.
+ * rendering/svg/SVGMarkerData.h:
+ (WebCore::SVGMarkerData::SVGMarkerData):
+ Constructor now requires boolean indicating if start marker is
+ reversed.
+ (WebCore::SVGMarkerData::currentAngle):
+ Take into account whether start marker should be reversed.
+ * rendering/svg/SVGResources.cpp:
+ (WebCore::SVGResources::markerReverseStart):
+ New function to query whether start marker should be reversed.
+ * rendering/svg/SVGResources.h:
+ Add declaration for new function.
+ * svg/SVGAnimatedAngle.cpp:
+ (WebCore::SVGAnimatedAngleAnimator::calculateAnimatedValue):
+ Support animation including the value auto-start-reverse.
+ * svg/SVGMarkerElement.cpp:
+ (WebCore::SVGMarkerElement::setOrient):
+ Combine duplicated functionality into one private method
+ (WebCore::SVGMarkerElement::setOrientToAuto):
+ Set orient type and angle correctly for orient=auto. Uses setOrient.
+ (WebCore::SVGMarkerElement::setOrientToAngle):
+ Set orient type and angle correctly for orient=<angle>. Uses setOrient.
+ (WebCore::SVGMarkerElement::synchronizeOrientType):
+ Support auto-start-reverse as a possible case.
+ * svg/SVGMarkerElement.h:
+ (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue):
+ Limit the orient DOM property so that the new enum value
+ required for auto-start-reverse is not exposed.
+ (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue):
+ Support auto-start-reverse.
+ (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString):
+ Support auto-start-reverse.
+
</ins><span class="cx"> 2016-03-07 Keith Rollin <krollin@apple.com>
</span><span class="cx">
</span><span class="cx"> Enhance logging: Use "always on" macros
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgRenderSVGShapecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp (197737 => 197738)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp        2016-03-08 08:16:29 UTC (rev 197737)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp        2016-03-08 08:20:22 UTC (rev 197738)
</span><span class="lines">@@ -482,7 +482,7 @@
</span><span class="cx">
</span><span class="cx"> ASSERT(m_path);
</span><span class="cx">
</span><del>- SVGMarkerData markerData(m_markerPositions);
</del><ins>+ SVGMarkerData markerData(m_markerPositions, SVGResourcesCache::cachedResourcesForRenderer(*this)->markerReverseStart());
</ins><span class="cx"> m_path->apply([&markerData](const PathElement& pathElement) {
</span><span class="cx"> SVGMarkerData::updateFromPathElement(markerData, pathElement);
</span><span class="cx"> });
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGMarkerDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGMarkerData.h (197737 => 197738)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGMarkerData.h        2016-03-08 08:16:29 UTC (rev 197737)
+++ trunk/Source/WebCore/rendering/svg/SVGMarkerData.h        2016-03-08 08:20:22 UTC (rev 197738)
</span><span class="lines">@@ -48,9 +48,10 @@
</span><span class="cx">
</span><span class="cx"> class SVGMarkerData {
</span><span class="cx"> public:
</span><del>- SVGMarkerData(Vector<MarkerPosition>& positions)
</del><ins>+ SVGMarkerData(Vector<MarkerPosition>& positions, bool reverseStart)
</ins><span class="cx"> : m_positions(positions)
</span><span class="cx"> , m_elementIndex(0)
</span><ins>+ , m_reverseStart(reverseStart)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -87,6 +88,8 @@
</span><span class="cx">
</span><span class="cx"> switch (type) {
</span><span class="cx"> case StartMarker:
</span><ins>+ if (m_reverseStart)
+ return narrowPrecisionToFloat(outAngle - 180);
</ins><span class="cx"> return narrowPrecisionToFloat(outAngle);
</span><span class="cx"> case MidMarker:
</span><span class="cx"> // WK193015: Prevent bugs due to angles being non-continuous.
</span><span class="lines">@@ -147,6 +150,7 @@
</span><span class="cx"> FloatPoint m_subpathStart;
</span><span class="cx"> FloatPoint m_inslopePoints[2];
</span><span class="cx"> FloatPoint m_outslopePoints[2];
</span><ins>+ bool m_reverseStart;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGResourcescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGResources.cpp (197737 => 197738)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGResources.cpp        2016-03-08 08:16:29 UTC (rev 197737)
+++ trunk/Source/WebCore/rendering/svg/SVGResources.cpp        2016-03-08 08:20:22 UTC (rev 197738)
</span><span class="lines">@@ -305,6 +305,13 @@
</span><span class="cx"> markerEnd()->layoutIfNeeded();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool SVGResources::markerReverseStart() const
+{
+ return m_markerData
+ && m_markerData->markerStart
+ && m_markerData->markerStart->markerElement().orientType() == SVGMarkerOrientAutoStartReverse;
+}
+
</ins><span class="cx"> void SVGResources::removeClientFromCache(RenderElement& renderer, bool markForInvalidation) const
</span><span class="cx"> {
</span><span class="cx"> if (!m_clipperFilterMaskerData && !m_markerData && !m_fillStrokeData && !m_linkedResource)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGResourcesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGResources.h (197737 => 197738)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGResources.h        2016-03-08 08:16:29 UTC (rev 197737)
+++ trunk/Source/WebCore/rendering/svg/SVGResources.h        2016-03-08 08:20:22 UTC (rev 197738)
</span><span class="lines">@@ -20,6 +20,8 @@
</span><span class="cx"> #ifndef SVGResources_h
</span><span class="cx"> #define SVGResources_h
</span><span class="cx">
</span><ins>+#include "RenderSVGResourceMarker.h"
+
</ins><span class="cx"> #include <memory>
</span><span class="cx"> #include <wtf/HashSet.h>
</span><span class="cx"> #include <wtf/Noncopyable.h>
</span><span class="lines">@@ -52,6 +54,7 @@
</span><span class="cx"> RenderSVGResourceMarker* markerStart() const { return m_markerData ? m_markerData->markerStart : nullptr; }
</span><span class="cx"> RenderSVGResourceMarker* markerMid() const { return m_markerData ? m_markerData->markerMid : nullptr; }
</span><span class="cx"> RenderSVGResourceMarker* markerEnd() const { return m_markerData ? m_markerData->markerEnd : nullptr; }
</span><ins>+ bool markerReverseStart() const;
</ins><span class="cx"> RenderSVGResourceMasker* masker() const { return m_clipperFilterMaskerData ? m_clipperFilterMaskerData->masker : nullptr; }
</span><span class="cx"> RenderSVGResourceFilter* filter() const { return m_clipperFilterMaskerData ? m_clipperFilterMaskerData->filter : nullptr; }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGAnimatedAnglecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGAnimatedAngle.cpp (197737 => 197738)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGAnimatedAngle.cpp        2016-03-08 08:16:29 UTC (rev 197737)
+++ trunk/Source/WebCore/svg/SVGAnimatedAngle.cpp        2016-03-08 08:20:22 UTC (rev 197738)
</span><span class="lines">@@ -36,7 +36,7 @@
</span><span class="cx"> std::pair<SVGAngle, unsigned>& animatedPair = animatedType->angleAndEnumeration();
</span><span class="cx">
</span><span class="cx"> SVGAngle angle;
</span><del>- SVGMarkerOrientType orientType = SVGPropertyTraits<SVGMarkerOrientType>::fromString(string, angle);
</del><ins>+ SVGMarkerOrientType orientType = SVGPropertyTraits<SVGMarkerOrientType>::fromString(string, angle);
</ins><span class="cx"> if (orientType > 0)
</span><span class="cx"> animatedPair.second = orientType;
</span><span class="cx"> if (orientType == SVGMarkerOrientAngle)
</span><span class="lines">@@ -113,28 +113,25 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // From 'auto' to 'auto'.
- if (fromAngleAndEnumeration.second == SVGMarkerOrientAuto) {
- animatedAngleAndEnumeration.first.setValue(0);
- animatedAngleAndEnumeration.second = SVGMarkerOrientAuto;
- return;
- }
</del><ins>+ if (fromAngleAndEnumeration.second == SVGMarkerOrientAngle) {
+ // Regular from angle to angle animation, with support for smooth interpolation, and additive and accumulated animation.
+ animatedAngleAndEnumeration.second = SVGMarkerOrientAngle;
</ins><span class="cx">
</span><del>- // If the enumeration value is not angle or auto, its unknown.
- if (fromAngleAndEnumeration.second != SVGMarkerOrientAngle) {
- animatedAngleAndEnumeration.first.setValue(0);
- animatedAngleAndEnumeration.second = SVGMarkerOrientUnknown;
</del><ins>+ SVGAngle& animatedSVGAngle = animatedAngleAndEnumeration.first;
+ const SVGAngle& toAtEndOfDurationSVGAngle = toAtEndOfDurationAngleAndEnumeration.first;
+ float animatedAngle = animatedSVGAngle.value();
+ m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromAngleAndEnumeration.first.value(), toAngleAndEnumeration.first.value(), toAtEndOfDurationSVGAngle.value(), animatedAngle);
+ animatedSVGAngle.setValue(animatedAngle);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // Regular from angle to angle animation, with all features like additive etc.
- animatedAngleAndEnumeration.second = SVGMarkerOrientAngle;
</del><ins>+ // auto, auto-start-reverse, or unknown.
+ animatedAngleAndEnumeration.first.setValue(0);
</ins><span class="cx">
</span><del>- SVGAngle& animatedSVGAngle = animatedAngleAndEnumeration.first;
- const SVGAngle& toAtEndOfDurationSVGAngle = toAtEndOfDurationAngleAndEnumeration.first;
- float animatedAngle = animatedSVGAngle.value();
- m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromAngleAndEnumeration.first.value(), toAngleAndEnumeration.first.value(), toAtEndOfDurationSVGAngle.value(), animatedAngle);
- animatedSVGAngle.setValue(animatedAngle);
</del><ins>+ if (fromAngleAndEnumeration.second == SVGMarkerOrientAuto || fromAngleAndEnumeration.second == SVGMarkerOrientAutoStartReverse)
+ animatedAngleAndEnumeration.second = fromAngleAndEnumeration.second;
+ else
+ animatedAngleAndEnumeration.second = SVGMarkerOrientUnknown;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> float SVGAnimatedAngleAnimator::calculateDistance(const String& fromString, const String& toString)
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGMarkerElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGMarkerElement.cpp (197737 => 197738)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGMarkerElement.cpp        2016-03-08 08:16:29 UTC (rev 197737)
+++ trunk/Source/WebCore/svg/SVGMarkerElement.cpp        2016-03-08 08:20:22 UTC (rev 197738)
</span><span class="lines">@@ -189,11 +189,11 @@
</span><span class="cx"> object->setNeedsLayout();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void SVGMarkerElement::setOrientToAuto()
</del><ins>+void SVGMarkerElement::setOrient(SVGMarkerOrientType orientType, const SVGAngle& angle)
</ins><span class="cx"> {
</span><del>- setOrientTypeBaseValue(SVGMarkerOrientAuto);
- setOrientAngleBaseValue(SVGAngle());
-
</del><ins>+ setOrientTypeBaseValue(orientType);
+ setOrientAngleBaseValue(angle);
+
</ins><span class="cx"> // Mark orientAttr dirty - the next XML DOM access of that attribute kicks in synchronization.
</span><span class="cx"> m_orientAngle.shouldSynchronize = true;
</span><span class="cx"> m_orientType.shouldSynchronize = true;
</span><span class="lines">@@ -201,16 +201,14 @@
</span><span class="cx"> svgAttributeChanged(orientAnglePropertyInfo()->attributeName);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void SVGMarkerElement::setOrientToAuto()
+{
+ setOrient(SVGMarkerOrientAuto, { });
+}
+
</ins><span class="cx"> void SVGMarkerElement::setOrientToAngle(const SVGAngle& angle)
</span><span class="cx"> {
</span><del>- setOrientTypeBaseValue(SVGMarkerOrientAngle);
- setOrientAngleBaseValue(angle);
-
- // Mark orientAttr dirty - the next XML DOM access of that attribute kicks in synchronization.
- m_orientAngle.shouldSynchronize = true;
- m_orientType.shouldSynchronize = true;
- invalidateSVGAttributes();
- svgAttributeChanged(orientAnglePropertyInfo()->attributeName);
</del><ins>+ setOrient(SVGMarkerOrientAngle, angle);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RenderPtr<RenderElement> SVGMarkerElement::createElementRenderer(Ref<RenderStyle>&& style, const RenderTreePosition&)
</span><span class="lines">@@ -233,12 +231,17 @@
</span><span class="cx"> if (!ownerType.m_orientType.shouldSynchronize)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- // If orient is not auto, the previous call to synchronizeOrientAngle already set the orientAttr to the right angle.
- if (ownerType.m_orientType.value != SVGMarkerOrientAuto)
</del><ins>+ static NeverDestroyed<AtomicString> autoString("auto", AtomicString::ConstructFromLiteral);
+ static NeverDestroyed<AtomicString> autoStartReverseString("auto-start-reverse", AtomicString::ConstructFromLiteral);
+
+ // If orient is not auto or auto-start-reverse, the previous call to synchronizeOrientAngle already set the orientAttr to the right angle.
+ if (ownerType.m_orientType.value == SVGMarkerOrientAuto) {
+ ownerType.m_orientType.synchronize(&ownerType, orientTypePropertyInfo()->attributeName, autoString);
</ins><span class="cx"> return;
</span><ins>+ }
</ins><span class="cx">
</span><del>- static NeverDestroyed<AtomicString> autoString("auto", AtomicString::ConstructFromLiteral);
- ownerType.m_orientType.synchronize(&ownerType, orientTypePropertyInfo()->attributeName, autoString);
</del><ins>+ if (ownerType.m_orientType.value == SVGMarkerOrientAutoStartReverse)
+ ownerType.m_orientType.synchronize(&ownerType, orientTypePropertyInfo()->attributeName, autoStartReverseString);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Ref<SVGAnimatedProperty> SVGMarkerElement::lookupOrCreateOrientTypeWrapper(SVGElement* contextElement)
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGMarkerElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGMarkerElement.h (197737 => 197738)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGMarkerElement.h        2016-03-08 08:16:29 UTC (rev 197737)
+++ trunk/Source/WebCore/svg/SVGMarkerElement.h        2016-03-08 08:20:22 UTC (rev 197738)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> SVGMarkerOrientUnknown = 0,
</span><span class="cx"> SVGMarkerOrientAuto,
</span><span class="cx"> SVGMarkerOrientAngle,
</span><ins>+ SVGMarkerOrientAutoStartReverse,
</ins><span class="cx">
</span><span class="cx"> // Add new elements before here.
</span><span class="cx"> SVGMarkerOrientMax
</span><span class="lines">@@ -78,8 +79,11 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> template<>
</span><ins>+inline unsigned SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue() { return SVGMarkerOrientAngle; }
+
+template<>
</ins><span class="cx"> struct SVGPropertyTraits<SVGMarkerOrientType> {
</span><del>- static unsigned highestEnumValue() { return SVGMarkerOrientAngle; }
</del><ins>+ static unsigned highestEnumValue() { return SVGMarkerOrientAutoStartReverse; }
</ins><span class="cx">
</span><span class="cx"> // toString is not needed, synchronizeOrientType() handles this on its own.
</span><span class="cx">
</span><span class="lines">@@ -87,6 +91,8 @@
</span><span class="cx"> {
</span><span class="cx"> if (value == "auto")
</span><span class="cx"> return SVGMarkerOrientAuto;
</span><ins>+ if (value == "auto-start-reverse")
+ return SVGMarkerOrientAutoStartReverse;
</ins><span class="cx">
</span><span class="cx"> ExceptionCode ec = 0;
</span><span class="cx"> angle.setValueAsString(value, ec);
</span><span class="lines">@@ -110,7 +116,8 @@
</span><span class="cx"> enum {
</span><span class="cx"> SVG_MARKER_ORIENT_UNKNOWN = SVGMarkerOrientUnknown,
</span><span class="cx"> SVG_MARKER_ORIENT_AUTO = SVGMarkerOrientAuto,
</span><del>- SVG_MARKER_ORIENT_ANGLE = SVGMarkerOrientAngle
</del><ins>+ SVG_MARKER_ORIENT_ANGLE = SVGMarkerOrientAngle,
+ SVG_MARKER_ORIENT_AUTOSTARTREVERSE = SVGMarkerOrientAutoStartReverse
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> static Ref<SVGMarkerElement> create(const QualifiedName&, Document&);
</span><span class="lines">@@ -137,6 +144,8 @@
</span><span class="cx">
</span><span class="cx"> bool selfHasRelativeLengths() const override;
</span><span class="cx">
</span><ins>+ void setOrient(SVGMarkerOrientType, const SVGAngle&);
+
</ins><span class="cx"> void synchronizeOrientType();
</span><span class="cx">
</span><span class="cx"> static const AtomicString& orientTypeIdentifier();
</span></span></pre>
</div>
</div>
</body>
</html>