Changeset 252563 in webkit
- Timestamp:
- Nov 18, 2019 1:45:40 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r252562 r252563 1 2019-11-18 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Fix getTotalLength() and getPointAtLength() for optimized rect and ellipse renderers 4 https://bugs.webkit.org/show_bug.cgi?id=204213 5 6 Reviewed by Simon Fraser. 7 8 The following tests were added in r231955. The SVGElements in these were 9 defined such that a path has to be created to render any of them. Change 10 all the tests, except the polygon and the polyline, such that no path is 11 needed to render them. This will exercise the code path where we need to 12 create a temporary Path to answer the questions of getTotalLength() and 13 getPointAtLength(). 14 15 * svg/dom/SVGGeometry-circle-expected.txt: 16 * svg/dom/SVGGeometry-circle.xhtml: 17 * svg/dom/SVGGeometry-ellipse-expected.txt: 18 * svg/dom/SVGGeometry-ellipse.xhtml: 19 * svg/dom/SVGGeometry-line-expected.txt: 20 * svg/dom/SVGGeometry-line.xhtml: 21 * svg/dom/SVGGeometry-polygon-expected.txt: 22 * svg/dom/SVGGeometry-polygon.xhtml: 23 * svg/dom/SVGGeometry-polyline-expected.txt: 24 * svg/dom/SVGGeometry-polyline.xhtml: 25 * svg/dom/SVGGeometry-rect-expected.txt: 26 * svg/dom/SVGGeometry-rect.xhtml: 27 1 28 2019-11-18 Zalan Bujtas <zalan@apple.com> 2 29 -
trunk/LayoutTests/imported/w3c/ChangeLog
r252561 r252563 1 2019-11-18 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Fix getTotalLength() and getPointAtLength() for optimized rect and ellipse renderers 4 https://bugs.webkit.org/show_bug.cgi?id=204213 5 6 Reviewed by Simon Fraser. 7 8 * web-platform-tests/svg/types/elements/SVGGeometryElement-rect-expected.txt: 9 1 10 2019-11-18 Wenson Hsieh <wenson_hsieh@apple.com> 2 11 -
trunk/LayoutTests/imported/w3c/web-platform-tests/svg/types/elements/SVGGeometryElement-rect-expected.txt
r251777 r252563 1 1 2 FAIL getTotalLength and getPointAtLength do not take pathLength into account assert_equals: expected 600 but got 0 2 PASS getTotalLength and getPointAtLength do not take pathLength into account 3 3 FAIL getPointAtLength() returns instance of DOMPoint assert_true: expected true got false 4 4 -
trunk/LayoutTests/svg/dom/SVGGeometry-circle-expected.txt
r231955 r252563 7 7 Test isPointInFill() 8 8 PASS c1.isPointInFill({}) is false 9 PASS c1.isPointInFill({x: 50, y: 50}) is true 10 PASS c1.isPointInFill({x: 0, y: 50}) is true 11 PASS c1.isPointInFill({x: 100, y: 50}) is true 12 PASS c1.isPointInFill({x: 50, y: 0}) is true 13 PASS c1.isPointInFill({x: 50, y: 100}) is true 14 PASS c1.isPointInFill({x: -1, y: 50}) is false 15 PASS c1.isPointInFill({x: 101, y: 50}) is false 16 PASS c1.isPointInFill({x: 50, y: -1}) is false 17 PASS c1.isPointInFill({x: 50, y: 101}) is false 18 PASS c1.isPointInFill({x: 90, y: 90}) is false 19 PASS c1.isPointInFill({x: 10, y: 10}) is false 20 PASS c1.isPointInFill({x: 90, y: 10}) is false 21 PASS c1.isPointInFill({x: 10, y: 90}) is false 9 PASS c1.isPointInFill({x: 109, y: 60}) is true 10 PASS c1.isPointInFill({x: 111, y: 60}) is false 11 PASS c1.isPointInFill({x: 60, y: 109}) is true 12 PASS c1.isPointInFill({x: 60, y: 111}) is false 13 PASS c1.isPointInFill({x: 11, y: 60}) is true 14 PASS c1.isPointInFill({x: 9, y: 60}) is false 15 PASS c1.isPointInFill({x: 60, y: 11}) is true 16 PASS c1.isPointInFill({x: 60, y: 9}) is false 22 17 23 18 Test isPointInStroke() 24 19 PASS c1.isPointInStroke({}) is false 25 PASS c1.isPointInStroke({x: 50, y: 50}) is false 26 PASS c1.isPointInStroke({x: 100, y: 51}) is false 27 PASS c1.isPointInStroke({x: 100, y: 49}) is true 28 PASS c1.isPointInStroke({x: 0, y: 50}) is true 29 PASS c1.isPointInStroke({x: 52, y: 100}) is true 30 PASS c1.isPointInStroke({x: 48, y: 100}) is false 20 PASS c1.isPointInStroke({x: 101, y: 60}) is true 21 PASS c1.isPointInStroke({x: 99, y: 60}) is false 22 PASS c1.isPointInStroke({x: 60, y: 101}) is true 23 PASS c1.isPointInStroke({x: 60, y: 99}) is false 24 PASS c1.isPointInStroke({x: 19, y: 60}) is true 25 PASS c1.isPointInStroke({x: 21, y: 60}) is false 26 PASS c1.isPointInStroke({x: 60, y: 19}) is true 27 PASS c1.isPointInStroke({x: 60, y: 21}) is false 31 28 32 29 Test getTotalLength() … … 34 31 35 32 Test getPointAtLength() 36 PASS c1.getPointAtLength(0).x is within 0.1 of 1 0037 PASS c1.getPointAtLength(0).y is within 0.1 of 5038 PASS c1.getPointAtLength(Math.PI * 100 / 4).x is within 0.1 of 5039 PASS c1.getPointAtLength(Math.PI * 100 / 4).y is within 0.1 of 1 0040 PASS c1.getPointAtLength(Math.PI * 100 / 2).x is within 0.1 of 041 PASS c1.getPointAtLength(Math.PI * 100 / 2).y is within 0.1 of 5042 PASS c1.getPointAtLength(Math.PI * 100 / 8).x is within 1 of 85.3543 PASS c1.getPointAtLength(Math.PI * 100 / 8).y is within 1 of 85.3544 PASS c1.getPointAtLength(Math.PI * 100 * 2).x is within 0.1 of 1 0045 PASS c1.getPointAtLength(Math.PI * 100 * 2).y is within 0.1 of 5033 PASS c1.getPointAtLength(0).x is within 0.1 of 110 34 PASS c1.getPointAtLength(0).y is within 0.1 of 60 35 PASS c1.getPointAtLength(Math.PI * 100 / 4).x is within 0.1 of 60 36 PASS c1.getPointAtLength(Math.PI * 100 / 4).y is within 0.1 of 110 37 PASS c1.getPointAtLength(Math.PI * 100 / 2).x is within 0.1 of 10 38 PASS c1.getPointAtLength(Math.PI * 100 / 2).y is within 0.1 of 60 39 PASS c1.getPointAtLength(Math.PI * 100 / 8).x is within 1 of 95.35 40 PASS c1.getPointAtLength(Math.PI * 100 / 8).y is within 1 of 95.35 41 PASS c1.getPointAtLength(Math.PI * 100 * 2).x is within 0.1 of 110 42 PASS c1.getPointAtLength(Math.PI * 100 * 2).y is within 0.1 of 60 46 43 PASS successfullyParsed is true 47 44 -
trunk/LayoutTests/svg/dom/SVGGeometry-circle.xhtml
r231955 r252563 5 5 <body onload="run()"> 6 6 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200"> 7 <circle id="c1" cx=" 50" cy="50" r="50" fill="none" stroke="black" stroke-width="20" stroke-dashoffset="20" stroke-dasharray="2020"/>7 <circle id="c1" cx="60" cy="60" r="50" fill="none" stroke="black" stroke-width="20"/> 8 8 </svg> 9 9 <p id="description"></p> … … 20 20 debug(""); 21 21 debug("Test isPointInFill()"); 22 shouldBe("c1.isPointInFill({})", "false"); 23 shouldBe("c1.isPointInFill({x: 50, y: 50})", "true"); 24 shouldBe("c1.isPointInFill({x: 0, y: 50})", "true"); 25 shouldBe("c1.isPointInFill({x: 100, y: 50})", "true"); 26 shouldBe("c1.isPointInFill({x: 50, y: 0})", "true"); 27 shouldBe("c1.isPointInFill({x: 50, y: 100})", "true"); 28 shouldBe("c1.isPointInFill({x: -1, y: 50})", "false"); 29 shouldBe("c1.isPointInFill({x: 101, y: 50})", "false"); 30 shouldBe("c1.isPointInFill({x: 50, y: -1})", "false"); 31 shouldBe("c1.isPointInFill({x: 50, y: 101})", "false"); 32 shouldBe("c1.isPointInFill({x: 90, y: 90})", "false"); 33 shouldBe("c1.isPointInFill({x: 10, y: 10})", "false"); 34 shouldBe("c1.isPointInFill({x: 90, y: 10})", "false"); 35 shouldBe("c1.isPointInFill({x: 10, y: 90})", "false"); 22 shouldBeFalse("c1.isPointInFill({})", "false"); 23 shouldBeTrue("c1.isPointInFill({x: 109, y: 60})"); 24 shouldBeFalse("c1.isPointInFill({x: 111, y: 60})"); 25 shouldBeTrue("c1.isPointInFill({x: 60, y: 109})"); 26 shouldBeFalse("c1.isPointInFill({x: 60, y: 111})"); 27 shouldBeTrue("c1.isPointInFill({x: 11, y: 60})"); 28 shouldBeFalse("c1.isPointInFill({x: 9, y: 60})"); 29 shouldBeTrue("c1.isPointInFill({x: 60, y: 11})"); 30 shouldBeFalse("c1.isPointInFill({x: 60, y: 9})"); 36 31 37 32 debug(""); 38 33 debug("Test isPointInStroke()"); 39 shouldBe("c1.isPointInStroke({})", "false"); 40 shouldBe("c1.isPointInStroke({x: 50, y: 50})", "false"); 41 shouldBe("c1.isPointInStroke({x: 100, y: 51})", "false"); 42 shouldBe("c1.isPointInStroke({x: 100, y: 49})", "true"); 43 shouldBe("c1.isPointInStroke({x: 0, y: 50})", "true"); 44 shouldBe("c1.isPointInStroke({x: 52, y: 100})", "true"); 45 shouldBe("c1.isPointInStroke({x: 48, y: 100})", "false"); 34 shouldBeFalse("c1.isPointInStroke({})"); 35 shouldBeTrue("c1.isPointInStroke({x: 101, y: 60})"); 36 shouldBeFalse("c1.isPointInStroke({x: 99, y: 60})"); 37 shouldBeTrue("c1.isPointInStroke({x: 60, y: 101})"); 38 shouldBeFalse("c1.isPointInStroke({x: 60, y: 99})"); 39 shouldBeTrue("c1.isPointInStroke({x: 19, y: 60})"); 40 shouldBeFalse("c1.isPointInStroke({x: 21, y: 60})"); 41 shouldBeTrue("c1.isPointInStroke({x: 60, y: 19})"); 42 shouldBeFalse("c1.isPointInStroke({x: 60, y: 21})"); 46 43 47 44 debug(""); … … 51 48 debug(""); 52 49 debug("Test getPointAtLength()"); 53 shouldBeCloseTo("c1.getPointAtLength(0).x", 1 00, 0.1);54 shouldBeCloseTo("c1.getPointAtLength(0).y", 50, 0.1);55 shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 4).x", 50, 0.1);56 shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 4).y", 1 00, 0.1);57 shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 2).x", 0, 0.1);58 shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 2).y", 50, 0.1);59 shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 8).x", 85.35, 1);60 shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 8).y", 85.35, 1);61 shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 * 2).x", 1 00, 0.1);62 shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 * 2).y", 50, 0.1);50 shouldBeCloseTo("c1.getPointAtLength(0).x", 110, 0.1); 51 shouldBeCloseTo("c1.getPointAtLength(0).y", 60, 0.1); 52 shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 4).x", 60, 0.1); 53 shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 4).y", 110, 0.1); 54 shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 2).x", 10, 0.1); 55 shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 2).y", 60, 0.1); 56 shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 8).x", 95.35, 1); 57 shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 8).y", 95.35, 1); 58 shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 * 2).x", 110, 0.1); 59 shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 * 2).y", 60, 0.1); 63 60 64 61 finishJSTest(); -
trunk/LayoutTests/svg/dom/SVGGeometry-ellipse-expected.txt
r231955 r252563 7 7 Test isPointInFill() 8 8 PASS e1.isPointInFill({}) is false 9 PASS e1.isPointInFill({x: 75, y: 50}) is true 10 PASS e1.isPointInFill({x: 0, y: 50}) is true 11 PASS e1.isPointInFill({x: 150, y: 50}) is true 12 PASS e1.isPointInFill({x: 75, y: 0}) is true 13 PASS e1.isPointInFill({x: 75, y: 100}) is true 14 PASS e1.isPointInFill({x: -1, y: 50}) is false 15 PASS e1.isPointInFill({x: 151, y: 50}) is false 16 PASS e1.isPointInFill({x: 75, y: -1}) is false 17 PASS e1.isPointInFill({x: 75, y: 101}) is false 18 PASS e1.isPointInFill({x: 140, y: 90}) is false 19 PASS e1.isPointInFill({x: 10, y: 10}) is false 20 PASS e1.isPointInFill({x: 140, y: 10}) is false 21 PASS e1.isPointInFill({x: 10, y: 90}) is false 9 PASS e1.isPointInFill({x: 159, y: 60}) is true 10 PASS e1.isPointInFill({x: 161, y: 60}) is false 11 PASS e1.isPointInFill({x: 85, y: 109}) is true 12 PASS e1.isPointInFill({x: 85, y: 111}) is false 13 PASS e1.isPointInFill({x: 11, y: 60}) is true 14 PASS e1.isPointInFill({x: 9, y: 60}) is false 15 PASS e1.isPointInFill({x: 85, y: 11}) is true 16 PASS e1.isPointInFill({x: 85, y: 9}) is false 22 17 23 18 Test isPointInStroke() 24 19 PASS e1.isPointInStroke({}) is false 25 PASS e1.isPointInStroke({x: 75, y: 50}) is false 26 PASS e1.isPointInStroke({x: 150, y: 51}) is false 27 PASS e1.isPointInStroke({x: 150, y: 49}) is true 28 PASS e1.isPointInStroke({x: 0, y: 52}) is true 29 PASS e1.isPointInStroke({x: 0, y: 48}) is false 30 PASS e1.isPointInStroke({x: 77, y: 100}) is false 31 PASS e1.isPointInStroke({x: 73, y: 100}) is true 20 PASS e1.isPointInStroke({x: 151, y: 60}) is true 21 PASS e1.isPointInStroke({x: 149, y: 60}) is false 22 PASS e1.isPointInStroke({x: 85, y: 101}) is true 23 PASS e1.isPointInStroke({x: 85, y: 99}) is false 24 PASS e1.isPointInStroke({x: 19, y: 60}) is true 25 PASS e1.isPointInStroke({x: 21, y: 60}) is false 26 PASS e1.isPointInStroke({x: 85, y: 19}) is true 27 PASS e1.isPointInStroke({x: 85, y: 21}) is false 32 28 33 29 Test getTotalLength() … … 35 31 36 32 Test getPointAtLength() 37 PASS e1.getPointAtLength(0).x is within 0.1 of 1 5038 PASS e1.getPointAtLength(0).y is within 0.1 of 5039 PASS e1.getPointAtLength(Math.PI * (75 + 50) / 4).x is within 3 of 7540 PASS e1.getPointAtLength(Math.PI * (75 + 50) / 4).y is within 3 of 1 0041 PASS e1.getPointAtLength(Math.PI * (75 + 50) / 2).x is within 3 of 042 PASS e1.getPointAtLength(Math.PI * (75 + 50) / 2).y is within 3 of 5043 PASS e1.getPointAtLength(Math.PI * (75 + 50) / 8).x is within 3 of 1 2344 PASS e1.getPointAtLength(Math.PI * (75 + 50) / 8).y is within 3 of 8845 PASS e1.getPointAtLength(Math.PI * (75 + 50) * 2).x is within 3 of 1 5046 PASS e1.getPointAtLength(Math.PI * (75 + 50) * 2).y is within 3 of 5033 PASS e1.getPointAtLength(0).x is within 0.1 of 160 34 PASS e1.getPointAtLength(0).y is within 0.1 of 60 35 PASS e1.getPointAtLength(Math.PI * (75 + 50) / 4).x is within 3 of 85 36 PASS e1.getPointAtLength(Math.PI * (75 + 50) / 4).y is within 3 of 110 37 PASS e1.getPointAtLength(Math.PI * (75 + 50) / 2).x is within 3 of 10 38 PASS e1.getPointAtLength(Math.PI * (75 + 50) / 2).y is within 3 of 60 39 PASS e1.getPointAtLength(Math.PI * (75 + 50) / 8).x is within 3 of 133 40 PASS e1.getPointAtLength(Math.PI * (75 + 50) / 8).y is within 3 of 98 41 PASS e1.getPointAtLength(Math.PI * (75 + 50) * 2).x is within 3 of 160 42 PASS e1.getPointAtLength(Math.PI * (75 + 50) * 2).y is within 3 of 60 47 43 PASS successfullyParsed is true 48 44 -
trunk/LayoutTests/svg/dom/SVGGeometry-ellipse.xhtml
r231955 r252563 5 5 <body onload="run()"> 6 6 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200"> 7 <ellipse id="e1" cx=" 75" cy="50" rx="75" ry="50" fill="none" stroke="black" stroke-width="20" stroke-dashoffset="20" stroke-dasharray="2020"/>7 <ellipse id="e1" cx="85" cy="60" rx="75" ry="50" fill="none" stroke="black" stroke-width="20"/> 8 8 </svg> 9 9 <p id="description"></p> … … 20 20 debug(""); 21 21 debug("Test isPointInFill()"); 22 shouldBe("e1.isPointInFill({})", "false"); 23 shouldBe("e1.isPointInFill({x: 75, y: 50})", "true"); 24 shouldBe("e1.isPointInFill({x: 0, y: 50})", "true"); 25 shouldBe("e1.isPointInFill({x: 150, y: 50})", "true"); 26 shouldBe("e1.isPointInFill({x: 75, y: 0})", "true"); 27 shouldBe("e1.isPointInFill({x: 75, y: 100})", "true"); 28 shouldBe("e1.isPointInFill({x: -1, y: 50})", "false"); 29 shouldBe("e1.isPointInFill({x: 151, y: 50})", "false"); 30 shouldBe("e1.isPointInFill({x: 75, y: -1})", "false"); 31 shouldBe("e1.isPointInFill({x: 75, y: 101})", "false"); 32 shouldBe("e1.isPointInFill({x: 140, y: 90})", "false"); 33 shouldBe("e1.isPointInFill({x: 10, y: 10})", "false"); 34 shouldBe("e1.isPointInFill({x: 140, y: 10})", "false"); 35 shouldBe("e1.isPointInFill({x: 10, y: 90})", "false"); 22 shouldBeFalse("e1.isPointInFill({})"); 23 shouldBeTrue("e1.isPointInFill({x: 159, y: 60})"); 24 shouldBeFalse("e1.isPointInFill({x: 161, y: 60})"); 25 26 shouldBeTrue("e1.isPointInFill({x: 85, y: 109})"); 27 shouldBeFalse("e1.isPointInFill({x: 85, y: 111})"); 28 shouldBeTrue("e1.isPointInFill({x: 11, y: 60})"); 29 shouldBeFalse("e1.isPointInFill({x: 9, y: 60})"); 30 shouldBeTrue("e1.isPointInFill({x: 85, y: 11})"); 31 shouldBeFalse("e1.isPointInFill({x: 85, y: 9})"); 36 32 37 33 debug(""); 38 34 debug("Test isPointInStroke()"); 39 shouldBe("e1.isPointInStroke({})", "false"); 40 shouldBe("e1.isPointInStroke({x: 75, y: 50})", "false"); 41 shouldBe("e1.isPointInStroke({x: 150, y: 51})", "false"); 42 shouldBe("e1.isPointInStroke({x: 150, y: 49})", "true"); 43 shouldBe("e1.isPointInStroke({x: 0, y: 52})", "true"); 44 shouldBe("e1.isPointInStroke({x: 0, y: 48})", "false"); 45 shouldBe("e1.isPointInStroke({x: 77, y: 100})", "false"); 46 shouldBe("e1.isPointInStroke({x: 73, y: 100})", "true"); 35 shouldBeFalse("e1.isPointInStroke({})"); 36 shouldBeTrue("e1.isPointInStroke({x: 151, y: 60})"); 37 shouldBeFalse("e1.isPointInStroke({x: 149, y: 60})"); 38 shouldBeTrue("e1.isPointInStroke({x: 85, y: 101})"); 39 shouldBeFalse("e1.isPointInStroke({x: 85, y: 99})"); 40 shouldBeTrue("e1.isPointInStroke({x: 19, y: 60})"); 41 shouldBeFalse("e1.isPointInStroke({x: 21, y: 60})"); 42 shouldBeTrue("e1.isPointInStroke({x: 85, y: 19})"); 43 shouldBeFalse("e1.isPointInStroke({x: 85, y: 21})"); 47 44 48 45 debug(""); … … 52 49 debug(""); 53 50 debug("Test getPointAtLength()"); 54 shouldBeCloseTo("e1.getPointAtLength(0).x", 1 50, 0.1);55 shouldBeCloseTo("e1.getPointAtLength(0).y", 50, 0.1);56 shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) / 4).x", 75, 3);57 shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) / 4).y", 1 00, 3);58 shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) / 2).x", 0, 3);59 shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) / 2).y", 50, 3);60 shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) / 8).x", 1 23, 3);61 shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) / 8).y", 88, 3);62 shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) * 2).x", 1 50, 3);63 shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) * 2).y", 50, 3);51 shouldBeCloseTo("e1.getPointAtLength(0).x", 160, 0.1); 52 shouldBeCloseTo("e1.getPointAtLength(0).y", 60, 0.1); 53 shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) / 4).x", 85, 3); 54 shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) / 4).y", 110, 3); 55 shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) / 2).x", 10, 3); 56 shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) / 2).y", 60, 3); 57 shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) / 8).x", 133, 3); 58 shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) / 8).y", 98, 3); 59 shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) * 2).x", 160, 3); 60 shouldBeCloseTo("e1.getPointAtLength(Math.PI * (75 + 50) * 2).y", 60, 3); 64 61 65 62 finishJSTest(); -
trunk/LayoutTests/svg/dom/SVGGeometry-line-expected.txt
r231955 r252563 7 7 Test isPointInFill() 8 8 PASS l1.isPointInFill({}) is false 9 PASS l1.isPointInFill({x: 0, y: 50}) is true 10 PASS l1.isPointInFill({x: 50, y: 50}) is true 11 PASS l1.isPointInFill({x: 100, y: 50}) is true 12 PASS l1.isPointInFill({x: 50, y: 49}) is false 13 PASS l1.isPointInFill({x: 50, y: 51}) is false 9 PASS l1.isPointInFill({x: 0, y: 10}) is true 10 PASS l1.isPointInFill({x: 0, y: 11}) is false 11 PASS l1.isPointInFill({x: 100, y: 10}) is true 12 PASS l1.isPointInFill({x: 100, y: 11}) is false 13 PASS l1.isPointInFill({x: 101, y: 10}) is false 14 PASS l1.isPointInFill({x: 101, y: 11}) is false 14 15 15 16 Test isPointInStroke() 16 PASS l1.isPointInStroke({x: 19, y: 50}) is false 17 PASS l1.isPointInStroke({x: 20, y: 50}) is true 18 PASS l1.isPointInStroke({x: 39, y: 50}) is true 19 PASS l1.isPointInStroke({x: 40, y: 50}) is true 20 PASS l1.isPointInStroke({x: 41, y: 50}) is false 17 PASS l1.isPointInStroke({ }) is true 18 PASS l1.isPointInStroke({x: 0, y: 0}) is true 19 PASS l1.isPointInStroke({x: 0, y: 21}) is false 20 PASS l1.isPointInStroke({x: 50, y: 0}) is true 21 PASS l1.isPointInStroke({x: 50, y: 21}) is false 22 PASS l1.isPointInStroke({x: 100, y: 0}) is true 23 PASS l1.isPointInStroke({x: 100, y: 21}) is false 24 PASS l1.isPointInStroke({x: 101, y: 0}) is false 25 PASS l1.isPointInStroke({x: 101, y: 21}) is false 21 26 22 27 Test getTotalLength() 23 PASS l1.getTotalLength() is within 1 of 10028 PASS l1.getTotalLength() is within 0.1 of 100 24 29 25 30 Test getPointAtLength() 26 31 PASS l1.getPointAtLength(0).x is within 0.1 of 0 27 PASS l1.getPointAtLength(0).y is within 0.1 of 5032 PASS l1.getPointAtLength(0).y is within 0.1 of 10 28 33 PASS l1.getPointAtLength(50).x is within 0.1 of 50 29 PASS l1.getPointAtLength(50).y is within 0.1 of 5034 PASS l1.getPointAtLength(50).y is within 0.1 of 10 30 35 PASS l1.getPointAtLength(100).x is within 0.1 of 100 31 PASS l1.getPointAtLength(100).y is within 0.1 of 5036 PASS l1.getPointAtLength(100).y is within 0.1 of 10 32 37 PASS l1.getPointAtLength(150).x is within 0.1 of 100 33 PASS l1.getPointAtLength(150).y is within 0.1 of 5038 PASS l1.getPointAtLength(150).y is within 0.1 of 10 34 39 PASS successfullyParsed is true 35 40 -
trunk/LayoutTests/svg/dom/SVGGeometry-line.xhtml
r231955 r252563 5 5 <body onload="run()"> 6 6 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200"> 7 <line id="l1" x1="0" y1=" 50" x2="100" y2="50" fill="none" stroke="black" stroke-width="20" stroke-dashoffset="20" stroke-dasharray="2020"/>7 <line id="l1" x1="0" y1="10" x2="100" y2="10" fill="none" stroke="black" stroke-width="20"/> 8 8 </svg> 9 9 <p id="description"></p> … … 21 21 debug("Test isPointInFill()"); 22 22 shouldBe("l1.isPointInFill({})", "false"); 23 shouldBe("l1.isPointInFill({x: 0, y: 50})", "true"); 24 shouldBe("l1.isPointInFill({x: 50, y: 50})", "true"); 25 shouldBe("l1.isPointInFill({x: 100, y: 50})", "true"); 26 shouldBe("l1.isPointInFill({x: 50, y: 49})", "false"); 27 shouldBe("l1.isPointInFill({x: 50, y: 51})", "false"); 23 shouldBeTrue("l1.isPointInFill({x: 0, y: 10})"); 24 shouldBeFalse("l1.isPointInFill({x: 0, y: 11})"); 25 shouldBeTrue("l1.isPointInFill({x: 100, y: 10})"); 26 shouldBeFalse("l1.isPointInFill({x: 100, y: 11})"); 27 shouldBeFalse("l1.isPointInFill({x: 101, y: 10})"); 28 shouldBeFalse("l1.isPointInFill({x: 101, y: 11})"); 28 29 29 30 debug(""); 30 31 debug("Test isPointInStroke()"); 31 shouldBe("l1.isPointInStroke({x: 19, y: 50})", "false"); 32 shouldBe("l1.isPointInStroke({x: 20, y: 50})", "true"); 33 shouldBe("l1.isPointInStroke({x: 39, y: 50})", "true"); 34 shouldBe("l1.isPointInStroke({x: 40, y: 50})", "true"); 35 shouldBe("l1.isPointInStroke({x: 41, y: 50})", "false"); 32 shouldBeTrue("l1.isPointInStroke({ })"); 33 shouldBeTrue("l1.isPointInStroke({x: 0, y: 0})"); 34 shouldBeFalse("l1.isPointInStroke({x: 0, y: 21})"); 35 shouldBeTrue("l1.isPointInStroke({x: 50, y: 0})"); 36 shouldBeFalse("l1.isPointInStroke({x: 50, y: 21})"); 37 shouldBeTrue("l1.isPointInStroke({x: 100, y: 0})"); 38 shouldBeFalse("l1.isPointInStroke({x: 100, y: 21})"); 39 shouldBeFalse("l1.isPointInStroke({x: 101, y: 0})"); 40 shouldBeFalse("l1.isPointInStroke({x: 101, y: 21})"); 36 41 37 42 debug(""); 38 43 debug("Test getTotalLength()"); 39 shouldBeCloseTo("l1.getTotalLength()", 100, 1);44 shouldBeCloseTo("l1.getTotalLength()", 100, 0.1); 40 45 41 46 debug(""); 42 47 debug("Test getPointAtLength()"); 43 48 shouldBeCloseTo("l1.getPointAtLength(0).x", 0, 0.1); 44 shouldBeCloseTo("l1.getPointAtLength(0).y", 50, 0.1);49 shouldBeCloseTo("l1.getPointAtLength(0).y", 10, 0.1); 45 50 shouldBeCloseTo("l1.getPointAtLength(50).x", 50, 0.1); 46 shouldBeCloseTo("l1.getPointAtLength(50).y", 50, 0.1);51 shouldBeCloseTo("l1.getPointAtLength(50).y", 10, 0.1); 47 52 shouldBeCloseTo("l1.getPointAtLength(100).x", 100, 0.1); 48 shouldBeCloseTo("l1.getPointAtLength(100).y", 50, 0.1);53 shouldBeCloseTo("l1.getPointAtLength(100).y", 10, 0.1); 49 54 shouldBeCloseTo("l1.getPointAtLength(150).x", 100, 0.1); 50 shouldBeCloseTo("l1.getPointAtLength(150).y", 50, 0.1);55 shouldBeCloseTo("l1.getPointAtLength(150).y", 10, 0.1); 51 56 52 57 finishJSTest(); -
trunk/LayoutTests/svg/dom/SVGGeometry-polygon-expected.txt
r231955 r252563 6 6 7 7 Test isPointInFill() 8 PASS p1.isPointInFill({}) is true 9 PASS p1.isPointInFill({x: 100, y: 0}) is true 10 PASS p1.isPointInFill({x: 152, y: 0}) is false 11 PASS p1.isPointInFill({x: 150, y: 50}) is true 12 PASS p1.isPointInFill({x: 150, y: 100}) is true 13 PASS p1.isPointInFill({x: 150, y: 101}) is false 14 PASS p1.isPointInFill({x: 100, y: 100}) is true 15 PASS p1.isPointInFill({x: 75, y: 50}) is true 8 PASS p1.isPointInFill({}) is false 9 PASS p1.isPointInFill({x: 9, y: 9}) is false 10 PASS p1.isPointInFill({x: 10, y: 10}) is true 11 PASS p1.isPointInFill({x: 159, y: 9}) is false 12 PASS p1.isPointInFill({x: 160, y: 10}) is true 13 PASS p1.isPointInFill({x: 161, y: 110}) is false 14 PASS p1.isPointInFill({x: 160, y: 109}) is true 15 PASS p1.isPointInFill({x: 9, y: 109}) is false 16 PASS p1.isPointInFill({x: 10, y: 110}) is true 16 17 17 18 Test isPointInStroke() 18 PASS p1.isPointInStroke({x: 0, y: 0}) is false 19 PASS p1.isPointInStroke({x: 20, y: 0}) is true 20 PASS p1.isPointInStroke({x: 150, y: 0}) is true 21 PASS p1.isPointInStroke({x: 150, y: 35}) is true 22 PASS p1.isPointInStroke({x: 75, y: 50}) is false 19 PASS p1.isPointInStroke({x: 20, y: 20}) is true 20 PASS p1.isPointInStroke({x: 21, y: 21}) is false 21 PASS p1.isPointInStroke({x: 150, y: 20}) is true 22 PASS p1.isPointInStroke({x: 149, y: 21}) is false 23 PASS p1.isPointInStroke({x: 150, y: 100}) is true 24 PASS p1.isPointInStroke({x: 149, y: 99}) is false 25 PASS p1.isPointInStroke({x: 20, y: 100}) is true 26 PASS p1.isPointInStroke({x: 21, y: 99}) is false 23 27 24 28 Test getTotalLength() … … 26 30 27 31 Test getPointAtLength() 28 PASS p1.getPointAtLength(0).x is within 0.1 of 029 PASS p1.getPointAtLength(0).y is within 0.1 of 030 PASS p1.getPointAtLength(150).x is within 0.1 of 1 5031 PASS p1.getPointAtLength(150).y is within 0.1 of 032 PASS p1.getPointAtLength(2 00).x is within 0.1 of 15033 PASS p1.getPointAtLength(2 00).y is within 0.1 of 5034 PASS p1.getPointAtLength( 300).x is within 0.1 of 10035 PASS p1.getPointAtLength( 300).y is within 0.1 of 10036 PASS p1.getPointAtLength( 450).x is within 0.1 of037 PASS p1.getPointAtLength( 450).y is within 0.1 of 5032 PASS p1.getPointAtLength(0).x is within 0.1 of 10 33 PASS p1.getPointAtLength(0).y is within 0.1 of 10 34 PASS p1.getPointAtLength(150).x is within 0.1 of 160 35 PASS p1.getPointAtLength(150).y is within 0.1 of 10 36 PASS p1.getPointAtLength(250).x is within 0.1 of 160 37 PASS p1.getPointAtLength(250).y is within 0.1 of 110 38 PASS p1.getPointAtLength(400).x is within 0.1 of 10 39 PASS p1.getPointAtLength(400).y is within 0.1 of 110 40 PASS p1.getPointAtLength(500).x is within 0.1 of 10 41 PASS p1.getPointAtLength(500).y is within 0.1 of 10 38 42 PASS successfullyParsed is true 39 43 -
trunk/LayoutTests/svg/dom/SVGGeometry-polygon.xhtml
r231955 r252563 5 5 <body onload="run()"> 6 6 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200"> 7 <polygon id="p1" points=" 0,0 150,0 150,100 0,100" fill="none" stroke="black" stroke-width="20" stroke-dashoffset="20" stroke-dasharray="2020"/>7 <polygon id="p1" points="10,10 160,10 160,110 10,110" fill="none" stroke="black" stroke-width="20"/> 8 8 </svg> 9 9 <p id="description"></p> … … 20 20 debug(""); 21 21 debug("Test isPointInFill()"); 22 shouldBe("p1.isPointInFill({})", "true"); 23 shouldBe("p1.isPointInFill({x: 100, y: 0})", "true"); 24 shouldBe("p1.isPointInFill({x: 152, y: 0})", "false"); 25 shouldBe("p1.isPointInFill({x: 150, y: 50})", "true"); 26 shouldBe("p1.isPointInFill({x: 150, y: 100})", "true"); 27 shouldBe("p1.isPointInFill({x: 150, y: 101})", "false"); 28 shouldBe("p1.isPointInFill({x: 100, y: 100})", "true"); 29 shouldBe("p1.isPointInFill({x: 75, y: 50})", "true"); 22 shouldBeFalse("p1.isPointInFill({})"); 23 shouldBeFalse("p1.isPointInFill({x: 9, y: 9})"); 24 shouldBeTrue("p1.isPointInFill({x: 10, y: 10})"); 25 shouldBeFalse("p1.isPointInFill({x: 159, y: 9})"); 26 shouldBeTrue("p1.isPointInFill({x: 160, y: 10})"); 27 shouldBeFalse("p1.isPointInFill({x: 161, y: 110})"); 28 shouldBeTrue("p1.isPointInFill({x: 160, y: 109})"); 29 shouldBeFalse("p1.isPointInFill({x: 9, y: 109})"); 30 shouldBeTrue("p1.isPointInFill({x: 10, y: 110})"); 30 31 31 32 debug(""); 32 33 debug("Test isPointInStroke()"); 33 shouldBe("p1.isPointInStroke({x: 0, y: 0})", "false"); 34 shouldBe("p1.isPointInStroke({x: 20, y: 0})", "true"); 35 shouldBe("p1.isPointInStroke({x: 150, y: 0})", "true"); 36 shouldBe("p1.isPointInStroke({x: 150, y: 35})", "true"); 37 shouldBe("p1.isPointInStroke({x: 75, y: 50})", "false"); 34 shouldBeTrue("p1.isPointInStroke({x: 20, y: 20})"); 35 shouldBeFalse("p1.isPointInStroke({x: 21, y: 21})"); 36 shouldBeTrue("p1.isPointInStroke({x: 150, y: 20})"); 37 shouldBeFalse("p1.isPointInStroke({x: 149, y: 21})"); 38 shouldBeTrue("p1.isPointInStroke({x: 150, y: 100})"); 39 shouldBeFalse("p1.isPointInStroke({x: 149, y: 99})"); 40 shouldBeTrue("p1.isPointInStroke({x: 20, y: 100})"); 41 shouldBeFalse("p1.isPointInStroke({x: 21, y: 99})"); 38 42 39 43 debug(""); … … 43 47 debug(""); 44 48 debug("Test getPointAtLength()"); 45 shouldBeCloseTo("p1.getPointAtLength(0).x", 0, 0.1);46 shouldBeCloseTo("p1.getPointAtLength(0).y", 0, 0.1);47 shouldBeCloseTo("p1.getPointAtLength(150).x", 1 50, 0.1);48 shouldBeCloseTo("p1.getPointAtLength(150).y", 0, 0.1);49 shouldBeCloseTo("p1.getPointAtLength(2 00).x", 150, 0.1);50 shouldBeCloseTo("p1.getPointAtLength(2 00).y", 50, 0.1);51 shouldBeCloseTo("p1.getPointAtLength( 300).x", 100, 0.1);52 shouldBeCloseTo("p1.getPointAtLength( 300).y", 100, 0.1);53 shouldBeCloseTo("p1.getPointAtLength( 450).x",0, 0.1);54 shouldBeCloseTo("p1.getPointAtLength( 450).y", 50, 0.1);49 shouldBeCloseTo("p1.getPointAtLength(0).x", 10, 0.1); 50 shouldBeCloseTo("p1.getPointAtLength(0).y", 10, 0.1); 51 shouldBeCloseTo("p1.getPointAtLength(150).x", 160, 0.1); 52 shouldBeCloseTo("p1.getPointAtLength(150).y", 10, 0.1); 53 shouldBeCloseTo("p1.getPointAtLength(250).x", 160, 0.1); 54 shouldBeCloseTo("p1.getPointAtLength(250).y", 110, 0.1); 55 shouldBeCloseTo("p1.getPointAtLength(400).x", 10, 0.1); 56 shouldBeCloseTo("p1.getPointAtLength(400).y", 110, 0.1); 57 shouldBeCloseTo("p1.getPointAtLength(500).x", 10, 0.1); 58 shouldBeCloseTo("p1.getPointAtLength(500).y", 10, 0.1); 55 59 56 60 finishJSTest(); -
trunk/LayoutTests/svg/dom/SVGGeometry-polyline-expected.txt
r231955 r252563 6 6 7 7 Test isPointInFill() 8 PASS p1.isPointInFill({}) is true 9 PASS p1.isPointInFill({x: 100, y: 0}) is true 10 PASS p1.isPointInFill({x: 152, y: 0}) is false 11 PASS p1.isPointInFill({x: 150, y: 50}) is true 12 PASS p1.isPointInFill({x: 150, y: 100}) is true 13 PASS p1.isPointInFill({x: 150, y: 101}) is false 14 PASS p1.isPointInFill({x: 100, y: 100}) is true 15 PASS p1.isPointInFill({x: 75, y: 50}) is true 8 PASS p1.isPointInFill({}) is false 9 PASS p1.isPointInFill({x: 9, y: 9}) is false 10 PASS p1.isPointInFill({x: 10, y: 10}) is true 11 PASS p1.isPointInFill({x: 159, y: 9}) is false 12 PASS p1.isPointInFill({x: 160, y: 10}) is true 13 PASS p1.isPointInFill({x: 161, y: 110}) is false 14 PASS p1.isPointInFill({x: 160, y: 109}) is true 15 PASS p1.isPointInFill({x: 9, y: 109}) is false 16 PASS p1.isPointInFill({x: 10, y: 110}) is true 16 17 17 18 Test isPointInStroke() 18 PASS p1.isPointInStroke({x: 0, y: 0}) is false 19 PASS p1.isPointInStroke({x: 20, y: 0}) is true 20 PASS p1.isPointInStroke({x: 150, y: 0}) is true 21 PASS p1.isPointInStroke({x: 150, y: 35}) is true 22 PASS p1.isPointInStroke({x: 75, y: 50}) is false 19 PASS p1.isPointInStroke({x: 20, y: 20}) is true 20 PASS p1.isPointInStroke({x: 21, y: 21}) is false 21 PASS p1.isPointInStroke({x: 150, y: 20}) is true 22 PASS p1.isPointInStroke({x: 149, y: 21}) is false 23 PASS p1.isPointInStroke({x: 150, y: 100}) is true 24 PASS p1.isPointInStroke({x: 149, y: 99}) is false 25 PASS p1.isPointInStroke({x: 20, y: 100}) is true 26 PASS p1.isPointInStroke({x: 21, y: 99}) is false 23 27 24 28 Test getTotalLength() … … 26 30 27 31 Test getPointAtLength() 28 PASS p1.getPointAtLength(0).x is within 0.1 of 029 PASS p1.getPointAtLength(0).y is within 0.1 of 030 PASS p1.getPointAtLength(150).x is within 0.1 of 1 5031 PASS p1.getPointAtLength(150).y is within 0.1 of 032 PASS p1.getPointAtLength(200).x is within 0.1 of 1 5033 PASS p1.getPointAtLength(200).y is within 0.1 of 5034 PASS p1.getPointAtLength(300).x is within 0.1 of 1 0035 PASS p1.getPointAtLength(300).y is within 0.1 of 1 0036 PASS p1.getPointAtLength(450).x is within 0.1 of 037 PASS p1.getPointAtLength(450).y is within 0.1 of 1 0032 PASS p1.getPointAtLength(0).x is within 0.1 of 10 33 PASS p1.getPointAtLength(0).y is within 0.1 of 10 34 PASS p1.getPointAtLength(150).x is within 0.1 of 160 35 PASS p1.getPointAtLength(150).y is within 0.1 of 10 36 PASS p1.getPointAtLength(200).x is within 0.1 of 160 37 PASS p1.getPointAtLength(200).y is within 0.1 of 60 38 PASS p1.getPointAtLength(300).x is within 0.1 of 110 39 PASS p1.getPointAtLength(300).y is within 0.1 of 110 40 PASS p1.getPointAtLength(450).x is within 0.1 of 10 41 PASS p1.getPointAtLength(450).y is within 0.1 of 110 38 42 PASS successfullyParsed is true 39 43 -
trunk/LayoutTests/svg/dom/SVGGeometry-polyline.xhtml
r231955 r252563 5 5 <body onload="run()"> 6 6 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200"> 7 <polyline id="p1" points=" 0,0 150,0 150,100 0,100" fill="none" stroke="black" stroke-width="20" stroke-dashoffset="20" stroke-dasharray="2020"/>7 <polyline id="p1" points="10,10 160,10 160,110 10,110" fill="none" stroke="black" stroke-width="20"/> 8 8 </svg> 9 9 <p id="description"></p> … … 20 20 debug(""); 21 21 debug("Test isPointInFill()"); 22 shouldBe("p1.isPointInFill({})", "true"); 23 shouldBe("p1.isPointInFill({x: 100, y: 0})", "true"); 24 shouldBe("p1.isPointInFill({x: 152, y: 0})", "false"); 25 shouldBe("p1.isPointInFill({x: 150, y: 50})", "true"); 26 shouldBe("p1.isPointInFill({x: 150, y: 100})", "true"); 27 shouldBe("p1.isPointInFill({x: 150, y: 101})", "false"); 28 shouldBe("p1.isPointInFill({x: 100, y: 100})", "true"); 29 shouldBe("p1.isPointInFill({x: 75, y: 50})", "true"); 22 shouldBeFalse("p1.isPointInFill({})"); 23 shouldBeFalse("p1.isPointInFill({x: 9, y: 9})"); 24 shouldBeTrue("p1.isPointInFill({x: 10, y: 10})"); 25 shouldBeFalse("p1.isPointInFill({x: 159, y: 9})"); 26 shouldBeTrue("p1.isPointInFill({x: 160, y: 10})"); 27 shouldBeFalse("p1.isPointInFill({x: 161, y: 110})"); 28 shouldBeTrue("p1.isPointInFill({x: 160, y: 109})"); 29 shouldBeFalse("p1.isPointInFill({x: 9, y: 109})"); 30 shouldBeTrue("p1.isPointInFill({x: 10, y: 110})"); 30 31 31 32 debug(""); 32 33 debug("Test isPointInStroke()"); 33 shouldBe("p1.isPointInStroke({x: 0, y: 0})", "false"); 34 shouldBe("p1.isPointInStroke({x: 20, y: 0})", "true"); 35 shouldBe("p1.isPointInStroke({x: 150, y: 0})", "true"); 36 shouldBe("p1.isPointInStroke({x: 150, y: 35})", "true"); 37 shouldBe("p1.isPointInStroke({x: 75, y: 50})", "false"); 34 shouldBeTrue("p1.isPointInStroke({x: 20, y: 20})"); 35 shouldBeFalse("p1.isPointInStroke({x: 21, y: 21})"); 36 shouldBeTrue("p1.isPointInStroke({x: 150, y: 20})"); 37 shouldBeFalse("p1.isPointInStroke({x: 149, y: 21})"); 38 shouldBeTrue("p1.isPointInStroke({x: 150, y: 100})"); 39 shouldBeFalse("p1.isPointInStroke({x: 149, y: 99})"); 40 shouldBeTrue("p1.isPointInStroke({x: 20, y: 100})"); 41 shouldBeFalse("p1.isPointInStroke({x: 21, y: 99})"); 38 42 39 43 debug(""); … … 43 47 debug(""); 44 48 debug("Test getPointAtLength()"); 45 shouldBeCloseTo("p1.getPointAtLength(0).x", 0, 0.1);46 shouldBeCloseTo("p1.getPointAtLength(0).y", 0, 0.1);47 shouldBeCloseTo("p1.getPointAtLength(150).x", 1 50, 0.1);48 shouldBeCloseTo("p1.getPointAtLength(150).y", 0, 0.1);49 shouldBeCloseTo("p1.getPointAtLength(200).x", 1 50, 0.1);50 shouldBeCloseTo("p1.getPointAtLength(200).y", 50, 0.1);51 shouldBeCloseTo("p1.getPointAtLength(300).x", 1 00, 0.1);52 shouldBeCloseTo("p1.getPointAtLength(300).y", 1 00, 0.1);53 shouldBeCloseTo("p1.getPointAtLength(450).x", 0, 0.1);54 shouldBeCloseTo("p1.getPointAtLength(450).y", 1 00, 0.1);49 shouldBeCloseTo("p1.getPointAtLength(0).x", 10, 0.1); 50 shouldBeCloseTo("p1.getPointAtLength(0).y", 10, 0.1); 51 shouldBeCloseTo("p1.getPointAtLength(150).x", 160, 0.1); 52 shouldBeCloseTo("p1.getPointAtLength(150).y", 10, 0.1); 53 shouldBeCloseTo("p1.getPointAtLength(200).x", 160, 0.1); 54 shouldBeCloseTo("p1.getPointAtLength(200).y", 60, 0.1); 55 shouldBeCloseTo("p1.getPointAtLength(300).x", 110, 0.1); 56 shouldBeCloseTo("p1.getPointAtLength(300).y", 110, 0.1); 57 shouldBeCloseTo("p1.getPointAtLength(450).x", 10, 0.1); 58 shouldBeCloseTo("p1.getPointAtLength(450).y", 110, 0.1); 55 59 56 60 finishJSTest(); -
trunk/LayoutTests/svg/dom/SVGGeometry-rect-expected.txt
r231955 r252563 7 7 Test isPointInFill() 8 8 PASS r1.isPointInFill({}) is false 9 PASS r1.isPointInFill({x: 48, y: 0}) is false 10 PASS r1.isPointInFill({x: 52, y: 0}) is true 11 PASS r1.isPointInFill({x: 98, y: 0}) is true 12 PASS r1.isPointInFill({x: 102, y: 0}) is false 13 PASS r1.isPointInFill({x: 150, y: 38}) is false 14 PASS r1.isPointInFill({x: 150, y: 42}) is true 15 PASS r1.isPointInFill({x: 150, y: 58}) is true 16 PASS r1.isPointInFill({x: 150, y: 62}) is false 17 PASS r1.isPointInFill({x: 48, y: 100}) is false 18 PASS r1.isPointInFill({x: 52, y: 100}) is true 19 PASS r1.isPointInFill({x: 98, y: 100}) is true 20 PASS r1.isPointInFill({x: 102, y: 100}) is false 21 PASS r1.isPointInFill({x: 0, y: 38}) is false 22 PASS r1.isPointInFill({x: 0, y: 42}) is true 23 PASS r1.isPointInFill({x: 0, y: 58}) is true 24 PASS r1.isPointInFill({x: 0, y: 62}) is false 25 PASS r1.isPointInFill({x: 75, y: 50}) is true 9 PASS r1.isPointInFill({x: 9, y: 9}) is false 10 PASS r1.isPointInFill({x: 10, y: 10}) is true 11 PASS r1.isPointInFill({x: 159, y: 9}) is false 12 PASS r1.isPointInFill({x: 160, y: 10}) is true 13 PASS r1.isPointInFill({x: 161, y: 110}) is false 14 PASS r1.isPointInFill({x: 160, y: 109}) is true 15 PASS r1.isPointInFill({x: 9, y: 109}) is false 16 PASS r1.isPointInFill({x: 10, y: 110}) is true 26 17 27 18 Test isPointInStroke() 28 PASS r1.isPointInStroke({x: 52, y: 0}) is false 29 PASS r1.isPointInStroke({x: 72, y: 0}) is true 30 PASS r1.isPointInStroke({x: 92, y: 0}) is false 31 PASS r1.isPointInStroke({x: 112, y: 10}) is true 19 PASS r1.isPointInStroke({x: 20, y: 20}) is true 20 PASS r1.isPointInStroke({x: 21, y: 21}) is false 21 PASS r1.isPointInStroke({x: 150, y: 20}) is true 22 PASS r1.isPointInStroke({x: 149, y: 21}) is false 23 PASS r1.isPointInStroke({x: 150, y: 100}) is true 24 PASS r1.isPointInStroke({x: 149, y: 99}) is false 25 PASS r1.isPointInStroke({x: 20, y: 100}) is true 26 PASS r1.isPointInStroke({x: 21, y: 99}) is false 32 27 33 28 Test getTotalLength() 34 PASS r1.getTotalLength() is within 1 of 42429 PASS r1.getTotalLength() is within 0.1 of 500 35 30 36 31 Test getPointAtLength() 37 PASS r1.getPointAtLength(0).x is within 1 of 5038 PASS r1.getPointAtLength(0).y is within 1 of039 PASS r1.getPointAtLength( 25).x is within 1 of 7540 PASS r1.getPointAtLength( 25).y is within 1 of041 PASS r1.getPointAtLength(2 00).x is within 3 of 11242 PASS r1.getPointAtLength(2 00).y is within 3 of 10043 PASS r1.getPointAtLength( 300).x is within 3 of 1444 PASS r1.getPointAtLength( 300).y is within 3 of 8845 PASS r1.getPointAtLength( 400).x is within 3 of 2746 PASS r1.getPointAtLength( 400).y is within 3 of 532 PASS r1.getPointAtLength(0).x is within 0.1 of 10 33 PASS r1.getPointAtLength(0).y is within 0.1 of 10 34 PASS r1.getPointAtLength(150).x is within 0.1 of 160 35 PASS r1.getPointAtLength(150).y is within 0.1 of 10 36 PASS r1.getPointAtLength(250).x is within 0.1 of 160 37 PASS r1.getPointAtLength(250).y is within 0.1 of 110 38 PASS r1.getPointAtLength(400).x is within 0.1 of 10 39 PASS r1.getPointAtLength(400).y is within 0.1 of 110 40 PASS r1.getPointAtLength(500).x is within 0.1 of 10 41 PASS r1.getPointAtLength(500).y is within 0.1 of 10 47 42 PASS successfullyParsed is true 48 43 -
trunk/LayoutTests/svg/dom/SVGGeometry-rect.xhtml
r231955 r252563 5 5 <body onload="run()"> 6 6 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200"> 7 <rect id="r1" rx="50" ry="40" width="150" height="100" fill="none" stroke="black" stroke-width="20" stroke-dashoffset="20" stroke-dasharray="2020"/>7 <rect id="r1" x="10" y="10" width="150" height="100" fill="none" stroke="black" stroke-width="20"/> 8 8 </svg> 9 9 <p id="description"></p> … … 20 20 debug(""); 21 21 debug("Test isPointInFill()"); 22 shouldBe("r1.isPointInFill({})", "false"); 23 shouldBe("r1.isPointInFill({x: 48, y: 0})", "false"); 24 shouldBe("r1.isPointInFill({x: 52, y: 0})", "true"); 25 shouldBe("r1.isPointInFill({x: 98, y: 0})", "true"); 26 shouldBe("r1.isPointInFill({x: 102, y: 0})", "false"); 27 shouldBe("r1.isPointInFill({x: 150, y: 38})", "false"); 28 shouldBe("r1.isPointInFill({x: 150, y: 42})", "true"); 29 shouldBe("r1.isPointInFill({x: 150, y: 58})", "true"); 30 shouldBe("r1.isPointInFill({x: 150, y: 62})", "false"); 31 shouldBe("r1.isPointInFill({x: 48, y: 100})", "false"); 32 shouldBe("r1.isPointInFill({x: 52, y: 100})", "true"); 33 shouldBe("r1.isPointInFill({x: 98, y: 100})", "true"); 34 shouldBe("r1.isPointInFill({x: 102, y: 100})", "false"); 35 shouldBe("r1.isPointInFill({x: 0, y: 38})", "false"); 36 shouldBe("r1.isPointInFill({x: 0, y: 42})", "true"); 37 shouldBe("r1.isPointInFill({x: 0, y: 58})", "true"); 38 shouldBe("r1.isPointInFill({x: 0, y: 62})", "false"); 39 shouldBe("r1.isPointInFill({x: 75, y: 50})", "true"); 22 shouldBeFalse("r1.isPointInFill({})"); 23 shouldBeFalse("r1.isPointInFill({x: 9, y: 9})"); 24 shouldBeTrue("r1.isPointInFill({x: 10, y: 10})"); 25 shouldBeFalse("r1.isPointInFill({x: 159, y: 9})"); 26 shouldBeTrue("r1.isPointInFill({x: 160, y: 10})"); 27 shouldBeFalse("r1.isPointInFill({x: 161, y: 110})"); 28 shouldBeTrue("r1.isPointInFill({x: 160, y: 109})"); 29 shouldBeFalse("r1.isPointInFill({x: 9, y: 109})"); 30 shouldBeTrue("r1.isPointInFill({x: 10, y: 110})"); 40 31 41 32 debug(""); 42 33 debug("Test isPointInStroke()"); 43 shouldBe("r1.isPointInStroke({x: 52, y: 0})", "false"); 44 shouldBe("r1.isPointInStroke({x: 72, y: 0})", "true"); 45 shouldBe("r1.isPointInStroke({x: 92, y: 0})", "false"); 46 shouldBe("r1.isPointInStroke({x: 112, y: 10})", "true"); 34 shouldBeTrue("r1.isPointInStroke({x: 20, y: 20})"); 35 shouldBeFalse("r1.isPointInStroke({x: 21, y: 21})"); 36 shouldBeTrue("r1.isPointInStroke({x: 150, y: 20})"); 37 shouldBeFalse("r1.isPointInStroke({x: 149, y: 21})"); 38 shouldBeTrue("r1.isPointInStroke({x: 150, y: 100})"); 39 shouldBeFalse("r1.isPointInStroke({x: 149, y: 99})"); 40 shouldBeTrue("r1.isPointInStroke({x: 20, y: 100})"); 41 shouldBeFalse("r1.isPointInStroke({x: 21, y: 99})"); 47 42 48 43 debug(""); 49 44 debug("Test getTotalLength()"); 50 shouldBeCloseTo("r1.getTotalLength()", 424,1);45 shouldBeCloseTo("r1.getTotalLength()", 500, 0.1); 51 46 52 47 debug(""); 53 48 debug("Test getPointAtLength()"); 54 shouldBeCloseTo("r1.getPointAtLength(0).x", 50,1);55 shouldBeCloseTo("r1.getPointAtLength(0).y", 0,1);56 shouldBeCloseTo("r1.getPointAtLength( 25).x", 75,1);57 shouldBeCloseTo("r1.getPointAtLength( 25).y", 0,1);58 shouldBeCloseTo("r1.getPointAtLength(2 00).x", 112, 3);59 shouldBeCloseTo("r1.getPointAtLength(2 00).y", 100, 3);60 shouldBeCloseTo("r1.getPointAtLength( 300).x", 14, 3);61 shouldBeCloseTo("r1.getPointAtLength( 300).y", 88, 3);62 shouldBeCloseTo("r1.getPointAtLength( 400).x", 27, 3);63 shouldBeCloseTo("r1.getPointAtLength( 400).y", 5, 3);49 shouldBeCloseTo("r1.getPointAtLength(0).x", 10, 0.1); 50 shouldBeCloseTo("r1.getPointAtLength(0).y", 10, 0.1); 51 shouldBeCloseTo("r1.getPointAtLength(150).x", 160, 0.1); 52 shouldBeCloseTo("r1.getPointAtLength(150).y", 10, 0.1); 53 shouldBeCloseTo("r1.getPointAtLength(250).x", 160, 0.1); 54 shouldBeCloseTo("r1.getPointAtLength(250).y", 110, 0.1); 55 shouldBeCloseTo("r1.getPointAtLength(400).x", 10, 0.1); 56 shouldBeCloseTo("r1.getPointAtLength(400).y", 110, 0.1); 57 shouldBeCloseTo("r1.getPointAtLength(500).x", 10, 0.1); 58 shouldBeCloseTo("r1.getPointAtLength(500).y", 10, 0.1); 64 59 65 60 finishJSTest(); -
trunk/Source/WebCore/ChangeLog
r252562 r252563 1 2019-11-18 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Fix getTotalLength() and getPointAtLength() for optimized rect and ellipse renderers 4 https://bugs.webkit.org/show_bug.cgi?id=204213 5 6 Reviewed by Simon Fraser. 7 8 If the renderer does not create a Path to draw the shape, we need to create 9 a temporary Path from the SVGElement then use it to answer the questions 10 of these functions and finally delete it. 11 12 * platform/graphics/Path.cpp: 13 (WebCore::Path::traversalStateAtLength const): 14 (WebCore::Path::pointAtLength const): 15 No need for the 'success'. It is never used. 16 17 (WebCore::Path::normalAngleAtLength const): Deleted. 18 This function is not used. 19 20 * platform/graphics/Path.h: 21 * rendering/svg/RenderSVGShape.cpp: 22 (WebCore::RenderSVGShape::updateShapeFromElement): 23 Creating the Path from the SVGELement is moved to createPath(). 24 25 (WebCore::RenderSVGShape::getTotalLength const): 26 (WebCore::RenderSVGShape::getPointAtLength const): 27 Create a temporary Path if the renderer draws the shape without creating 28 the Path. 29 30 (WebCore::RenderSVGShape::createPath const): 31 * rendering/svg/RenderSVGShape.h: 32 33 * rendering/svg/SVGTextLayoutEngine.cpp: 34 (WebCore::SVGTextLayoutEngine::layoutTextOnLineOrPath): 35 * svg/SVGAnimateMotionElement.cpp: 36 (WebCore::SVGAnimateMotionElement::buildTransformForProgress): 37 Use PathTraversalState.success() to check instead of getting the same 38 value through an argument to traversalStateAtLength(). 39 1 40 2019-11-18 Zalan Bujtas <zalan@apple.com> 2 41 -
trunk/Source/WebCore/platform/graphics/Path.cpp
r222253 r252563 54 54 #endif 55 55 56 PathTraversalState Path::traversalStateAtLength(float length , bool& success) const56 PathTraversalState Path::traversalStateAtLength(float length) const 57 57 { 58 58 PathTraversalState traversalState(PathTraversalState::Action::VectorAtLength, length); … … 62 62 }); 63 63 64 success = traversalState.success();65 64 return traversalState; 66 65 } 67 66 68 FloatPoint Path::pointAtLength(float length, bool& success) const 69 { 70 return traversalStateAtLength(length, success).current(); 71 } 72 73 float Path::normalAngleAtLength(float length, bool& success) const 74 { 75 return traversalStateAtLength(length, success).normalAngle(); 67 FloatPoint Path::pointAtLength(float length) const 68 { 69 return traversalStateAtLength(length).current(); 76 70 } 77 71 -
trunk/Source/WebCore/platform/graphics/Path.h
r250492 r252563 135 135 136 136 float length() const; 137 PathTraversalState traversalStateAtLength(float length, bool& success) const; 138 FloatPoint pointAtLength(float length, bool& success) const; 139 float normalAngleAtLength(float length, bool& success) const; 137 PathTraversalState traversalStateAtLength(float length) const; 138 FloatPoint pointAtLength(float length) const; 140 139 141 140 WEBCORE_EXPORT void clear(); -
trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp
r252069 r252563 80 80 void RenderSVGShape::updateShapeFromElement() 81 81 { 82 m_path = makeUnique<Path>(pathFromGraphicsElement(&graphicsElement()));82 m_path = createPath(); 83 83 processMarkerPositions(); 84 84 … … 348 348 float RenderSVGShape::getTotalLength() const 349 349 { 350 if (m_path) 351 return m_path->length(); 352 353 return 0; 350 return hasPath() ? path().length() : createPath()->length(); 354 351 } 355 352 356 353 FloatPoint RenderSVGShape::getPointAtLength(float distance) const 357 354 { 358 if (!m_path) 359 return { }; 360 361 bool isValid; 362 return m_path->pointAtLength(distance, isValid); 355 return hasPath() ? path().pointAtLength(distance) : createPath()->pointAtLength(distance); 363 356 } 364 357 … … 504 497 } 505 498 499 std::unique_ptr<Path> RenderSVGShape::createPath() const 500 { 501 return makeUnique<Path>(pathFromGraphicsElement(&graphicsElement())); 502 } 503 506 504 void RenderSVGShape::processMarkerPositions() 507 505 { -
trunk/Source/WebCore/rendering/svg/RenderSVGShape.h
r251877 r252563 123 123 bool shouldGenerateMarkerPositions() const; 124 124 FloatRect markerRect(float strokeWidth) const; 125 126 std::unique_ptr<Path> createPath() const; 125 127 void processMarkerPositions(); 126 128 -
trunk/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp
r225117 r252563 532 532 break; 533 533 534 bool success = false; 535 auto traversalState(m_textPath.traversalStateAtLength(textPathOffset, success)); 536 ASSERT(success); 534 auto traversalState(m_textPath.traversalStateAtLength(textPathOffset)); 535 ASSERT(traversalState.success()); 537 536 538 537 FloatPoint point = traversalState.current(); -
trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp
r251809 r252563 191 191 ASSERT(!m_animationPath.isEmpty()); 192 192 193 bool success = false;194 193 float positionOnPath = m_animationPath.length() * percentage; 195 auto traversalState(m_animationPath.traversalStateAtLength(positionOnPath , success));196 if (! success)194 auto traversalState(m_animationPath.traversalStateAtLength(positionOnPath)); 195 if (!traversalState.success()) 197 196 return; 198 197
Note: See TracChangeset
for help on using the changeset viewer.