Automatic update from web-platform-tests
[SVG] Implement `getPathData()` on `SVGPathElement`
Implements the `SVGPathData` interface mixin from the SVG Paths spec
[1] on `SVGPathElement`, exposing:
`sequence<SVGPathSegment> getPathData(optional SVGPathDataSettings);`
plus the `SVGPathSegment {type, values}` and `SVGPathDataSettings
{normalize}` dictionaries.
The method reads the `d` attribute base value (ignoring SMIL/CSS) and,
for <use> shadow instances, forwards to `CorrespondingElement()`.
With `{normalize: true}`, segments are reduced to absolute M, L, C,
Z via `SVGPathNormalizer`.
Gated behind the new experimental runtime flag `SVGPathDataAPI`.
Instrumented via `SVGPathElementGetPathData` and
`SVGPathElementGetPathDataNormalized` use counters.
[1] https://svgwg.org/specs/paths/#__svg__SVGPathData__getPathData
Design: https://docs.google.com/document/d/1uCVUqYGKgsCCu7LEtEdO3Yuea-MT-I2XsU6Eoe3mlQI/edit?usp=sharing
Bug: 40441025
Change-Id: I960bf62b31800b44bd5dd71d1e04acde8bed0553
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7859157
Reviewed-by: Fredrik Söderquist <fs@opera.com>
Commit-Queue: Virali Purbey <viralipurbey@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1647018}
--
wpt-commits: 13a109f13381905050713b0d4aab3fdf62a1da06
wpt-pr: 60645
32 lines
1.2 KiB
HTML
32 lines
1.2 KiB
HTML
<!doctype html>
|
|
<title>SVGPathElement.getPathData() returns base value during Web Animations</title>
|
|
<link rel="help" href="https://svgwg.org/specs/paths/#InterfaceSVGPathData">
|
|
<link rel="author" title="Virali Purbey" href="mailto:viralipurbey@microsoft.com">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="support/getPathData-helpers.js"></script>
|
|
|
|
<svg>
|
|
<path id="path" d="M 0 0 L 10 10"/>
|
|
</svg>
|
|
<script>
|
|
test(() => {
|
|
// Animate the CSS `d` property via Web Animations. getPathData() must
|
|
// still return the attribute base value, not the animated/interpolated
|
|
// value (matches getAttribute("d") semantics).
|
|
const anim = path.animate(
|
|
[{ d: 'path("M 100 100 L 200 200")' },
|
|
{ d: 'path("M 300 300 L 400 400")' }],
|
|
{ duration: 1000, fill: 'forwards' });
|
|
anim.pause();
|
|
anim.currentTime = 500;
|
|
assert_not_equals(getComputedStyle(path).getPropertyValue("d"),
|
|
"none", "CSS 'd' animation is applied");
|
|
|
|
assert_path_data_equals(path.getPathData(), [
|
|
{ type: "M", values: [0, 0] },
|
|
{ type: "L", values: [10, 10] }
|
|
]);
|
|
}, "path.getPathData() returns attribute base value during Web Animations");
|
|
</script>
|