-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
LibWeb: Implement SVGGeometryElement.getTotalLength()
#11006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9b8b474
Tests: Import some `SVGGeometryElement.getTotalLength` tests
Calme1709 c7c6c5e
LibWeb: Make SVG viewport computation reusable
Calme1709 3de9bf3
LibWeb: Implement `SVGGeometryElement.getTotalLength()`
Calme1709 7338f71
LibWeb: Don't require layout node in `SVGCircleElement::get_path`
Calme1709 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...bWeb/Text/expected/wpt-import/svg/types/scripted/SVGGeometryElement.getTotalLength-01.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| Harness status: OK | ||
|
|
||
| Found 6 tests | ||
|
|
||
| 5 Pass | ||
| 1 Fail | ||
| Pass SVGGeometryElement.prototype.getTotalLength(), getTotalLength - path with pathLength | ||
| Pass SVGGeometryElement.prototype.getTotalLength(), getTotalLength - rect | ||
| Pass SVGGeometryElement.prototype.getTotalLength(), getTotalLength - rect in document | ||
| Pass SVGGeometryElement.prototype.getTotalLength(), getTotalLength - rect in document with percent units | ||
| Pass SVGGeometryElement.prototype.getTotalLength(), getTotalLength - rect in document with display none | ||
| Fail SVGGeometryElement.prototype.getTotalLength(), getTotalLength - path modified with setPathData |
6 changes: 6 additions & 0 deletions
6
...bWeb/Text/expected/wpt-import/svg/types/scripted/SVGGeometryElement.getTotalLength-02.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Harness status: OK | ||
|
|
||
| Found 1 tests | ||
|
|
||
| 1 Pass | ||
| Pass SVGGeometryElement.getTotalLength: 'display:none' |
8 changes: 8 additions & 0 deletions
8
...s/LibWeb/Text/expected/wpt-import/svg/types/scripted/SVGPathElement.getTotalLength-01.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| Harness status: OK | ||
|
|
||
| Found 3 tests | ||
|
|
||
| 3 Pass | ||
| Pass SVGPathElement.getTotalLength: 'display:none', path with d attribute specified on element | ||
| Pass SVGPathElement.getTotalLength: 'display:none', path with d attribute specified as styles | ||
| Pass SVGPathElement.getTotalLength: 'display:none', path with d attribute specified on element and as styles |
94 changes: 94 additions & 0 deletions
94
...xt/input/wpt-import/svg/types/scripted/SVGGeometryElement.getTotalLength-01.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions
18
...LibWeb/Text/input/wpt-import/svg/types/scripted/SVGGeometryElement.getTotalLength-02.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <!DOCTYPE html> | ||
| <title>SVGGeometryElement.getTotalLength: 'display:none'</title> | ||
| <link rel="author" title="Divyansh Mangal" href="mailto:dmangal@microsoft.com"> | ||
| <link rel="help" href="https://w3c.github.io/svgwg/svg2-draft/types.html#__svg__SVGGeometryElement__getTotalLength"/> | ||
| <script src="../../../resources/testharness.js"></script> | ||
| <script src="../../../resources/testharnessreport.js"></script> | ||
| <svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"> | ||
| <rect id="rectTest" style="display:none" x="30" y="30" width="10" height="10"></rect> | ||
| <circle id="circleTest" style="display:none" cx="50" cy="50" r="5" /> | ||
| </svg> | ||
| <script> | ||
| test(function() { | ||
| let perimeter = (width, height) => 2 * width + 2 * height; | ||
| assert_equals(rectTest.getTotalLength(), perimeter(rectTest.width.baseVal.value, rectTest.height.baseVal.value)); | ||
| let circumference = (r) => 2 * Math.PI * r; | ||
| assert_approx_equals(circleTest.getTotalLength(), circumference(circleTest.r.baseVal.value), 1); | ||
| }); | ||
| </script> |
26 changes: 26 additions & 0 deletions
26
Tests/LibWeb/Text/input/wpt-import/svg/types/scripted/SVGPathElement.getTotalLength-01.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <!DOCTYPE html> | ||
| <title>SVGPathElement.getTotalLength: 'display:none'</title> | ||
| <link rel="author" title="Divyansh Mangal" href="mailto:dmangal@microsoft.com"> | ||
| <script src="../../../resources/testharness.js"></script> | ||
| <script src="../../../resources/testharnessreport.js"></script> | ||
| <style> | ||
| #path2, #path3 { | ||
| d:path("M 0 0 t 0 100"); | ||
| } | ||
| </style> | ||
| <svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"> | ||
| <path id="path1" d="M 0 0 t 0 100" style="display:none" /> | ||
| <path id="path2" style="display:none;" /> | ||
| <path id="path3" d="M 110,10 l 80,80 v -80 h -40" style="display:none;" /> | ||
| </svg> | ||
| <script> | ||
| test(function() { | ||
| assert_equals(path1.getTotalLength(), 100); | ||
| },document.title + ', ' + 'path with d attribute specified on element'); | ||
| test(function() { | ||
| assert_equals(path2.getTotalLength(), 100); | ||
| },document.title + ', ' + 'path with d attribute specified as styles'); | ||
| test(function() { | ||
| assert_equals(path3.getTotalLength(), 100); | ||
| },document.title + ', ' + 'path with d attribute specified on element and as styles'); | ||
| </script> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.