Title: [231955] trunk
Revision
231955
Author
[email protected]
Date
2018-05-18 08:22:55 -0700 (Fri, 18 May 2018)

Log Message

Make all SVG shape interfaces inherit from SVGGeometryElement
https://bugs.webkit.org/show_bug.cgi?id=185600

Reviewed by Antti Koivisto.

Source/WebCore:

Make all SVG shape interfaces inherit from SVGGeometryElement
as defined by SVG2:

https://svgwg.org/svg2-draft/shapes.html#DOMInterfaces

Tests: svg/dom/SVGGeometry-circle.xhtml
       svg/dom/SVGGeometry-ellipse.xhtml
       svg/dom/SVGGeometry-line.xhtml
       svg/dom/SVGGeometry-polygon.xhtml
       svg/dom/SVGGeometry-polyline.xhtml
       svg/dom/SVGGeometry-rect.xhtml

* rendering/svg/RenderSVGShape.cpp:
(WebCore::RenderSVGShape::getTotalLength const): Added shape
        independent implementation for all methods defined
        by SVGGeometryElement interface. Calculations are
        based on the Path object created and referenced by
        RenderSVGShape.
(WebCore::RenderSVGShape::getPointAtLength const):
* rendering/svg/RenderSVGShape.h:
* svg/SVGCircleElement.cpp:
        Repeating pattern: Change inheritance from
        SVGGraphicsElement to SVGGeometryElement.
(WebCore::SVGCircleElement::SVGCircleElement):
* svg/SVGCircleElement.h:
* svg/SVGCircleElement.idl:
* svg/SVGEllipseElement.cpp:
(WebCore::SVGEllipseElement::SVGEllipseElement):
* svg/SVGEllipseElement.h:
* svg/SVGEllipseElement.idl:
* svg/SVGGeometryElement.cpp:
(WebCore::SVGGeometryElement::getTotalLength const):
(WebCore::SVGGeometryElement::getPointAtLength const):
* svg/SVGGeometryElement.h:
* svg/SVGLineElement.cpp:
(WebCore::SVGLineElement::SVGLineElement):
* svg/SVGLineElement.h:
* svg/SVGLineElement.idl:
* svg/SVGPolyElement.cpp:
(WebCore::SVGPolyElement::SVGPolyElement):
* svg/SVGPolyElement.h:
* svg/SVGPolygonElement.idl:
* svg/SVGPolylineElement.idl:
* svg/SVGRectElement.cpp:
(WebCore::SVGRectElement::SVGRectElement):
* svg/SVGRectElement.h:
* svg/SVGRectElement.idl:

LayoutTests:

Update test for inheritance of SVG shape interfaces (more passes).
Add individual tests for SVGGeometryElement interfaces for each
SVG shape. There already are more detailed tests for the methods
and the SVGPathElement interface.

* svg/dom/SVGGeometry-circle-expected.txt: Added.
* svg/dom/SVGGeometry-circle.xhtml: Added.
* svg/dom/SVGGeometry-ellipse-expected.txt: Added.
* svg/dom/SVGGeometry-ellipse.xhtml: Added.
* svg/dom/SVGGeometry-line-expected.txt: Added.
* svg/dom/SVGGeometry-line.xhtml: Added.
* svg/dom/SVGGeometry-polygon-expected.txt: Added.
* svg/dom/SVGGeometry-polygon.xhtml: Added.
* svg/dom/SVGGeometry-polyline-expected.txt: Added.
* svg/dom/SVGGeometry-polyline.xhtml: Added.
* svg/dom/SVGGeometry-rect-expected.txt: Added.
* svg/dom/SVGGeometry-rect.xhtml: Added.
* svg/dom/svg2-inheritance-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (231954 => 231955)


--- trunk/LayoutTests/ChangeLog	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/LayoutTests/ChangeLog	2018-05-18 15:22:55 UTC (rev 231955)
@@ -1,3 +1,29 @@
+2018-05-18  Dirk Schulze  <[email protected]>
+
+        Make all SVG shape interfaces inherit from SVGGeometryElement
+        https://bugs.webkit.org/show_bug.cgi?id=185600
+
+        Reviewed by Antti Koivisto.
+
+        Update test for inheritance of SVG shape interfaces (more passes).
+        Add individual tests for SVGGeometryElement interfaces for each
+        SVG shape. There already are more detailed tests for the methods
+        and the SVGPathElement interface.
+
+        * svg/dom/SVGGeometry-circle-expected.txt: Added.
+        * svg/dom/SVGGeometry-circle.xhtml: Added.
+        * svg/dom/SVGGeometry-ellipse-expected.txt: Added.
+        * svg/dom/SVGGeometry-ellipse.xhtml: Added.
+        * svg/dom/SVGGeometry-line-expected.txt: Added.
+        * svg/dom/SVGGeometry-line.xhtml: Added.
+        * svg/dom/SVGGeometry-polygon-expected.txt: Added.
+        * svg/dom/SVGGeometry-polygon.xhtml: Added.
+        * svg/dom/SVGGeometry-polyline-expected.txt: Added.
+        * svg/dom/SVGGeometry-polyline.xhtml: Added.
+        * svg/dom/SVGGeometry-rect-expected.txt: Added.
+        * svg/dom/SVGGeometry-rect.xhtml: Added.
+        * svg/dom/svg2-inheritance-expected.txt:
+
 2018-05-18  Per Arne Vollan  <[email protected]>
 
         The test fast/images/animated-image-mp4-crash.html is failing on Windows.

Added: trunk/LayoutTests/svg/dom/SVGGeometry-circle-expected.txt (0 => 231955)


--- trunk/LayoutTests/svg/dom/SVGGeometry-circle-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/dom/SVGGeometry-circle-expected.txt	2018-05-18 15:22:55 UTC (rev 231955)
@@ -0,0 +1,49 @@
+Test SVGGeometryElement APIs for circle.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+Test isPointInFill()
+PASS c1.isPointInFill({}) is false
+PASS c1.isPointInFill({x: 50, y: 50}) is true
+PASS c1.isPointInFill({x: 0, y: 50}) is true
+PASS c1.isPointInFill({x: 100, y: 50}) is true
+PASS c1.isPointInFill({x: 50, y: 0}) is true
+PASS c1.isPointInFill({x: 50, y: 100}) is true
+PASS c1.isPointInFill({x: -1, y: 50}) is false
+PASS c1.isPointInFill({x: 101, y: 50}) is false
+PASS c1.isPointInFill({x: 50, y: -1}) is false
+PASS c1.isPointInFill({x: 50, y: 101}) is false
+PASS c1.isPointInFill({x: 90, y: 90}) is false
+PASS c1.isPointInFill({x: 10, y: 10}) is false
+PASS c1.isPointInFill({x: 90, y: 10}) is false
+PASS c1.isPointInFill({x: 10, y: 90}) is false
+
+Test isPointInStroke()
+PASS c1.isPointInStroke({}) is false
+PASS c1.isPointInStroke({x: 50, y: 50}) is false
+PASS c1.isPointInStroke({x: 100, y: 51}) is false
+PASS c1.isPointInStroke({x: 100, y: 49}) is true
+PASS c1.isPointInStroke({x: 0, y: 50}) is true
+PASS c1.isPointInStroke({x: 52, y: 100}) is true
+PASS c1.isPointInStroke({x: 48, y: 100}) is false
+
+Test getTotalLength()
+PASS c1.getTotalLength() is within 0.1 of 314.1592653589793
+
+Test getPointAtLength()
+PASS c1.getPointAtLength(0).x is within 0.1 of 100
+PASS c1.getPointAtLength(0).y is within 0.1 of 50
+PASS c1.getPointAtLength(Math.PI * 100 / 4).x is within 0.1 of 50
+PASS c1.getPointAtLength(Math.PI * 100 / 4).y is within 0.1 of 100
+PASS c1.getPointAtLength(Math.PI * 100 / 2).x is within 0.1 of 0
+PASS c1.getPointAtLength(Math.PI * 100 / 2).y is within 0.1 of 50
+PASS c1.getPointAtLength(Math.PI * 100 / 8).x is within 1 of 85.35
+PASS c1.getPointAtLength(Math.PI * 100 / 8).y is within 1 of 85.35
+PASS c1.getPointAtLength(Math.PI * 100 * 2).x is within 0.1 of 100
+PASS c1.getPointAtLength(Math.PI * 100 * 2).y is within 0.1 of 50
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/svg/dom/SVGGeometry-circle.xhtml (0 => 231955)


--- trunk/LayoutTests/svg/dom/SVGGeometry-circle.xhtml	                        (rev 0)
+++ trunk/LayoutTests/svg/dom/SVGGeometry-circle.xhtml	2018-05-18 15:22:55 UTC (rev 231955)
@@ -0,0 +1,70 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<script src=""
+</head>
+<body _onload_="run()">
+<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200">
+    <circle id="c1" cx="50" cy="50" r="50" fill="none" stroke="black" stroke-width="20" stroke-dashoffset="20" stroke-dasharray="20 20"/>
+</svg>
+<p id="description"></p>
+<div id="console"></div>
+<script type="text/_javascript_">
+<![CDATA[
+window.enablePixelTesting = false;
+window.jsTestIsAsync = true;
+var c1 = document.getElementById("c1");
+
+function run() {
+    description("Test SVGGeometryElement APIs for circle.");
+
+    debug("");
+    debug("Test isPointInFill()");
+    shouldBe("c1.isPointInFill({})", "false");
+    shouldBe("c1.isPointInFill({x: 50, y: 50})", "true");
+    shouldBe("c1.isPointInFill({x: 0, y: 50})", "true");
+    shouldBe("c1.isPointInFill({x: 100, y: 50})", "true");
+    shouldBe("c1.isPointInFill({x: 50, y: 0})", "true");
+    shouldBe("c1.isPointInFill({x: 50, y: 100})", "true");
+    shouldBe("c1.isPointInFill({x: -1, y: 50})", "false");
+    shouldBe("c1.isPointInFill({x: 101, y: 50})", "false");
+    shouldBe("c1.isPointInFill({x: 50, y: -1})", "false");
+    shouldBe("c1.isPointInFill({x: 50, y: 101})", "false");
+    shouldBe("c1.isPointInFill({x: 90, y: 90})", "false");
+    shouldBe("c1.isPointInFill({x: 10, y: 10})", "false");
+    shouldBe("c1.isPointInFill({x: 90, y: 10})", "false");
+    shouldBe("c1.isPointInFill({x: 10, y: 90})", "false");
+
+    debug("");
+    debug("Test isPointInStroke()");
+    shouldBe("c1.isPointInStroke({})", "false");
+    shouldBe("c1.isPointInStroke({x: 50, y: 50})", "false");
+    shouldBe("c1.isPointInStroke({x: 100, y: 51})", "false");
+    shouldBe("c1.isPointInStroke({x: 100, y: 49})", "true");
+    shouldBe("c1.isPointInStroke({x: 0, y: 50})", "true");
+    shouldBe("c1.isPointInStroke({x: 52, y: 100})", "true");
+    shouldBe("c1.isPointInStroke({x: 48, y: 100})", "false");
+
+    debug("");
+    debug("Test getTotalLength()");
+    shouldBeCloseTo("c1.getTotalLength()", Math.PI * 100, 0.1);
+
+    debug("");
+    debug("Test getPointAtLength()");
+    shouldBeCloseTo("c1.getPointAtLength(0).x", 100, 0.1);
+    shouldBeCloseTo("c1.getPointAtLength(0).y", 50, 0.1);
+    shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 4).x", 50, 0.1);
+    shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 4).y", 100, 0.1);
+    shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 2).x", 0, 0.1);
+    shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 2).y", 50, 0.1);
+    shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 8).x", 85.35, 1);
+    shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 8).y", 85.35, 1);
+    shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 * 2).x", 100, 0.1);
+    shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 * 2).y", 50, 0.1);
+
+    finishJSTest();
+}
+]]>
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/svg/dom/SVGGeometry-ellipse-expected.txt (0 => 231955)


--- trunk/LayoutTests/svg/dom/SVGGeometry-ellipse-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/dom/SVGGeometry-ellipse-expected.txt	2018-05-18 15:22:55 UTC (rev 231955)
@@ -0,0 +1,50 @@
+Test SVGGeometryElement APIs for ellipse.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+Test isPointInFill()
+PASS e1.isPointInFill({}) is false
+PASS e1.isPointInFill({x: 75, y: 50}) is true
+PASS e1.isPointInFill({x: 0, y: 50}) is true
+PASS e1.isPointInFill({x: 150, y: 50}) is true
+PASS e1.isPointInFill({x: 75, y: 0}) is true
+PASS e1.isPointInFill({x: 75, y: 100}) is true
+PASS e1.isPointInFill({x: -1, y: 50}) is false
+PASS e1.isPointInFill({x: 151, y: 50}) is false
+PASS e1.isPointInFill({x: 75, y: -1}) is false
+PASS e1.isPointInFill({x: 75, y: 101}) is false
+PASS e1.isPointInFill({x: 140, y: 90}) is false
+PASS e1.isPointInFill({x: 10, y: 10}) is false
+PASS e1.isPointInFill({x: 140, y: 10}) is false
+PASS e1.isPointInFill({x: 10, y: 90}) is false
+
+Test isPointInStroke()
+PASS e1.isPointInStroke({}) is false
+PASS e1.isPointInStroke({x: 75, y: 50}) is false
+PASS e1.isPointInStroke({x: 150, y: 51}) is false
+PASS e1.isPointInStroke({x: 150, y: 49}) is true
+PASS e1.isPointInStroke({x: 0, y: 52}) is true
+PASS e1.isPointInStroke({x: 0, y: 48}) is false
+PASS e1.isPointInStroke({x: 77, y: 100}) is false
+PASS e1.isPointInStroke({x: 73, y: 100}) is true
+
+Test getTotalLength()
+PASS e1.getTotalLength() is within 5 of 392.6990816987241
+
+Test getPointAtLength()
+PASS e1.getPointAtLength(0).x is within 0.1 of 150
+PASS e1.getPointAtLength(0).y is within 0.1 of 50
+PASS e1.getPointAtLength(Math.PI * (75 + 50) / 4).x is within 3 of 75
+PASS e1.getPointAtLength(Math.PI * (75 + 50) / 4).y is within 3 of 100
+PASS e1.getPointAtLength(Math.PI * (75 + 50) / 2).x is within 3 of 0
+PASS e1.getPointAtLength(Math.PI * (75 + 50) / 2).y is within 3 of 50
+PASS e1.getPointAtLength(Math.PI * (75 + 50) / 8).x is within 3 of 123
+PASS e1.getPointAtLength(Math.PI * (75 + 50) / 8).y is within 3 of 88
+PASS e1.getPointAtLength(Math.PI * (75 + 50) * 2).x is within 3 of 150
+PASS e1.getPointAtLength(Math.PI * (75 + 50) * 2).y is within 3 of 50
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/svg/dom/SVGGeometry-ellipse.xhtml (0 => 231955)


--- trunk/LayoutTests/svg/dom/SVGGeometry-ellipse.xhtml	                        (rev 0)
+++ trunk/LayoutTests/svg/dom/SVGGeometry-ellipse.xhtml	2018-05-18 15:22:55 UTC (rev 231955)
@@ -0,0 +1,71 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<script src=""
+</head>
+<body _onload_="run()">
+<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200">
+    <ellipse id="e1" cx="75" cy="50" rx="75" ry="50" fill="none" stroke="black" stroke-width="20" stroke-dashoffset="20" stroke-dasharray="20 20"/>
+</svg>
+<p id="description"></p>
+<div id="console"></div>
+<script type="text/_javascript_">
+<![CDATA[
+window.enablePixelTesting = false;
+window.jsTestIsAsync = true;
+var e1 = document.getElementById("e1");
+
+function run() {
+    description("Test SVGGeometryElement APIs for ellipse.");
+
+    debug("");
+    debug("Test isPointInFill()");
+    shouldBe("e1.isPointInFill({})", "false");
+    shouldBe("e1.isPointInFill({x: 75, y: 50})", "true");
+    shouldBe("e1.isPointInFill({x: 0, y: 50})", "true");
+    shouldBe("e1.isPointInFill({x: 150, y: 50})", "true");
+    shouldBe("e1.isPointInFill({x: 75, y: 0})", "true");
+    shouldBe("e1.isPointInFill({x: 75, y: 100})", "true");
+    shouldBe("e1.isPointInFill({x: -1, y: 50})", "false");
+    shouldBe("e1.isPointInFill({x: 151, y: 50})", "false");
+    shouldBe("e1.isPointInFill({x: 75, y: -1})", "false");
+    shouldBe("e1.isPointInFill({x: 75, y: 101})", "false");
+    shouldBe("e1.isPointInFill({x: 140, y: 90})", "false");
+    shouldBe("e1.isPointInFill({x: 10, y: 10})", "false");
+    shouldBe("e1.isPointInFill({x: 140, y: 10})", "false");
+    shouldBe("e1.isPointInFill({x: 10, y: 90})", "false");
+
+    debug("");
+    debug("Test isPointInStroke()");
+    shouldBe("e1.isPointInStroke({})", "false");
+    shouldBe("e1.isPointInStroke({x: 75, y: 50})", "false");
+    shouldBe("e1.isPointInStroke({x: 150, y: 51})", "false");
+    shouldBe("e1.isPointInStroke({x: 150, y: 49})", "true");
+    shouldBe("e1.isPointInStroke({x: 0, y: 52})", "true");
+    shouldBe("e1.isPointInStroke({x: 0, y: 48})", "false");
+    shouldBe("e1.isPointInStroke({x: 77, y: 100})", "false");
+    shouldBe("e1.isPointInStroke({x: 73, y: 100})", "true");
+
+    debug("");
+    debug("Test getTotalLength()");
+    shouldBeCloseTo("e1.getTotalLength()", Math.PI * (75 + 50), 5);
+
+    debug("");
+    debug("Test getPointAtLength()");
+    shouldBeCloseTo("e1.getPointAtLength(0).x", 150, 0.1);
+    shouldBeCloseTo("e1.getPointAtLength(0).y", 50, 0.1);
+    shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) / 4).x", 75, 3);
+    shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) / 4).y", 100, 3);
+    shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) / 2).x", 0, 3);
+    shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) / 2).y", 50, 3);
+    shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) / 8).x", 123, 3);
+    shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) / 8).y", 88, 3);
+    shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) * 2).x", 150, 3);
+    shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) * 2).y", 50, 3);
+
+    finishJSTest();
+}
+]]>
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/svg/dom/SVGGeometry-isPointInFill-expected.txt (231954 => 231955)


--- trunk/LayoutTests/svg/dom/SVGGeometry-isPointInFill-expected.txt	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/LayoutTests/svg/dom/SVGGeometry-isPointInFill-expected.txt	2018-05-18 15:22:55 UTC (rev 231955)
@@ -20,6 +20,7 @@
 PASS p1.isPointInFill(svgPoint) is false
 PASS p1.isPointInFill(new DOMPoint(NaN)) is false
 PASS p1.isPointInFill(new DOMPoint(Infinity)) is false
+PASS p1.isPointInFill({x: 'string', y: 'string'}) is false
 PASS p1.isPointInFill('string') threw exception TypeError: Type error.
 
 Test that transform doesn't affect result

Modified: trunk/LayoutTests/svg/dom/SVGGeometry-isPointInFill.xhtml (231954 => 231955)


--- trunk/LayoutTests/svg/dom/SVGGeometry-isPointInFill.xhtml	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/LayoutTests/svg/dom/SVGGeometry-isPointInFill.xhtml	2018-05-18 15:22:55 UTC (rev 231955)
@@ -64,6 +64,7 @@
     shouldBe("p1.isPointInFill(svgPoint)", "false");
     shouldBe("p1.isPointInFill(new DOMPoint(NaN))", "false");
     shouldBe("p1.isPointInFill(new DOMPoint(Infinity))", "false");
+    shouldBe("p1.isPointInFill({x: 'string', y: 'string'})", "false");
     shouldThrow("p1.isPointInFill('string')");
 
     debug("");

Added: trunk/LayoutTests/svg/dom/SVGGeometry-line-expected.txt (0 => 231955)


--- trunk/LayoutTests/svg/dom/SVGGeometry-line-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/dom/SVGGeometry-line-expected.txt	2018-05-18 15:22:55 UTC (rev 231955)
@@ -0,0 +1,37 @@
+Test SVGGeometryElement APIs for line.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+Test isPointInFill()
+PASS l1.isPointInFill({}) is false
+PASS l1.isPointInFill({x: 0, y: 50}) is true
+PASS l1.isPointInFill({x: 50, y: 50}) is true
+PASS l1.isPointInFill({x: 100, y: 50}) is true
+PASS l1.isPointInFill({x: 50, y: 49}) is false
+PASS l1.isPointInFill({x: 50, y: 51}) is false
+
+Test isPointInStroke()
+PASS l1.isPointInStroke({x: 19, y: 50}) is false
+PASS l1.isPointInStroke({x: 20, y: 50}) is true
+PASS l1.isPointInStroke({x: 39, y: 50}) is true
+PASS l1.isPointInStroke({x: 40, y: 50}) is true
+PASS l1.isPointInStroke({x: 41, y: 50}) is false
+
+Test getTotalLength()
+PASS l1.getTotalLength() is within 1 of 100
+
+Test getPointAtLength()
+PASS l1.getPointAtLength(0).x is within 0.1 of 0
+PASS l1.getPointAtLength(0).y is within 0.1 of 50
+PASS l1.getPointAtLength(50).x is within 0.1 of 50
+PASS l1.getPointAtLength(50).y is within 0.1 of 50
+PASS l1.getPointAtLength(100).x is within 0.1 of 100
+PASS l1.getPointAtLength(100).y is within 0.1 of 50
+PASS l1.getPointAtLength(150).x is within 0.1 of 100
+PASS l1.getPointAtLength(150).y is within 0.1 of 50
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/svg/dom/SVGGeometry-line.xhtml (0 => 231955)


--- trunk/LayoutTests/svg/dom/SVGGeometry-line.xhtml	                        (rev 0)
+++ trunk/LayoutTests/svg/dom/SVGGeometry-line.xhtml	2018-05-18 15:22:55 UTC (rev 231955)
@@ -0,0 +1,58 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<script src=""
+</head>
+<body _onload_="run()">
+<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200">
+    <line id="l1" x1="0" y1="50" x2="100" y2="50" fill="none" stroke="black" stroke-width="20" stroke-dashoffset="20" stroke-dasharray="20 20"/>
+</svg>
+<p id="description"></p>
+<div id="console"></div>
+<script type="text/_javascript_">
+<![CDATA[
+window.enablePixelTesting = false;
+window.jsTestIsAsync = true;
+var l1 = document.getElementById("l1");
+
+function run() {
+    description("Test SVGGeometryElement APIs for line.");
+
+    debug("");
+    debug("Test isPointInFill()");
+    shouldBe("l1.isPointInFill({})", "false");
+    shouldBe("l1.isPointInFill({x: 0, y: 50})", "true");
+    shouldBe("l1.isPointInFill({x: 50, y: 50})", "true");
+    shouldBe("l1.isPointInFill({x: 100, y: 50})", "true");
+    shouldBe("l1.isPointInFill({x: 50, y: 49})", "false");
+    shouldBe("l1.isPointInFill({x: 50, y: 51})", "false");
+
+    debug("");
+    debug("Test isPointInStroke()");
+    shouldBe("l1.isPointInStroke({x: 19, y: 50})", "false");
+    shouldBe("l1.isPointInStroke({x: 20, y: 50})", "true");
+    shouldBe("l1.isPointInStroke({x: 39, y: 50})", "true");
+    shouldBe("l1.isPointInStroke({x: 40, y: 50})", "true");
+    shouldBe("l1.isPointInStroke({x: 41, y: 50})", "false");
+
+    debug("");
+    debug("Test getTotalLength()");
+    shouldBeCloseTo("l1.getTotalLength()", 100, 1);
+
+    debug("");
+    debug("Test getPointAtLength()");
+    shouldBeCloseTo("l1.getPointAtLength(0).x", 0, 0.1);
+    shouldBeCloseTo("l1.getPointAtLength(0).y", 50, 0.1);
+    shouldBeCloseTo("l1.getPointAtLength(50).x", 50, 0.1);
+    shouldBeCloseTo("l1.getPointAtLength(50).y", 50, 0.1);
+    shouldBeCloseTo("l1.getPointAtLength(100).x", 100, 0.1);
+    shouldBeCloseTo("l1.getPointAtLength(100).y", 50, 0.1);
+    shouldBeCloseTo("l1.getPointAtLength(150).x", 100, 0.1);
+    shouldBeCloseTo("l1.getPointAtLength(150).y", 50, 0.1);
+
+    finishJSTest();
+}
+]]>
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/svg/dom/SVGGeometry-polygon-expected.txt (0 => 231955)


--- trunk/LayoutTests/svg/dom/SVGGeometry-polygon-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/dom/SVGGeometry-polygon-expected.txt	2018-05-18 15:22:55 UTC (rev 231955)
@@ -0,0 +1,41 @@
+Test SVGGeometryElement APIs for polygon.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+Test isPointInFill()
+PASS p1.isPointInFill({}) is true
+PASS p1.isPointInFill({x: 100, y: 0}) is true
+PASS p1.isPointInFill({x: 152, y: 0}) is false
+PASS p1.isPointInFill({x: 150, y: 50}) is true
+PASS p1.isPointInFill({x: 150, y: 100}) is true
+PASS p1.isPointInFill({x: 150, y: 101}) is false
+PASS p1.isPointInFill({x: 100, y: 100}) is true
+PASS p1.isPointInFill({x: 75, y: 50}) is true
+
+Test isPointInStroke()
+PASS p1.isPointInStroke({x: 0, y: 0}) is false
+PASS p1.isPointInStroke({x: 20, y: 0}) is true
+PASS p1.isPointInStroke({x: 150, y: 0}) is true
+PASS p1.isPointInStroke({x: 150, y: 35}) is true
+PASS p1.isPointInStroke({x: 75, y: 50}) is false
+
+Test getTotalLength()
+PASS p1.getTotalLength() is within 1 of 500
+
+Test getPointAtLength()
+PASS p1.getPointAtLength(0).x is within 0.1 of 0
+PASS p1.getPointAtLength(0).y is within 0.1 of 0
+PASS p1.getPointAtLength(150).x is within 0.1 of 150
+PASS p1.getPointAtLength(150).y is within 0.1 of 0
+PASS p1.getPointAtLength(200).x is within 0.1 of 150
+PASS p1.getPointAtLength(200).y is within 0.1 of 50
+PASS p1.getPointAtLength(300).x is within 0.1 of 100
+PASS p1.getPointAtLength(300).y is within 0.1 of 100
+PASS p1.getPointAtLength(450).x is within 0.1 of 0
+PASS p1.getPointAtLength(450).y is within 0.1 of 50
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/svg/dom/SVGGeometry-polygon.xhtml (0 => 231955)


--- trunk/LayoutTests/svg/dom/SVGGeometry-polygon.xhtml	                        (rev 0)
+++ trunk/LayoutTests/svg/dom/SVGGeometry-polygon.xhtml	2018-05-18 15:22:55 UTC (rev 231955)
@@ -0,0 +1,62 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<script src=""
+</head>
+<body _onload_="run()">
+<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200">
+    <polygon id="p1" points="0,0 150,0 150,100 0,100" fill="none" stroke="black" stroke-width="20" stroke-dashoffset="20" stroke-dasharray="20 20"/>
+</svg>
+<p id="description"></p>
+<div id="console"></div>
+<script type="text/_javascript_">
+<![CDATA[
+window.enablePixelTesting = false;
+window.jsTestIsAsync = true;
+var p1 = document.getElementById("p1");
+
+function run() {
+    description("Test SVGGeometryElement APIs for polygon.");
+
+    debug("");
+    debug("Test isPointInFill()");
+    shouldBe("p1.isPointInFill({})", "true");
+    shouldBe("p1.isPointInFill({x: 100, y: 0})", "true");
+    shouldBe("p1.isPointInFill({x: 152, y: 0})", "false");
+    shouldBe("p1.isPointInFill({x: 150, y: 50})", "true");
+    shouldBe("p1.isPointInFill({x: 150, y: 100})", "true");
+    shouldBe("p1.isPointInFill({x: 150, y: 101})", "false");
+    shouldBe("p1.isPointInFill({x: 100, y: 100})", "true");
+    shouldBe("p1.isPointInFill({x: 75, y: 50})", "true");
+
+    debug("");
+    debug("Test isPointInStroke()");
+    shouldBe("p1.isPointInStroke({x: 0, y: 0})", "false");
+    shouldBe("p1.isPointInStroke({x: 20, y: 0})", "true");
+    shouldBe("p1.isPointInStroke({x: 150, y: 0})", "true");
+    shouldBe("p1.isPointInStroke({x: 150, y: 35})", "true");
+    shouldBe("p1.isPointInStroke({x: 75, y: 50})", "false");
+
+    debug("");
+    debug("Test getTotalLength()");
+    shouldBeCloseTo("p1.getTotalLength()", 500, 1);
+
+    debug("");
+    debug("Test getPointAtLength()");
+    shouldBeCloseTo("p1.getPointAtLength(0).x", 0, 0.1);
+    shouldBeCloseTo("p1.getPointAtLength(0).y", 0, 0.1);
+    shouldBeCloseTo("p1.getPointAtLength(150).x", 150, 0.1);
+    shouldBeCloseTo("p1.getPointAtLength(150).y", 0, 0.1);
+    shouldBeCloseTo("p1.getPointAtLength(200).x", 150, 0.1);
+    shouldBeCloseTo("p1.getPointAtLength(200).y", 50, 0.1);
+    shouldBeCloseTo("p1.getPointAtLength(300).x", 100, 0.1);
+    shouldBeCloseTo("p1.getPointAtLength(300).y", 100, 0.1);
+    shouldBeCloseTo("p1.getPointAtLength(450).x", 0, 0.1);
+    shouldBeCloseTo("p1.getPointAtLength(450).y", 50, 0.1);
+
+    finishJSTest();
+}
+]]>
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/svg/dom/SVGGeometry-polyline-expected.txt (0 => 231955)


--- trunk/LayoutTests/svg/dom/SVGGeometry-polyline-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/dom/SVGGeometry-polyline-expected.txt	2018-05-18 15:22:55 UTC (rev 231955)
@@ -0,0 +1,41 @@
+Test SVGGeometryElement APIs for polyline.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+Test isPointInFill()
+PASS p1.isPointInFill({}) is true
+PASS p1.isPointInFill({x: 100, y: 0}) is true
+PASS p1.isPointInFill({x: 152, y: 0}) is false
+PASS p1.isPointInFill({x: 150, y: 50}) is true
+PASS p1.isPointInFill({x: 150, y: 100}) is true
+PASS p1.isPointInFill({x: 150, y: 101}) is false
+PASS p1.isPointInFill({x: 100, y: 100}) is true
+PASS p1.isPointInFill({x: 75, y: 50}) is true
+
+Test isPointInStroke()
+PASS p1.isPointInStroke({x: 0, y: 0}) is false
+PASS p1.isPointInStroke({x: 20, y: 0}) is true
+PASS p1.isPointInStroke({x: 150, y: 0}) is true
+PASS p1.isPointInStroke({x: 150, y: 35}) is true
+PASS p1.isPointInStroke({x: 75, y: 50}) is false
+
+Test getTotalLength()
+PASS p1.getTotalLength() is within 1 of 400
+
+Test getPointAtLength()
+PASS p1.getPointAtLength(0).x is within 0.1 of 0
+PASS p1.getPointAtLength(0).y is within 0.1 of 0
+PASS p1.getPointAtLength(150).x is within 0.1 of 150
+PASS p1.getPointAtLength(150).y is within 0.1 of 0
+PASS p1.getPointAtLength(200).x is within 0.1 of 150
+PASS p1.getPointAtLength(200).y is within 0.1 of 50
+PASS p1.getPointAtLength(300).x is within 0.1 of 100
+PASS p1.getPointAtLength(300).y is within 0.1 of 100
+PASS p1.getPointAtLength(450).x is within 0.1 of 0
+PASS p1.getPointAtLength(450).y is within 0.1 of 100
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/svg/dom/SVGGeometry-polyline.xhtml (0 => 231955)


--- trunk/LayoutTests/svg/dom/SVGGeometry-polyline.xhtml	                        (rev 0)
+++ trunk/LayoutTests/svg/dom/SVGGeometry-polyline.xhtml	2018-05-18 15:22:55 UTC (rev 231955)
@@ -0,0 +1,62 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<script src=""
+</head>
+<body _onload_="run()">
+<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200">
+    <polyline id="p1" points="0,0 150,0 150,100 0,100" fill="none" stroke="black" stroke-width="20" stroke-dashoffset="20" stroke-dasharray="20 20"/>
+</svg>
+<p id="description"></p>
+<div id="console"></div>
+<script type="text/_javascript_">
+<![CDATA[
+window.enablePixelTesting = false;
+window.jsTestIsAsync = true;
+var p1 = document.getElementById("p1");
+
+function run() {
+    description("Test SVGGeometryElement APIs for polyline.");
+
+    debug("");
+    debug("Test isPointInFill()");
+    shouldBe("p1.isPointInFill({})", "true");
+    shouldBe("p1.isPointInFill({x: 100, y: 0})", "true");
+    shouldBe("p1.isPointInFill({x: 152, y: 0})", "false");
+    shouldBe("p1.isPointInFill({x: 150, y: 50})", "true");
+    shouldBe("p1.isPointInFill({x: 150, y: 100})", "true");
+    shouldBe("p1.isPointInFill({x: 150, y: 101})", "false");
+    shouldBe("p1.isPointInFill({x: 100, y: 100})", "true");
+    shouldBe("p1.isPointInFill({x: 75, y: 50})", "true");
+
+    debug("");
+    debug("Test isPointInStroke()");
+    shouldBe("p1.isPointInStroke({x: 0, y: 0})", "false");
+    shouldBe("p1.isPointInStroke({x: 20, y: 0})", "true");
+    shouldBe("p1.isPointInStroke({x: 150, y: 0})", "true");
+    shouldBe("p1.isPointInStroke({x: 150, y: 35})", "true");
+    shouldBe("p1.isPointInStroke({x: 75, y: 50})", "false");
+
+    debug("");
+    debug("Test getTotalLength()");
+    shouldBeCloseTo("p1.getTotalLength()", 400, 1);
+
+    debug("");
+    debug("Test getPointAtLength()");
+    shouldBeCloseTo("p1.getPointAtLength(0).x", 0, 0.1);
+    shouldBeCloseTo("p1.getPointAtLength(0).y", 0, 0.1);
+    shouldBeCloseTo("p1.getPointAtLength(150).x", 150, 0.1);
+    shouldBeCloseTo("p1.getPointAtLength(150).y", 0, 0.1);
+    shouldBeCloseTo("p1.getPointAtLength(200).x", 150, 0.1);
+    shouldBeCloseTo("p1.getPointAtLength(200).y", 50, 0.1);
+    shouldBeCloseTo("p1.getPointAtLength(300).x", 100, 0.1);
+    shouldBeCloseTo("p1.getPointAtLength(300).y", 100, 0.1);
+    shouldBeCloseTo("p1.getPointAtLength(450).x", 0, 0.1);
+    shouldBeCloseTo("p1.getPointAtLength(450).y", 100, 0.1);
+
+    finishJSTest();
+}
+]]>
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/svg/dom/SVGGeometry-rect-expected.txt (0 => 231955)


--- trunk/LayoutTests/svg/dom/SVGGeometry-rect-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/dom/SVGGeometry-rect-expected.txt	2018-05-18 15:22:55 UTC (rev 231955)
@@ -0,0 +1,50 @@
+Test SVGGeometryElement APIs for rect.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+Test isPointInFill()
+PASS r1.isPointInFill({}) is false
+PASS r1.isPointInFill({x: 48, y: 0}) is false
+PASS r1.isPointInFill({x: 52, y: 0}) is true
+PASS r1.isPointInFill({x: 98, y: 0}) is true
+PASS r1.isPointInFill({x: 102, y: 0}) is false
+PASS r1.isPointInFill({x: 150, y: 38}) is false
+PASS r1.isPointInFill({x: 150, y: 42}) is true
+PASS r1.isPointInFill({x: 150, y: 58}) is true
+PASS r1.isPointInFill({x: 150, y: 62}) is false
+PASS r1.isPointInFill({x: 48, y: 100}) is false
+PASS r1.isPointInFill({x: 52, y: 100}) is true
+PASS r1.isPointInFill({x: 98, y: 100}) is true
+PASS r1.isPointInFill({x: 102, y: 100}) is false
+PASS r1.isPointInFill({x: 0, y: 38}) is false
+PASS r1.isPointInFill({x: 0, y: 42}) is true
+PASS r1.isPointInFill({x: 0, y: 58}) is true
+PASS r1.isPointInFill({x: 0, y: 62}) is false
+PASS r1.isPointInFill({x: 75, y: 50}) is true
+
+Test isPointInStroke()
+PASS r1.isPointInStroke({x: 52, y: 0}) is false
+PASS r1.isPointInStroke({x: 72, y: 0}) is true
+PASS r1.isPointInStroke({x: 92, y: 0}) is false
+PASS r1.isPointInStroke({x: 112, y: 10}) is true
+
+Test getTotalLength()
+PASS r1.getTotalLength() is within 1 of 424
+
+Test getPointAtLength()
+PASS r1.getPointAtLength(0).x is within 1 of 50
+PASS r1.getPointAtLength(0).y is within 1 of 0
+PASS r1.getPointAtLength(25).x is within 1 of 75
+PASS r1.getPointAtLength(25).y is within 1 of 0
+PASS r1.getPointAtLength(200).x is within 3 of 112
+PASS r1.getPointAtLength(200).y is within 3 of 100
+PASS r1.getPointAtLength(300).x is within 3 of 14
+PASS r1.getPointAtLength(300).y is within 3 of 88
+PASS r1.getPointAtLength(400).x is within 3 of 27
+PASS r1.getPointAtLength(400).y is within 3 of 5
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/svg/dom/SVGGeometry-rect.xhtml (0 => 231955)


--- trunk/LayoutTests/svg/dom/SVGGeometry-rect.xhtml	                        (rev 0)
+++ trunk/LayoutTests/svg/dom/SVGGeometry-rect.xhtml	2018-05-18 15:22:55 UTC (rev 231955)
@@ -0,0 +1,71 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<script src=""
+</head>
+<body _onload_="run()">
+<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200">
+    <rect id="r1" rx="50" ry="40" width="150" height="100" fill="none" stroke="black" stroke-width="20" stroke-dashoffset="20" stroke-dasharray="20 20"/>
+</svg>
+<p id="description"></p>
+<div id="console"></div>
+<script type="text/_javascript_">
+<![CDATA[
+window.enablePixelTesting = false;
+window.jsTestIsAsync = true;
+var r1 = document.getElementById("r1");
+
+function run() {
+    description("Test SVGGeometryElement APIs for rect.");
+
+    debug("");
+    debug("Test isPointInFill()");
+    shouldBe("r1.isPointInFill({})", "false");
+    shouldBe("r1.isPointInFill({x: 48, y: 0})", "false");
+    shouldBe("r1.isPointInFill({x: 52, y: 0})", "true");
+    shouldBe("r1.isPointInFill({x: 98, y: 0})", "true");
+    shouldBe("r1.isPointInFill({x: 102, y: 0})", "false");
+    shouldBe("r1.isPointInFill({x: 150, y: 38})", "false");
+    shouldBe("r1.isPointInFill({x: 150, y: 42})", "true");
+    shouldBe("r1.isPointInFill({x: 150, y: 58})", "true");
+    shouldBe("r1.isPointInFill({x: 150, y: 62})", "false");
+    shouldBe("r1.isPointInFill({x: 48, y: 100})", "false");
+    shouldBe("r1.isPointInFill({x: 52, y: 100})", "true");
+    shouldBe("r1.isPointInFill({x: 98, y: 100})", "true");
+    shouldBe("r1.isPointInFill({x: 102, y: 100})", "false");
+    shouldBe("r1.isPointInFill({x: 0, y: 38})", "false");
+    shouldBe("r1.isPointInFill({x: 0, y: 42})", "true");
+    shouldBe("r1.isPointInFill({x: 0, y: 58})", "true");
+    shouldBe("r1.isPointInFill({x: 0, y: 62})", "false");
+    shouldBe("r1.isPointInFill({x: 75, y: 50})", "true");
+
+    debug("");
+    debug("Test isPointInStroke()");
+    shouldBe("r1.isPointInStroke({x: 52, y: 0})", "false");
+    shouldBe("r1.isPointInStroke({x: 72, y: 0})", "true");
+    shouldBe("r1.isPointInStroke({x: 92, y: 0})", "false");
+    shouldBe("r1.isPointInStroke({x: 112, y: 10})", "true");
+
+    debug("");
+    debug("Test getTotalLength()");
+    shouldBeCloseTo("r1.getTotalLength()", 424, 1);
+
+    debug("");
+    debug("Test getPointAtLength()");
+    shouldBeCloseTo("r1.getPointAtLength(0).x", 50, 1);
+    shouldBeCloseTo("r1.getPointAtLength(0).y", 0, 1);
+    shouldBeCloseTo("r1.getPointAtLength(25).x", 75, 1);
+    shouldBeCloseTo("r1.getPointAtLength(25).y", 0, 1);
+    shouldBeCloseTo("r1.getPointAtLength(200).x", 112, 3);
+    shouldBeCloseTo("r1.getPointAtLength(200).y", 100, 3);
+    shouldBeCloseTo("r1.getPointAtLength(300).x", 14, 3);
+    shouldBeCloseTo("r1.getPointAtLength(300).y", 88, 3);
+    shouldBeCloseTo("r1.getPointAtLength(400).x", 27, 3);
+    shouldBeCloseTo("r1.getPointAtLength(400).y", 5, 3);
+
+    finishJSTest();
+}
+]]>
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/svg/dom/svg2-inheritance-expected.txt (231954 => 231955)


--- trunk/LayoutTests/svg/dom/svg2-inheritance-expected.txt	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/LayoutTests/svg/dom/svg2-inheritance-expected.txt	2018-05-18 15:22:55 UTC (rev 231955)
@@ -27,7 +27,7 @@
 PASS SVGAnimatedTransformList inherits Object
 PASS SVGAnimationElement inherits SVGElement
 FAIL SVGCSSRule is not defined
-FAIL SVGCircleElement should inherit SVGGeometryElement but got SVGGraphicsElement instead
+PASS SVGCircleElement inherits SVGGeometryElement
 FAIL SVGClipPathElement should inherit SVGDefinitionElement but got SVGGraphicsElement instead
 FAIL SVGColorProfileElement is not defined
 FAIL SVGColorProfileRule is not defined
@@ -35,7 +35,7 @@
 PASS SVGDefsElement inherits SVGGraphicsElement
 PASS SVGDescElement inherits SVGElement
 PASS SVGElement inherits Element
-FAIL SVGEllipseElement should inherit SVGGeometryElement but got SVGGraphicsElement instead
+PASS SVGEllipseElement inherits SVGGeometryElement
 PASS SVGFontElement inherits SVGElement
 PASS SVGFontFaceElement inherits SVGElement
 PASS SVGFontFaceFormatElement inherits SVGElement
@@ -53,7 +53,7 @@
 PASS SVGImageElement inherits SVGGraphicsElement
 PASS SVGLength inherits Object
 PASS SVGLengthList inherits Object
-FAIL SVGLineElement should inherit SVGGeometryElement but got SVGGraphicsElement instead
+PASS SVGLineElement inherits SVGGeometryElement
 PASS SVGLinearGradientElement inherits SVGGradientElement
 PASS SVGMPathElement inherits SVGElement
 PASS SVGMarkerElement inherits SVGElement
@@ -93,12 +93,12 @@
 PASS SVGPatternElement inherits SVGElement
 PASS SVGPoint inherits Object
 PASS SVGPointList inherits Object
-FAIL SVGPolygonElement should inherit SVGGeometryElement but got SVGGraphicsElement instead
-FAIL SVGPolylineElement should inherit SVGGeometryElement but got SVGGraphicsElement instead
+PASS SVGPolygonElement inherits SVGGeometryElement
+PASS SVGPolylineElement inherits SVGGeometryElement
 PASS SVGPreserveAspectRatio inherits Object
 PASS SVGRadialGradientElement inherits SVGGradientElement
 PASS SVGRect inherits Object
-FAIL SVGRectElement should inherit SVGGeometryElement but got SVGGraphicsElement instead
+PASS SVGRectElement inherits SVGGeometryElement
 PASS SVGSVGElement inherits SVGGraphicsElement
 PASS SVGScriptElement inherits SVGElement
 PASS SVGSetElement inherits SVGAnimationElement

Modified: trunk/Source/WebCore/ChangeLog (231954 => 231955)


--- trunk/Source/WebCore/ChangeLog	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/ChangeLog	2018-05-18 15:22:55 UTC (rev 231955)
@@ -1,3 +1,58 @@
+2018-05-18  Dirk Schulze  <[email protected]>
+
+        Make all SVG shape interfaces inherit from SVGGeometryElement
+        https://bugs.webkit.org/show_bug.cgi?id=185600
+
+        Reviewed by Antti Koivisto.
+
+        Make all SVG shape interfaces inherit from SVGGeometryElement
+        as defined by SVG2:
+
+        https://svgwg.org/svg2-draft/shapes.html#DOMInterfaces
+
+        Tests: svg/dom/SVGGeometry-circle.xhtml
+               svg/dom/SVGGeometry-ellipse.xhtml
+               svg/dom/SVGGeometry-line.xhtml
+               svg/dom/SVGGeometry-polygon.xhtml
+               svg/dom/SVGGeometry-polyline.xhtml
+               svg/dom/SVGGeometry-rect.xhtml
+
+        * rendering/svg/RenderSVGShape.cpp:
+        (WebCore::RenderSVGShape::getTotalLength const): Added shape
+                independent implementation for all methods defined
+                by SVGGeometryElement interface. Calculations are
+                based on the Path object created and referenced by
+                RenderSVGShape.
+        (WebCore::RenderSVGShape::getPointAtLength const):
+        * rendering/svg/RenderSVGShape.h:
+        * svg/SVGCircleElement.cpp:
+                Repeating pattern: Change inheritance from
+                SVGGraphicsElement to SVGGeometryElement.
+        (WebCore::SVGCircleElement::SVGCircleElement):
+        * svg/SVGCircleElement.h:
+        * svg/SVGCircleElement.idl:
+        * svg/SVGEllipseElement.cpp:
+        (WebCore::SVGEllipseElement::SVGEllipseElement):
+        * svg/SVGEllipseElement.h:
+        * svg/SVGEllipseElement.idl:
+        * svg/SVGGeometryElement.cpp:
+        (WebCore::SVGGeometryElement::getTotalLength const):
+        (WebCore::SVGGeometryElement::getPointAtLength const):
+        * svg/SVGGeometryElement.h:
+        * svg/SVGLineElement.cpp:
+        (WebCore::SVGLineElement::SVGLineElement):
+        * svg/SVGLineElement.h:
+        * svg/SVGLineElement.idl:
+        * svg/SVGPolyElement.cpp:
+        (WebCore::SVGPolyElement::SVGPolyElement):
+        * svg/SVGPolyElement.h:
+        * svg/SVGPolygonElement.idl:
+        * svg/SVGPolylineElement.idl:
+        * svg/SVGRectElement.cpp:
+        (WebCore::SVGRectElement::SVGRectElement):
+        * svg/SVGRectElement.h:
+        * svg/SVGRectElement.idl:
+
 2018-05-18  Zalan Bujtas  <[email protected]>
 
         [LFC] Implement height computation for replaced elements.

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp (231954 => 231955)


--- trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp	2018-05-18 15:22:55 UTC (rev 231955)
@@ -345,6 +345,23 @@
     return shapeDependentStrokeContains(point, LocalCoordinateSpace);
 }
 
+float RenderSVGShape::getTotalLength() const
+{
+    if (m_path)
+        return m_path->length();
+
+    return 0;
+}
+
+void RenderSVGShape::getPointAtLength(FloatPoint& point, float distance) const
+{
+    if (!m_path)
+        return;
+
+    bool isValid;
+    point = m_path->pointAtLength(distance, isValid);
+}
+
 bool RenderSVGShape::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction)
 {
     // We only draw in the forground phase, so we only hit-test then.

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGShape.h (231954 => 231955)


--- trunk/Source/WebCore/rendering/svg/RenderSVGShape.h	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGShape.h	2018-05-18 15:22:55 UTC (rev 231955)
@@ -65,6 +65,9 @@
     bool isPointInFill(const FloatPoint&);
     bool isPointInStroke(const FloatPoint&);
 
+    float getTotalLength() const;
+    void getPointAtLength(FloatPoint&, float distance) const;
+
     bool hasPath() const { return m_path.get(); }
     Path& path() const
     {

Modified: trunk/Source/WebCore/svg/SVGCircleElement.cpp (231954 => 231955)


--- trunk/Source/WebCore/svg/SVGCircleElement.cpp	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/svg/SVGCircleElement.cpp	2018-05-18 15:22:55 UTC (rev 231955)
@@ -44,11 +44,11 @@
     REGISTER_LOCAL_ANIMATED_PROPERTY(cy)
     REGISTER_LOCAL_ANIMATED_PROPERTY(r)
     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
-    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
+    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement)
 END_REGISTER_ANIMATED_PROPERTIES
 
 inline SVGCircleElement::SVGCircleElement(const QualifiedName& tagName, Document& document)
-    : SVGGraphicsElement(tagName, document)
+    : SVGGeometryElement(tagName, document)
     , m_cx(LengthModeWidth)
     , m_cy(LengthModeHeight)
     , m_r(LengthModeOther)

Modified: trunk/Source/WebCore/svg/SVGCircleElement.h (231954 => 231955)


--- trunk/Source/WebCore/svg/SVGCircleElement.h	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/svg/SVGCircleElement.h	2018-05-18 15:22:55 UTC (rev 231955)
@@ -23,11 +23,11 @@
 #include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedLength.h"
 #include "SVGExternalResourcesRequired.h"
-#include "SVGGraphicsElement.h"
+#include "SVGGeometryElement.h"
 
 namespace WebCore {
 
-class SVGCircleElement final : public SVGGraphicsElement, public SVGExternalResourcesRequired {
+class SVGCircleElement final : public SVGGeometryElement, public SVGExternalResourcesRequired {
     WTF_MAKE_ISO_ALLOCATED(SVGCircleElement);
 public:
     static Ref<SVGCircleElement> create(const QualifiedName&, Document&);

Modified: trunk/Source/WebCore/svg/SVGCircleElement.idl (231954 => 231955)


--- trunk/Source/WebCore/svg/SVGCircleElement.idl	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/svg/SVGCircleElement.idl	2018-05-18 15:22:55 UTC (rev 231955)
@@ -24,7 +24,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-interface SVGCircleElement : SVGGraphicsElement {
+interface SVGCircleElement : SVGGeometryElement {
     readonly attribute SVGAnimatedLength cx;
     readonly attribute SVGAnimatedLength cy;
     readonly attribute SVGAnimatedLength r;

Modified: trunk/Source/WebCore/svg/SVGEllipseElement.cpp (231954 => 231955)


--- trunk/Source/WebCore/svg/SVGEllipseElement.cpp	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/svg/SVGEllipseElement.cpp	2018-05-18 15:22:55 UTC (rev 231955)
@@ -46,11 +46,11 @@
     REGISTER_LOCAL_ANIMATED_PROPERTY(rx)
     REGISTER_LOCAL_ANIMATED_PROPERTY(ry)
     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
-    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
+    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement)
 END_REGISTER_ANIMATED_PROPERTIES
 
 inline SVGEllipseElement::SVGEllipseElement(const QualifiedName& tagName, Document& document)
-    : SVGGraphicsElement(tagName, document)
+    : SVGGeometryElement(tagName, document)
     , m_cx(LengthModeWidth)
     , m_cy(LengthModeHeight)
     , m_rx(LengthModeWidth)

Modified: trunk/Source/WebCore/svg/SVGEllipseElement.h (231954 => 231955)


--- trunk/Source/WebCore/svg/SVGEllipseElement.h	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/svg/SVGEllipseElement.h	2018-05-18 15:22:55 UTC (rev 231955)
@@ -23,11 +23,11 @@
 #include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedLength.h"
 #include "SVGExternalResourcesRequired.h"
-#include "SVGGraphicsElement.h"
+#include "SVGGeometryElement.h"
 
 namespace WebCore {
 
-class SVGEllipseElement final : public SVGGraphicsElement, public SVGExternalResourcesRequired {
+class SVGEllipseElement final : public SVGGeometryElement, public SVGExternalResourcesRequired {
     WTF_MAKE_ISO_ALLOCATED(SVGEllipseElement);
 public:
     static Ref<SVGEllipseElement> create(const QualifiedName&, Document&);

Modified: trunk/Source/WebCore/svg/SVGEllipseElement.idl (231954 => 231955)


--- trunk/Source/WebCore/svg/SVGEllipseElement.idl	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/svg/SVGEllipseElement.idl	2018-05-18 15:22:55 UTC (rev 231955)
@@ -23,7 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-interface SVGEllipseElement : SVGGraphicsElement {
+interface SVGEllipseElement : SVGGeometryElement {
     readonly attribute SVGAnimatedLength cx;
     readonly attribute SVGAnimatedLength cy;
     readonly attribute SVGAnimatedLength rx;

Modified: trunk/Source/WebCore/svg/SVGGeometryElement.cpp (231954 => 231955)


--- trunk/Source/WebCore/svg/SVGGeometryElement.cpp	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/svg/SVGGeometryElement.cpp	2018-05-18 15:22:55 UTC (rev 231955)
@@ -52,6 +52,30 @@
     registerAnimatedPropertiesForSVGGeometryElement();
 }
 
+float SVGGeometryElement::getTotalLength() const
+{
+    document().updateLayoutIgnorePendingStylesheets();
+
+    auto* renderer = downcast<RenderSVGShape>(this->renderer());
+    if (!renderer)
+        return 0;
+
+    return renderer->getTotalLength();
+}
+
+Ref<SVGPoint> SVGGeometryElement::getPointAtLength(float distance) const
+{
+    FloatPoint point { };
+
+    document().updateLayoutIgnorePendingStylesheets();
+
+    auto* renderer = downcast<RenderSVGShape>(this->renderer());
+    if (renderer)
+        renderer->getPointAtLength(point, distance);
+
+    return SVGPoint::create(point);
+}
+
 bool SVGGeometryElement::isPointInFill(DOMPointInit&& pointInit)
 {
     document().updateLayoutIgnorePendingStylesheets();

Modified: trunk/Source/WebCore/svg/SVGGeometryElement.h (231954 => 231955)


--- trunk/Source/WebCore/svg/SVGGeometryElement.h	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/svg/SVGGeometryElement.h	2018-05-18 15:22:55 UTC (rev 231955)
@@ -37,8 +37,8 @@
     WTF_MAKE_ISO_ALLOCATED(SVGGeometryElement);
 public:
     
-    virtual float getTotalLength() const = 0;
-    virtual Ref<SVGPoint> getPointAtLength(float distance) const = 0;
+    virtual float getTotalLength() const;
+    virtual Ref<SVGPoint> getPointAtLength(float distance) const;
 
     bool isPointInFill(DOMPointInit&&);
     bool isPointInStroke(DOMPointInit&&);

Modified: trunk/Source/WebCore/svg/SVGLineElement.cpp (231954 => 231955)


--- trunk/Source/WebCore/svg/SVGLineElement.cpp	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/svg/SVGLineElement.cpp	2018-05-18 15:22:55 UTC (rev 231955)
@@ -46,11 +46,11 @@
     REGISTER_LOCAL_ANIMATED_PROPERTY(x2)
     REGISTER_LOCAL_ANIMATED_PROPERTY(y2)
     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
-    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
+    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement)
 END_REGISTER_ANIMATED_PROPERTIES
 
 inline SVGLineElement::SVGLineElement(const QualifiedName& tagName, Document& document)
-    : SVGGraphicsElement(tagName, document)
+    : SVGGeometryElement(tagName, document)
     , m_x1(LengthModeWidth)
     , m_y1(LengthModeHeight)
     , m_x2(LengthModeWidth)

Modified: trunk/Source/WebCore/svg/SVGLineElement.h (231954 => 231955)


--- trunk/Source/WebCore/svg/SVGLineElement.h	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/svg/SVGLineElement.h	2018-05-18 15:22:55 UTC (rev 231955)
@@ -23,11 +23,11 @@
 #include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedLength.h"
 #include "SVGExternalResourcesRequired.h"
-#include "SVGGraphicsElement.h"
+#include "SVGGeometryElement.h"
 
 namespace WebCore {
 
-class SVGLineElement final : public SVGGraphicsElement, public SVGExternalResourcesRequired {
+class SVGLineElement final : public SVGGeometryElement, public SVGExternalResourcesRequired {
     WTF_MAKE_ISO_ALLOCATED(SVGLineElement);
 public:
     static Ref<SVGLineElement> create(const QualifiedName&, Document&);

Modified: trunk/Source/WebCore/svg/SVGLineElement.idl (231954 => 231955)


--- trunk/Source/WebCore/svg/SVGLineElement.idl	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/svg/SVGLineElement.idl	2018-05-18 15:22:55 UTC (rev 231955)
@@ -23,7 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-interface SVGLineElement : SVGGraphicsElement {
+interface SVGLineElement : SVGGeometryElement {
     readonly attribute SVGAnimatedLength x1;
     readonly attribute SVGAnimatedLength y1;
     readonly attribute SVGAnimatedLength x2;

Modified: trunk/Source/WebCore/svg/SVGPolyElement.cpp (231954 => 231955)


--- trunk/Source/WebCore/svg/SVGPolyElement.cpp	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/svg/SVGPolyElement.cpp	2018-05-18 15:22:55 UTC (rev 231955)
@@ -57,11 +57,11 @@
 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPolyElement)
     REGISTER_LOCAL_ANIMATED_PROPERTY(points)
     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
-    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
+    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement)
 END_REGISTER_ANIMATED_PROPERTIES
 
 SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document& document)
-    : SVGGraphicsElement(tagName, document)
+    : SVGGeometryElement(tagName, document)
 {
     registerAnimatedPropertiesForSVGPolyElement();    
 }

Modified: trunk/Source/WebCore/svg/SVGPolyElement.h (231954 => 231955)


--- trunk/Source/WebCore/svg/SVGPolyElement.h	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/svg/SVGPolyElement.h	2018-05-18 15:22:55 UTC (rev 231955)
@@ -22,13 +22,13 @@
 
 #include "SVGAnimatedBoolean.h"
 #include "SVGExternalResourcesRequired.h"
-#include "SVGGraphicsElement.h"
+#include "SVGGeometryElement.h"
 #include "SVGNames.h"
 #include "SVGPointListValues.h"
 
 namespace WebCore {
 
-class SVGPolyElement : public SVGGraphicsElement, public SVGExternalResourcesRequired {
+class SVGPolyElement : public SVGGeometryElement, public SVGExternalResourcesRequired {
     WTF_MAKE_ISO_ALLOCATED(SVGPolyElement);
 public:
     Ref<SVGPointList> points();

Modified: trunk/Source/WebCore/svg/SVGPolygonElement.idl (231954 => 231955)


--- trunk/Source/WebCore/svg/SVGPolygonElement.idl	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/svg/SVGPolygonElement.idl	2018-05-18 15:22:55 UTC (rev 231955)
@@ -23,7 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-interface SVGPolygonElement : SVGGraphicsElement {
+interface SVGPolygonElement : SVGGeometryElement {
     readonly attribute SVGPointList points;
     readonly attribute SVGPointList animatedPoints;
 };

Modified: trunk/Source/WebCore/svg/SVGPolylineElement.idl (231954 => 231955)


--- trunk/Source/WebCore/svg/SVGPolylineElement.idl	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/svg/SVGPolylineElement.idl	2018-05-18 15:22:55 UTC (rev 231955)
@@ -23,7 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-interface SVGPolylineElement : SVGGraphicsElement {
+interface SVGPolylineElement : SVGGeometryElement {
     readonly attribute SVGPointList points;
     readonly attribute SVGPointList animatedPoints;
 };

Modified: trunk/Source/WebCore/svg/SVGRectElement.cpp (231954 => 231955)


--- trunk/Source/WebCore/svg/SVGRectElement.cpp	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/svg/SVGRectElement.cpp	2018-05-18 15:22:55 UTC (rev 231955)
@@ -50,11 +50,11 @@
     REGISTER_LOCAL_ANIMATED_PROPERTY(rx)
     REGISTER_LOCAL_ANIMATED_PROPERTY(ry)
     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
-    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
+    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement)
 END_REGISTER_ANIMATED_PROPERTIES
 
 inline SVGRectElement::SVGRectElement(const QualifiedName& tagName, Document& document)
-    : SVGGraphicsElement(tagName, document)
+    : SVGGeometryElement(tagName, document)
     , m_x(LengthModeWidth)
     , m_y(LengthModeHeight)
     , m_width(LengthModeWidth)

Modified: trunk/Source/WebCore/svg/SVGRectElement.h (231954 => 231955)


--- trunk/Source/WebCore/svg/SVGRectElement.h	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/svg/SVGRectElement.h	2018-05-18 15:22:55 UTC (rev 231955)
@@ -23,12 +23,12 @@
 #include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedLength.h"
 #include "SVGExternalResourcesRequired.h"
-#include "SVGGraphicsElement.h"
+#include "SVGGeometryElement.h"
 #include "SVGNames.h"
 
 namespace WebCore {
 
-class SVGRectElement final : public SVGGraphicsElement, public SVGExternalResourcesRequired {
+class SVGRectElement final : public SVGGeometryElement, public SVGExternalResourcesRequired {
     WTF_MAKE_ISO_ALLOCATED(SVGRectElement);
 public:
     static Ref<SVGRectElement> create(const QualifiedName&, Document&);

Modified: trunk/Source/WebCore/svg/SVGRectElement.idl (231954 => 231955)


--- trunk/Source/WebCore/svg/SVGRectElement.idl	2018-05-18 15:09:14 UTC (rev 231954)
+++ trunk/Source/WebCore/svg/SVGRectElement.idl	2018-05-18 15:22:55 UTC (rev 231955)
@@ -24,7 +24,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-interface SVGRectElement : SVGGraphicsElement {
+interface SVGRectElement : SVGGeometryElement {
     readonly attribute SVGAnimatedLength x;
     readonly attribute SVGAnimatedLength y;
     readonly attribute SVGAnimatedLength width;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to