summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/svg/struct
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/svg/struct
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/svg/struct')
-rw-r--r--testing/web-platform/tests/svg/struct/UnknownElement/interface.svg19
-rw-r--r--testing/web-platform/tests/svg/struct/reftests/currentScale-change-repaint.html16
-rw-r--r--testing/web-platform/tests/svg/struct/reftests/currentScale.svg11
-rw-r--r--testing/web-platform/tests/svg/struct/reftests/nested-svg-through-display-contents.svg13
-rw-r--r--testing/web-platform/tests/svg/struct/reftests/reference/green-100x100.html2
-rw-r--r--testing/web-platform/tests/svg/struct/reftests/reference/green-100x100.svg3
-rw-r--r--testing/web-platform/tests/svg/struct/reftests/requiredextensions-empty-string.svg6
-rw-r--r--testing/web-platform/tests/svg/struct/reftests/requiredextensions-xhtml.tentative.svg12
-rw-r--r--testing/web-platform/tests/svg/struct/reftests/support/etag-max-age-zero-icons.svg5
-rw-r--r--testing/web-platform/tests/svg/struct/reftests/support/etag-max-age-zero-icons.svg.headers2
-rw-r--r--testing/web-platform/tests/svg/struct/reftests/support/sprites.svg3
-rw-r--r--testing/web-platform/tests/svg/struct/reftests/use-adopted-with-external-resource.tentative.svg14
-rw-r--r--testing/web-platform/tests/svg/struct/reftests/use-external-resource-with-revalidation.tentative.html36
-rw-r--r--testing/web-platform/tests/svg/struct/reftests/use-inheritance-001.svg35
-rw-r--r--testing/web-platform/tests/svg/struct/reftests/use-svg-dimensions-override-001.svg18
-rw-r--r--testing/web-platform/tests/svg/struct/reftests/use-svg-dimensions-override-002.svg18
-rw-r--r--testing/web-platform/tests/svg/struct/reftests/use-symbol-dimensions-override-001.svg18
-rw-r--r--testing/web-platform/tests/svg/struct/reftests/use-symbol-dimensions-override-002.svg18
-rw-r--r--testing/web-platform/tests/svg/struct/scripted/autofocus-attribute.svg54
-rw-r--r--testing/web-platform/tests/svg/struct/scripted/blank.svg2
-rw-r--r--testing/web-platform/tests/svg/struct/scripted/svg-getIntersectionList.svg31
-rw-r--r--testing/web-platform/tests/svg/struct/scripted/use-load-error-events.tentative.html128
-rw-r--r--testing/web-platform/tests/svg/struct/use-getComputedStyle.html14
23 files changed, 478 insertions, 0 deletions
diff --git a/testing/web-platform/tests/svg/struct/UnknownElement/interface.svg b/testing/web-platform/tests/svg/struct/UnknownElement/interface.svg
new file mode 100644
index 0000000000..987f20c5e4
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/UnknownElement/interface.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:h="http://www.w3.org/1999/xhtml"
+ version="1.1"
+ width="100%" height="100%" viewBox="0 0 400 400">
+<title>Interface of unknown element</title>
+<h:link rel="help" href="https://svgwg.org/svg2-draft/struct.html#UnknownElement"/>
+<h:script src="/resources/testharness.js"/>
+<h:script src="/resources/testharnessreport.js"/>
+
+<foobar id="target"/>
+
+<h:script><![CDATA[
+test(function() {
+ var e = document.getElementById("target");
+ assert_equals(Object.getPrototypeOf(e), SVGUnknownElement.prototype);
+});
+]]></h:script>
+</svg>
diff --git a/testing/web-platform/tests/svg/struct/reftests/currentScale-change-repaint.html b/testing/web-platform/tests/svg/struct/reftests/currentScale-change-repaint.html
new file mode 100644
index 0000000000..aa3939c1be
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/reftests/currentScale-change-repaint.html
@@ -0,0 +1,16 @@
+<!doctype HTML>
+<meta charset="utf-8">
+<title>Testcase for changing currentScale on SVG embedded in HTML</title>
+<link rel="help" href="https://www.w3.org/TR/SVG/struct.html#__svg__SVGSVGElement__currentScale">
+<link rel="match" href="reference/green-100x100.html">
+<script>
+ function go() {
+ const mySVG = document.getElementById("mySVG");
+ mySVG.currentScale = 0.5;
+ }
+</script>
+<body onload="go()">
+ <svg id="mySVG">
+ <rect width="100" height="100" fill="green"></rect>
+ </svg>
+</body>
diff --git a/testing/web-platform/tests/svg/struct/reftests/currentScale.svg b/testing/web-platform/tests/svg/struct/reftests/currentScale.svg
new file mode 100644
index 0000000000..926117b6d5
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/reftests/currentScale.svg
@@ -0,0 +1,11 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml" onload="scaleDown()">
+ <title>Testcase for changing currentScale on SVG embedded in HTML</title>
+ <h:link rel="help" href="https://www.w3.org/TR/SVG/struct.html#__svg__SVGSVGElement__currentScale"/>
+ <h:link rel="match" href="reference/green-100x100.svg"/>
+ <script>
+ function scaleDown() {
+ document.documentElement.currentScale = 0.5;
+ }
+ </script>
+ <rect width="200" height="200" fill="green"/>
+</svg>
diff --git a/testing/web-platform/tests/svg/struct/reftests/nested-svg-through-display-contents.svg b/testing/web-platform/tests/svg/struct/reftests/nested-svg-through-display-contents.svg
new file mode 100644
index 0000000000..1be64d5242
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/reftests/nested-svg-through-display-contents.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<svg viewBox="0 0 400 400" width="400" height="400" stroke="none" id="s1"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:h="http://www.w3.org/1999/xhtml">
+ <h:link rel="match" href="reference/green-100x100.svg"/>
+ <h:link rel="help" href="https://svgwg.org/svg2-draft/struct.html#ForeignNamespaces"/>
+ <rect x="0" y="0" width="100" height="100" fill="green"></rect>
+ <h:div style="display: contents">
+ <svg width="300" height="300">
+ <rect x="5" y="5" width="100" height="100" fill="red"></rect>
+ </svg>
+ </h:div>
+</svg>
diff --git a/testing/web-platform/tests/svg/struct/reftests/reference/green-100x100.html b/testing/web-platform/tests/svg/struct/reftests/reference/green-100x100.html
new file mode 100644
index 0000000000..f718ea6abf
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/reftests/reference/green-100x100.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<div style="width: 100px; height: 100px; background-color: green"></div>
diff --git a/testing/web-platform/tests/svg/struct/reftests/reference/green-100x100.svg b/testing/web-platform/tests/svg/struct/reftests/reference/green-100x100.svg
new file mode 100644
index 0000000000..120941444a
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/reftests/reference/green-100x100.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+ <rect width="100" height="100" fill="green"/>
+</svg>
diff --git a/testing/web-platform/tests/svg/struct/reftests/requiredextensions-empty-string.svg b/testing/web-platform/tests/svg/struct/reftests/requiredextensions-empty-string.svg
new file mode 100644
index 0000000000..28f5da4a3e
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/reftests/requiredextensions-empty-string.svg
@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml">
+ <title>requiredExtensions: present but empty attribute evaluates to false</title>
+ <h:link rel="help" href="https://svgwg.org/svg2-draft/struct.html#RequiredExtensionsAttribute"/>
+ <h:link rel="match" href="../scripted/blank.svg"/>
+ <rect width="100" height="100" fill="red" requiredExtensions=""/>
+</svg>
diff --git a/testing/web-platform/tests/svg/struct/reftests/requiredextensions-xhtml.tentative.svg b/testing/web-platform/tests/svg/struct/reftests/requiredextensions-xhtml.tentative.svg
new file mode 100644
index 0000000000..911f983cab
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/reftests/requiredextensions-xhtml.tentative.svg
@@ -0,0 +1,12 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml">
+ <title>requiredExtensions: support for HTML/XHTML (non-normative)</title>
+ <h:link rel="match" href="reference/green-100x100.svg"/>
+ <switch>
+ <foreignObject width="100" height="100" requiredExtensions="http://www.w3.org/1999/xhtml">
+ <body xmlns="http://www.w3.org/1999/xhtml" style="margin: 0">
+ <div style="width: 100px; height: 100px; background-color: green"></div>
+ </body>
+ </foreignObject>
+ <rect width="100" height="100" fill="red"/>
+ </switch>
+</svg>
diff --git a/testing/web-platform/tests/svg/struct/reftests/support/etag-max-age-zero-icons.svg b/testing/web-platform/tests/svg/struct/reftests/support/etag-max-age-zero-icons.svg
new file mode 100644
index 0000000000..6f7fb0f830
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/reftests/support/etag-max-age-zero-icons.svg
@@ -0,0 +1,5 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+ <symbol id="green-square" viewBox="0 0 16 16">
+ <rect width="16" height="16" fill="green"/>
+ </symbol>
+</svg>
diff --git a/testing/web-platform/tests/svg/struct/reftests/support/etag-max-age-zero-icons.svg.headers b/testing/web-platform/tests/svg/struct/reftests/support/etag-max-age-zero-icons.svg.headers
new file mode 100644
index 0000000000..3f0c26c8fe
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/reftests/support/etag-max-age-zero-icons.svg.headers
@@ -0,0 +1,2 @@
+ETag: icons
+Cache-Control: max-age=0
diff --git a/testing/web-platform/tests/svg/struct/reftests/support/sprites.svg b/testing/web-platform/tests/svg/struct/reftests/support/sprites.svg
new file mode 100644
index 0000000000..f73b885191
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/reftests/support/sprites.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+ <rect id="green-rect" width="100" height="100" fill="green"/>
+</svg>
diff --git a/testing/web-platform/tests/svg/struct/reftests/use-adopted-with-external-resource.tentative.svg b/testing/web-platform/tests/svg/struct/reftests/use-adopted-with-external-resource.tentative.svg
new file mode 100644
index 0000000000..830d4555e5
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/reftests/use-adopted-with-external-resource.tentative.svg
@@ -0,0 +1,14 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml">
+ <title>Adopting a &#x3c;use&#x3e; (from an inactive document) requests an external resource</title>
+ <h:link rel="match" href="reference/green-100x100.svg"/>
+ <script type="text/plain" template=""><![CDATA[
+ <svg xmlns="http://www.w3.org/2000/svg">
+ <use href="support/sprites.svg#green-rect"/>
+ </svg>]]>
+ </script>
+ <script>
+ let text = document.querySelector('script[template]').textContent;
+ let doc = new DOMParser().parseFromString(text, 'image/svg+xml');
+ document.documentElement.appendChild(doc.documentElement);
+ </script>
+</svg>
diff --git a/testing/web-platform/tests/svg/struct/reftests/use-external-resource-with-revalidation.tentative.html b/testing/web-platform/tests/svg/struct/reftests/use-external-resource-with-revalidation.tentative.html
new file mode 100644
index 0000000000..d899165fa9
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/reftests/use-external-resource-with-revalidation.tentative.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<title>Multiple &lt;use> referencing same external resource, with revalidation required</title>
+<link rel="match" href="reference/green-100x100.html">
+<svg>
+ <rect width="100" height="100" fill="red"/>
+</svg>
+<script>
+ let container = document.querySelector('svg');
+ function makeUse(x) {
+ let use = document.createElementNS('http://www.w3.org/2000/svg', 'use');
+ use.setAttribute('href', 'support/etag-max-age-zero-icons.svg#green-square');
+ use.setAttribute('x', x);
+ use.setAttribute('width', 50);
+ use.setAttribute('height', 50);
+ use.setAttribute('transform', 'scale(1, 2)');
+ return use;
+ }
+ function insertFirstUse() {
+ let use = makeUse(0);
+ use.onload = insertSecondUse;
+ container.appendChild(use);
+ }
+ function insertSecondUse() {
+ let use = makeUse(50);
+ use.onload = endTest;
+ container.appendChild(use);
+ document.body.offsetTop;
+ }
+ function endTest() {
+ document.documentElement.classList.remove('reftest-wait');
+ }
+ onload = function() {
+ requestAnimationFrame(insertFirstUse);
+ };
+</script>
diff --git a/testing/web-platform/tests/svg/struct/reftests/use-inheritance-001.svg b/testing/web-platform/tests/svg/struct/reftests/use-inheritance-001.svg
new file mode 100644
index 0000000000..5e375b94cd
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/reftests/use-inheritance-001.svg
@@ -0,0 +1,35 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <title>Use property inheritance in SVG2</title>
+ <metadata>
+ <h:link rel="help" href="https://svgwg.org/svg2-draft/struct.html#UseStyleInheritance"/>
+ <h:link rel="match" href="reference/green-100x100.svg"/>
+ <h:link rel="author" title="Mike Bremford" href="http://bfo.com"/>
+ </metadata>
+ <style>
+ use rect { stroke: red }
+ .container rect { fill: red; stroke: red }
+ rect { stroke-width: 40px; stroke: green }
+ rect:root { opacity: 0 }
+ </style>
+ <defs>
+ <g class="container">
+ <rect id="r" x="20" y="20" width="60" height="60" style="fill-opacity:1"/>
+ </g>
+ </defs>
+ <g>
+ <use href="#r" xlink:href="#r" style="fill: green; fill-opacity:0"/>
+ </g>
+ <!--
+ This presume the SVG2 use inheritance rules, in SVG1 it will display as red.
+
+ 1. The "rect" cloned by the "use" element is in a shadow DOM, so it DOES NOT
+ inherit the stroke from the "use rect" or ".container rect" style rules.
+ 2. The cloned "rect" DOES get the rules set by the "rect" style rule, as that
+ still matches elements in the shadow DOM.
+ 3. The "rect" DOES inherit "fill: green" from the <use>
+ 4. The "rect"'s own "fill-opacity: 1" overrides the "fill-opacity: 0" inherited
+ from the "use" element.
+ 5. Even though "rect" is considered to have no parent, it is not a root element
+ so does not match the rect:root style rule
+ -->
+</svg>
diff --git a/testing/web-platform/tests/svg/struct/reftests/use-svg-dimensions-override-001.svg b/testing/web-platform/tests/svg/struct/reftests/use-svg-dimensions-override-001.svg
new file mode 100644
index 0000000000..c658adce80
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/reftests/use-svg-dimensions-override-001.svg
@@ -0,0 +1,18 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:h="http://www.w3.org/1999/xhtml" width="800" height="600">
+ <title>'width' and 'height' from &#x3c;use&#x3e; overrides values on referenced &#x3c;svg&#x3e;</title>
+ <h:link rel="help" href="https://svgwg.org/svg2-draft/struct.html#UseLayout"/>
+ <h:link rel="match" href="reference/green-100x100.svg"/>
+ <defs>
+ <svg id="s" width="10" height="10">
+ <rect width="100%" height="100%" fill="green"/>
+ </svg>
+ </defs>
+ <rect width="100" height="100" fill="red"/>
+ <svg width="1" height="1" overflow="visible">
+ <use xlink:href="#s" x="90" y="90"/>
+ <use xlink:href="#s" y="90" width="90"/>
+ <use xlink:href="#s" x="90" height="90"/>
+ <use xlink:href="#s" width="90" height="90"/>
+ </svg>
+</svg>
diff --git a/testing/web-platform/tests/svg/struct/reftests/use-svg-dimensions-override-002.svg b/testing/web-platform/tests/svg/struct/reftests/use-svg-dimensions-override-002.svg
new file mode 100644
index 0000000000..6c3f97b8dc
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/reftests/use-svg-dimensions-override-002.svg
@@ -0,0 +1,18 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:h="http://www.w3.org/1999/xhtml" width="800" height="600">
+ <title>'width' and 'height' from &#x3c;use&#x3e; overrides values on referenced &#x3c;svg&#x3e;</title>
+ <h:link rel="help" href="https://svgwg.org/svg2-draft/struct.html#UseLayout"/>
+ <h:link rel="match" href="reference/green-100x100.svg"/>
+ <defs>
+ <svg id="s">
+ <rect width="100%" height="100%" fill="green"/>
+ </svg>
+ </defs>
+ <rect width="100" height="100" fill="red"/>
+ <svg width="10" height="10" overflow="visible">
+ <use xlink:href="#s" x="90" y="90"/>
+ <use xlink:href="#s" y="90" width="90"/>
+ <use xlink:href="#s" x="90" height="90"/>
+ <use xlink:href="#s" width="90" height="90"/>
+ </svg>
+</svg>
diff --git a/testing/web-platform/tests/svg/struct/reftests/use-symbol-dimensions-override-001.svg b/testing/web-platform/tests/svg/struct/reftests/use-symbol-dimensions-override-001.svg
new file mode 100644
index 0000000000..1f8f714147
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/reftests/use-symbol-dimensions-override-001.svg
@@ -0,0 +1,18 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:h="http://www.w3.org/1999/xhtml" width="800" height="600">
+ <title>'width' and 'height' from &#x3c;use&#x3e; overrides values on referenced &#x3c;symbol&#x3e;</title>
+ <h:link rel="help" href="https://svgwg.org/svg2-draft/struct.html#UseLayout"/>
+ <h:link rel="match" href="reference/green-100x100.svg"/>
+ <defs>
+ <symbol id="s" width="10" height="10">
+ <rect width="100%" height="100%" fill="green"/>
+ </symbol>
+ </defs>
+ <rect width="100" height="100" fill="red"/>
+ <svg width="1" height="1" overflow="visible">
+ <use xlink:href="#s" x="90" y="90"/>
+ <use xlink:href="#s" y="90" width="90"/>
+ <use xlink:href="#s" x="90" height="90"/>
+ <use xlink:href="#s" width="90" height="90"/>
+ </svg>
+</svg>
diff --git a/testing/web-platform/tests/svg/struct/reftests/use-symbol-dimensions-override-002.svg b/testing/web-platform/tests/svg/struct/reftests/use-symbol-dimensions-override-002.svg
new file mode 100644
index 0000000000..9c1fd49083
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/reftests/use-symbol-dimensions-override-002.svg
@@ -0,0 +1,18 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:h="http://www.w3.org/1999/xhtml" width="800" height="600">
+ <title>'width' and 'height' from &#x3c;use&#x3e; overrides values on referenced &#x3c;symbol&#x3e;</title>
+ <h:link rel="help" href="https://svgwg.org/svg2-draft/struct.html#UseLayout"/>
+ <h:link rel="match" href="reference/green-100x100.svg"/>
+ <defs>
+ <symbol id="s">
+ <rect width="100%" height="100%" fill="green"/>
+ </symbol>
+ </defs>
+ <rect width="100" height="100" fill="red"/>
+ <svg width="10" height="10" overflow="visible">
+ <use xlink:href="#s" x="90" y="90"/>
+ <use xlink:href="#s" y="90" width="90"/>
+ <use xlink:href="#s" x="90" height="90"/>
+ <use xlink:href="#s" width="90" height="90"/>
+ </svg>
+</svg>
diff --git a/testing/web-platform/tests/svg/struct/scripted/autofocus-attribute.svg b/testing/web-platform/tests/svg/struct/scripted/autofocus-attribute.svg
new file mode 100644
index 0000000000..edf200c4c7
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/scripted/autofocus-attribute.svg
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:h="http://www.w3.org/1999/xhtml">
+ <title>Autofocus attribute</title>
+ <metadata>
+ <h:link rel="help" href="https://svgwg.org/svg2-draft/struct.html#autofocusattribute"/>
+ </metadata>
+ <h:script src="/resources/testharness.js"/>
+ <h:script src="/resources/testharnessreport.js"/>
+ <h:script src="/html/interaction/focus/the-autofocus-attribute/resources/utils.js"/>
+ <script><![CDATA[
+const SVG_NS = 'http://www.w3.org/2000/svg';
+
+promise_test(async t => {
+ let w = window.open('blank.svg');
+ await waitForLoad(w);
+ t.add_cleanup(() => { w.close(); });
+ const svgA = w.document.createElementNS(SVG_NS, 'a');
+ svgA.setAttribute('href', '#');
+ svgA.setAttribute('autofocus', 'autofocus');
+ w.document.documentElement.appendChild(svgA);
+ await waitUntilStableAutofocusState(w);
+ assert_equals(w.document.activeElement, svgA);
+}, '<a> should support autofocus');
+
+promise_test(async t => {
+ let w = window.open('blank.svg');
+ await waitForLoad(w);
+ t.add_cleanup(() => { w.close(); });
+ const path = w.document.createElementNS(SVG_NS, 'path');
+ path.setAttribute('d', 'M0,0h8v8z');
+ path.setAttribute('tabindex', '0');
+ path.setAttribute('autofocus', 'autofocus');
+ w.document.documentElement.appendChild(path);
+ await waitUntilStableAutofocusState(w);
+ assert_equals(w.document.activeElement, path);
+}, 'Renderable element with tabindex should support autofocus');
+
+promise_test(async t => {
+ let w = window.open('blank.svg');
+ await waitForLoad(w);
+ t.add_cleanup(() => { w.close(); });
+ let element = w.document.createElementNS(SVG_NS, 'metadata');
+ element.setAttribute('tabindex', '0');
+ element.setAttribute('autofocus', 'autofocus');
+ w.document.documentElement.appendChild(element);
+ await waitUntilStableAutofocusState(w);
+ // https://html.spec.whatwg.org/C/#dom-documentorshadowroot-activeelement
+ // 6. If candidate's document element is non-null, then return that document
+ // element.
+ assert_equals(w.document.activeElement.tagName, 'svg');
+}, 'Never-rendered element with tabindex should not support autofocus');
+]]></script>
+</svg>
diff --git a/testing/web-platform/tests/svg/struct/scripted/blank.svg b/testing/web-platform/tests/svg/struct/scripted/blank.svg
new file mode 100644
index 0000000000..9e560bdc5f
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/scripted/blank.svg
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg"></svg>
diff --git a/testing/web-platform/tests/svg/struct/scripted/svg-getIntersectionList.svg b/testing/web-platform/tests/svg/struct/scripted/svg-getIntersectionList.svg
new file mode 100644
index 0000000000..a360bad3d3
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/scripted/svg-getIntersectionList.svg
@@ -0,0 +1,31 @@
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:html="http://www.w3.org/1999/xhtml">
+<html:link rel="help" href="https://svgwg.org/svg2-draft/struct.html#__svg__SVGSVGElement__getIntersectionList"/>
+<html:script src="/resources/testharness.js"/>
+<html:script src="/resources/testharnessreport.js"/>
+<html:link rel="stylesheet" href="/fonts/ahem.css"/>
+<style>
+text {
+ font-family: Ahem;
+ font-size: 100px;
+}
+</style>
+<text x="0" y="80">Text0</text>
+<text x="0" y="80" style="display:none">Text1</text>
+<text x="0" y="80" pointer-events="none">Text2</text>
+<text x="0" y="80">Text3</text>
+
+<script>
+test(t => {
+ const svg = document.documentElement;
+ const rect = svg.createSVGRect();
+ rect.x = 10;
+ rect.y = 70;
+ rect.width = 20;
+ rect.height = 20;
+ const texts = document.querySelectorAll('text');
+ const list = svg.getIntersectionList(rect, null);
+ assert_array_equals(list, [texts[0], texts[3]]);
+}, 'SVGSVGElement.getIntersectionList()');
+</script>
+</svg>
diff --git a/testing/web-platform/tests/svg/struct/scripted/use-load-error-events.tentative.html b/testing/web-platform/tests/svg/struct/scripted/use-load-error-events.tentative.html
new file mode 100644
index 0000000000..9cbaa0e220
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/scripted/use-load-error-events.tentative.html
@@ -0,0 +1,128 @@
+<!doctype html>
+<title>'load' and 'error' events for SVG &lt;use></title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/rendering-utils.js"></script>
+<svg>
+ <defs>
+ <rect id="local" width="100" height="100" fill="blue"/>
+ </defs>
+</svg>
+<script>
+ function newUseElement() {
+ return document.createElementNS('http://www.w3.org/2000/svg', 'use');
+ }
+ function makeWatcher(root, eventType, url) {
+ return new Promise(resolve => {
+ const watcher = newUseElement();
+ watcher.addEventListener(eventType, resolve);
+ watcher.setAttribute('href', url);
+ root.appendChild(watcher);
+ });
+ }
+ function expectEvents(t, element, event) {
+ return new EventWatcher(t, element, ['load', 'error']).wait_for(event);
+ }
+ const DATA_URL_PAYLOAD =
+ '<svg xmlns="http://www.w3.org/2000/svg"><rect id="green" fill="lime" width="100" height="50"/></svg>';
+ const cookie = Date.now();
+ let counter = 0;
+ function makeCookie(index) {
+ return `${cookie}-${index}`;
+ }
+ function getUrl(type) {
+ const cookie = makeCookie(counter++);
+ switch (type) {
+ case 'existing':
+ return `/images/colors.svg?${cookie}#green`;
+ case 'existing-data':
+ return `data:image/svg+xml,${DATA_URL_PAYLOAD}#green`;
+ case 'non-existing':
+ return `/images/this-file-should-not-exist.svg?${cookie}#green`;
+ case 'broken':
+ return `/images/fail.gif?${cookie}#green`;
+ }
+ }
+
+ promise_test(t => {
+ const svg = document.querySelector('svg');
+ const use = newUseElement();
+ expectEvents(t, use, []);
+ svg.appendChild(use).setAttribute('href', '#local');
+ return waitForAtLeastOneFrame();
+ }, document.title + ', local reference, existing');
+
+ promise_test(t => {
+ const svg = document.querySelector('svg');
+ const use = newUseElement();
+ expectEvents(t, use, []);
+ svg.appendChild(use).setAttribute('href', '#local_not_there');
+ return waitForAtLeastOneFrame();
+ }, document.title + ', local reference, non-existing');
+
+ promise_test(t => {
+ const svg = document.querySelector('svg');
+ const use = newUseElement();
+ const watcher = expectEvents(t, use, ['load']);
+ const url = getUrl('existing');
+ svg.appendChild(use).setAttribute('href', url);
+ return watcher;
+ }, document.title + ', external reference, existing');
+
+ promise_test(t => {
+ const svg = document.querySelector('svg');
+ const use = newUseElement();
+ const watcher = expectEvents(t, use, ['load']);
+ const url = getUrl('existing-data');
+ svg.appendChild(use).setAttribute('href', url);
+ return watcher;
+ }, document.title + ', external data: URL reference, existing');
+
+ promise_test(t => {
+ const svg = document.querySelector('svg');
+ const use = newUseElement();
+ const watcher = expectEvents(t, use, ['error']);
+ const url = getUrl('non-existing');
+ svg.appendChild(use).setAttribute('href', url);
+ return watcher;
+ }, document.title + ', external reference, non-existing');
+
+ promise_test(t => {
+ const svg = document.querySelector('svg');
+ const use = newUseElement();
+ const watcher = expectEvents(t, use, ['error']);
+ const url = getUrl('broken');
+ svg.appendChild(use).setAttribute('href', url);
+ return watcher;
+ }, document.title + ', external reference, existing, parse error');
+
+ promise_test(t => {
+ const svg = document.querySelector('svg');
+ const use = newUseElement();
+ expectEvents(t, use, []);
+ const url = getUrl('existing');
+ svg.appendChild(use).setAttribute('href', url);
+ t.step_timeout(() => use.setAttribute('href', '#local'));
+ return makeWatcher(svg, 'load', url);
+ }, document.title + ', external reference, existing, changed to local reference while loading');
+
+ promise_test(t => {
+ const svg = document.querySelector('svg');
+ const use = newUseElement();
+ expectEvents(t, use, []);
+ const url = getUrl('existing-data');
+ svg.appendChild(use).setAttribute('href', url);
+ t.step_timeout(() => use.setAttribute('href', '#local'));
+ return makeWatcher(svg, 'load', url);
+ }, document.title + ', external data: URL reference, existing, changed to local reference while loading');
+
+ promise_test(t => {
+ const svg = document.querySelector('svg');
+ const use = newUseElement();
+ expectEvents(t, use, []);
+ const url = getUrl('non-existing');
+ svg.appendChild(use).setAttribute('href', url);
+ t.step_timeout(() => use.setAttribute('href', '#local'));
+ return makeWatcher(svg, 'error', url);
+ }, document.title + ', external reference, non-existing, changed to local reference while loading');
+</script>
diff --git a/testing/web-platform/tests/svg/struct/use-getComputedStyle.html b/testing/web-platform/tests/svg/struct/use-getComputedStyle.html
new file mode 100644
index 0000000000..1e5d5af57c
--- /dev/null
+++ b/testing/web-platform/tests/svg/struct/use-getComputedStyle.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<title>SVG Test: Resolved positioning inside use</title>
+<link rel="help" href="https://www.w3.org/TR/SVG2/struct.html#UseElement">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<svg>
+ <use id="use" x="1" y="2"/>
+</svg>
+<script>
+ test(() => {
+ assert_equals(getComputedStyle(use).x, "1px", "use element should have x computed to '1px'.");
+ assert_equals(getComputedStyle(use).y, "2px", "use element should have y computed to '2px'.");
+ }, "Test that we map use element positioning to style.");
+</script>