mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005'
This commit is contained in:
parent
ace9b32b1c
commit
df68c4e5d1
15632 changed files with 514865 additions and 155000 deletions
|
@ -23,7 +23,7 @@ var ctx2 = canvas.getContext('2d');
|
|||
ctx.fillStyle = '#f00';
|
||||
ctx2.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255);
|
||||
|
||||
|
||||
});
|
||||
|
|
|
@ -26,7 +26,7 @@ window.CanvasRenderingContext2D.prototype.fillRectGreen = function (x, y, w, h)
|
|||
};
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRectGreen(0, 0, 100, 50);
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255);
|
||||
|
||||
|
||||
});
|
||||
|
|
|
@ -27,7 +27,7 @@ window.CanvasRenderingContext2D.prototype.fillRect = function (x, y, w, h)
|
|||
};
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255);
|
||||
|
||||
|
||||
});
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8" />
|
||||
<title>Canvas descendants focusability</title>
|
||||
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/canvas.html#being-used-as-relevant-canvas-fallback-content">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#focusable-area">
|
||||
<meta name="assert" content="Checks that elements being used as relevant canvas
|
||||
fallback content can be focusable even if not rendered.">
|
||||
<div id="log"></div>
|
||||
<canvas>
|
||||
<button data-focusable="true"></button>
|
||||
<section data-focusable="false">
|
||||
<div data-focusable="false"></div>
|
||||
<span data-focusable="false"></span>
|
||||
<a data-focusable="false"></a>
|
||||
</section>
|
||||
<section tabindex="-1" data-focusable="true">
|
||||
<div tabindex="-1" data-focusable="true"></div>
|
||||
<span tabindex="-1" data-focusable="true"></span>
|
||||
<a href="#" data-focusable="true"></a>
|
||||
</section>
|
||||
</canvas>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
for (let element of document.querySelectorAll("[data-focusable]")) {
|
||||
let title = element.cloneNode(false).outerHTML.toLowerCase();
|
||||
title = title.slice(0, title.lastIndexOf("<"));
|
||||
test(function() {
|
||||
assert_true(document.activeElement !== element, "Not initially focused");
|
||||
element.focus();
|
||||
if (JSON.parse(element.dataset.focusable)) {
|
||||
assert_true(document.activeElement === element, "Should be focused");
|
||||
} else {
|
||||
assert_true(document.activeElement !== element, "Shouldn't be focused");
|
||||
}
|
||||
}, title);
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8" />
|
||||
<title>Canvas descendants focusability</title>
|
||||
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/canvas.html#being-used-as-relevant-canvas-fallback-content">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#focusable-area">
|
||||
<meta name="assert" content="Checks that descendants of a non-rendered canvas
|
||||
aren't relevant canvas fallback content, so they aren't focusable.">
|
||||
<div id="log"></div>
|
||||
<canvas hidden>
|
||||
<button data-focusable="false"></button>
|
||||
<section tabindex="-1" data-focusable="false">
|
||||
<div tabindex="-1" data-focusable="false"></div>
|
||||
<span tabindex="-1" data-focusable="false"></span>
|
||||
<a href="#" data-focusable="false"></a>
|
||||
</section>
|
||||
</canvas>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
setup(() => {
|
||||
const canvas = document.querySelector("canvas");
|
||||
assert_equals(canvas.getClientRects().length, 0, "Canvas not rendered");
|
||||
});
|
||||
for (let element of document.querySelectorAll("[data-focusable]")) {
|
||||
let title = element.cloneNode(false).outerHTML.toLowerCase();
|
||||
title = title.slice(0, title.lastIndexOf("<"));
|
||||
test(function() {
|
||||
assert_equals(element.getClientRects().length, 0, "Not rendered");
|
||||
assert_true(document.activeElement !== element, "Not initially focused");
|
||||
element.focus();
|
||||
if (JSON.parse(element.dataset.focusable)) {
|
||||
assert_true(document.activeElement === element, "Should be focused");
|
||||
} else {
|
||||
assert_true(document.activeElement !== element, "Shouldn't be focused");
|
||||
}
|
||||
}, title);
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8" />
|
||||
<title>Canvas descendants focusability</title>
|
||||
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/canvas.html#being-used-as-relevant-canvas-fallback-content">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#focusable-area">
|
||||
<link rel="help" href="https://github.com/whatwg/html/issues/7534">
|
||||
<meta name="assert" content="Checks that elements being used as relevant canvas
|
||||
fallback content can't be focusable if they are not rendered because of an
|
||||
explicit 'display: none' or 'display: contents' style.">
|
||||
<div id="log"></div>
|
||||
<canvas>
|
||||
<button hidden data-focusable="false"></button>
|
||||
<section hidden tabindex="-1" data-focusable="false">
|
||||
<div tabindex="-1" data-focusable="false"></div>
|
||||
<span tabindex="-1" data-focusable="false"></span>
|
||||
<a href="#" data-focusable="false"></a>
|
||||
</section>
|
||||
<button style="display: contents" data-focusable="false"></button>
|
||||
<section style="display: contents" tabindex="-1" data-focusable="false">
|
||||
<div style="display: contents" tabindex="-1" data-focusable="false"></div>
|
||||
<span style="display: contents" tabindex="-1" data-focusable="false"></span>
|
||||
<a style="display: contents" href="#" data-focusable="false"></a>
|
||||
</section>
|
||||
</canvas>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
setup(() => {
|
||||
const canvas = document.querySelector("canvas");
|
||||
assert_greater_than(canvas.getClientRects().length, 0, "Canvas is rendered");
|
||||
});
|
||||
for (let element of document.querySelectorAll("[data-focusable]")) {
|
||||
let title = element.cloneNode(false).outerHTML.toLowerCase();
|
||||
title = title.slice(0, title.lastIndexOf("<"));
|
||||
test(function() {
|
||||
assert_equals(element.getClientRects().length, 0, "Not rendered");
|
||||
assert_true(document.activeElement !== element, "Not initially focused");
|
||||
element.focus();
|
||||
if (JSON.parse(element.dataset.focusable)) {
|
||||
assert_true(document.activeElement === element, "Should be focused");
|
||||
} else {
|
||||
assert_true(document.activeElement !== element, "Shouldn't be focused");
|
||||
}
|
||||
}, title);
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8" />
|
||||
<title>Canvas descendants focusability</title>
|
||||
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/canvas.html#being-used-as-relevant-canvas-fallback-content">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#focusable-area">
|
||||
<link rel="help" href="https://github.com/whatwg/html/issues/7534">
|
||||
<meta name="assert" content="Checks that elements being used as relevant canvas
|
||||
fallback content can't be focusable if they are not in the flat tree.">
|
||||
<div id="log"></div>
|
||||
<canvas>
|
||||
<section id="shadow-host">
|
||||
<button data-focusable="false"></button>
|
||||
<section tabindex="-1" data-focusable="false">
|
||||
<div tabindex="-1" data-focusable="false"></div>
|
||||
<span tabindex="-1" data-focusable="false"></span>
|
||||
<a href="#" data-focusable="false"></a>
|
||||
</section>
|
||||
</section>
|
||||
</canvas>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
setup(() => {
|
||||
const canvas = document.querySelector("canvas");
|
||||
assert_greater_than(canvas.getClientRects().length, 0, "Canvas is rendered");
|
||||
const shadowHost = document.getElementById("shadow-host");
|
||||
const shadowRoot = shadowHost.attachShadow({ mode: "open" });
|
||||
const slot = document.createElement("slot");
|
||||
slot.name = "slot";
|
||||
shadowRoot.appendChild(slot);
|
||||
});
|
||||
for (let element of document.querySelectorAll("[data-focusable]")) {
|
||||
let title = element.cloneNode(false).outerHTML.toLowerCase();
|
||||
title = title.slice(0, title.lastIndexOf("<"));
|
||||
test(function() {
|
||||
assert_equals(element.getClientRects().length, 0, "Not rendered");
|
||||
assert_true(document.activeElement !== element, "Not initially focused");
|
||||
element.focus();
|
||||
if (JSON.parse(element.dataset.focusable)) {
|
||||
assert_true(document.activeElement === element, "Should be focused");
|
||||
} else {
|
||||
assert_true(document.activeElement !== element, "Shouldn't be focused");
|
||||
}
|
||||
}, title);
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,61 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8" />
|
||||
<title>Canvas descendants focusability</title>
|
||||
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/canvas.html#being-used-as-relevant-canvas-fallback-content">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#focusable-area">
|
||||
<meta name="assert" content="Checks that descendants of a canvas that represents
|
||||
fallback content are not focusable if not rendered, as usual.">
|
||||
<div id="log"></div>
|
||||
<!-- Use a sandboxed iframe to disable scripting and make the canvas
|
||||
represent its fallback content instead of embedded content. -->
|
||||
<iframe sandbox="allow-same-origin" allow="focus-without-user-activation *"
|
||||
srcdoc='
|
||||
<button data-focusable="true" a></button>
|
||||
<canvas>
|
||||
<button data-focusable="true"></button>
|
||||
<section tabindex="-1" data-focusable="true">
|
||||
<div tabindex="-1" data-focusable="true"></div>
|
||||
<span tabindex="-1" data-focusable="true"></span>
|
||||
<a href="#" data-focusable="true"></a>
|
||||
</section>
|
||||
<button hidden data-focusable="false"></button>
|
||||
<section tabindex="-1" hidden data-focusable="false">
|
||||
<div tabindex="-1" data-focusable="false"></div>
|
||||
<span tabindex="-1" data-focusable="false"></span>
|
||||
<a href="#" data-focusable="false"></a>
|
||||
</section>
|
||||
</canvas>
|
||||
'></iframe>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
setup({ explicit_done: true });
|
||||
setup(async () => {
|
||||
const iframe = document.querySelector("iframe");
|
||||
await new Promise(resolve => {
|
||||
const win = iframe.contentWindow;
|
||||
if (win.location.href === "about:blank" ||
|
||||
win.document.readyState !== "complete") {
|
||||
iframe.addEventListener("load", resolve, {once: true});
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
const doc = iframe.contentDocument;
|
||||
for (let element of doc.querySelectorAll("[data-focusable]")) {
|
||||
let title = element.cloneNode(false).outerHTML.toLowerCase();
|
||||
title = title.slice(0, title.lastIndexOf("<"));
|
||||
test(function() {
|
||||
assert_true(doc.activeElement !== element, "Not initially focused");
|
||||
element.focus();
|
||||
if (JSON.parse(element.dataset.focusable)) {
|
||||
assert_true(doc.activeElement === element, "Should be focused");
|
||||
} else {
|
||||
assert_true(doc.activeElement !== element, "Shouldn't be focused");
|
||||
}
|
||||
}, title);
|
||||
}
|
||||
done();
|
||||
});
|
||||
</script>
|
|
@ -22,9 +22,8 @@ the actual blackness visible.
|
|||
var t = async_test("Initial state is transparent black");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
_assertPixel(canvas, 20,20, 0,0,0,0, "20,20", "0,0,0,0");
|
||||
_assertPixel(canvas, 20,20, 0,0,0,0);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -25,9 +25,8 @@ ctx.clip();
|
|||
canvas.width = 100;
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
_assertPixel(canvas, 20,20, 0,255,0,255, "20,20", "0,255,0,255");
|
||||
_assertPixel(canvas, 20,20, 0,255,0,255);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -21,11 +21,10 @@ _addTest(function(canvas, ctx) {
|
|||
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 50, 50);
|
||||
_assertPixel(canvas, 20,20, 255,0,0,255, "20,20", "255,0,0,255");
|
||||
_assertPixel(canvas, 20,20, 255,0,0,255);
|
||||
canvas.width = 50;
|
||||
_assertPixel(canvas, 20,20, 0,0,0,0, "20,20", "0,0,0,0");
|
||||
_assertPixel(canvas, 20,20, 0,0,0,0);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -28,9 +28,8 @@ ctx.fillStyle = '#f00';
|
|||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = g;
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -24,9 +24,8 @@ ctx.rect(0, 0, 100, 50);
|
|||
canvas.width = 100;
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fill();
|
||||
_assertPixel(canvas, 20,20, 0,0,0,0, "20,20", "0,0,0,0");
|
||||
_assertPixel(canvas, 20,20, 0,0,0,0);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -28,9 +28,8 @@ ctx.fillStyle = '#f00';
|
|||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = p;
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -22,11 +22,10 @@ _addTest(function(canvas, ctx) {
|
|||
canvas.width = 100;
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 50, 50);
|
||||
_assertPixel(canvas, 20,20, 255,0,0,255, "20,20", "255,0,0,255");
|
||||
_assertPixel(canvas, 20,20, 255,0,0,255);
|
||||
canvas.width = 100;
|
||||
_assertPixel(canvas, 20,20, 0,0,0,0, "20,20", "0,0,0,0");
|
||||
_assertPixel(canvas, 20,20, 0,0,0,0);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -24,9 +24,8 @@ ctx.scale(0.1, 0.1);
|
|||
canvas.width = 100;
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
_assertPixel(canvas, 20,20, 0,255,0,255, "20,20", "0,255,0,255");
|
||||
_assertPixel(canvas, 20,20, 0,255,0,255);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -30,11 +30,10 @@ img.onload = t.step_func_done(function ()
|
|||
{
|
||||
ctx.drawImage(img, 0, 0);
|
||||
canvas.toDataURL(); // should be permitted
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255);
|
||||
});
|
||||
img.src = data;
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ if (!data.match(/^data:image\/jpeg[;,]/)) {
|
|||
img.onload = t.step_func_done(function ()
|
||||
{
|
||||
ctx.drawImage(img, 0, 0);
|
||||
_assertPixelApprox(canvas, 50,25, 63,127,63,255, "50,25", "63,127,63,255", 8);
|
||||
_assertPixelApprox(canvas, 50,25, 63,127,63,255, 8);
|
||||
});
|
||||
img.src = data;
|
||||
}
|
||||
|
@ -42,4 +42,3 @@ if (!data.match(/^data:image\/jpeg[;,]/)) {
|
|||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -35,14 +35,13 @@ deferTest();
|
|||
img.onload = t.step_func_done(function ()
|
||||
{
|
||||
ctx.drawImage(img, 0, 0);
|
||||
_assertPixelApprox(canvas, 12,20, 255,255,0,255, "12,20", "255,255,0,255", 8);
|
||||
_assertPixelApprox(canvas, 50,20, 0,255,255,255, "50,20", "0,255,255,255", 8);
|
||||
_assertPixelApprox(canvas, 87,20, 0,0,255,255, "87,20", "0,0,255,255", 8);
|
||||
_assertPixelApprox(canvas, 50,45, 255,255,255,255, "50,45", "255,255,255,255", 8);
|
||||
_assertPixelApprox(canvas, 12,20, 255,255,0,255, 8);
|
||||
_assertPixelApprox(canvas, 50,20, 0,255,255,255, 8);
|
||||
_assertPixelApprox(canvas, 87,20, 0,0,255,255, 8);
|
||||
_assertPixelApprox(canvas, 50,45, 255,255,255,255, 8);
|
||||
});
|
||||
img.src = data;
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -42,8 +42,8 @@ if (!data.match(/^data:image\/jpeg[;,]/)) {
|
|||
ctx.drawImage(img_hi, 0, 0, 50, 50, 0, 0, 50, 50);
|
||||
ctx.drawImage(img_lo, 0, 0, 50, 50, 50, 0, 50, 50);
|
||||
_assert(data_hi.length > data_lo.length, "data_hi.length > data_lo.length");
|
||||
_assertPixelApprox(canvas, 25,25, 0,0,255,255, "25,25", "0,0,255,255", 8);
|
||||
_assertPixelApprox(canvas, 75,25, 0,0,255,255, "75,25", "0,0,255,255", 32);
|
||||
_assertPixelApprox(canvas, 25,25, 0,0,255,255, 8);
|
||||
_assertPixelApprox(canvas, 75,25, 0,0,255,255, 32);
|
||||
});
|
||||
img_lo.src = data_lo;
|
||||
};
|
||||
|
|
|
@ -35,14 +35,13 @@ img.onload = t.step_func_done(function ()
|
|||
ctx.drawImage(img, 0, 25);
|
||||
// (The alpha values do not really survive float->int conversion, so just
|
||||
// do approximate comparisons)
|
||||
_assertPixel(canvas, 12,40, 1,3,254,255, "12,40", "1,3,254,255");
|
||||
_assertPixelApprox(canvas, 37,40, 8,252,248,191, "37,40", "8,252,248,191", 2);
|
||||
_assertPixelApprox(canvas, 62,40, 6,10,250,127, "62,40", "6,10,250,127", 4);
|
||||
_assertPixelApprox(canvas, 87,40, 12,16,244,63, "87,40", "12,16,244,63", 8);
|
||||
_assertPixel(canvas, 12,40, 1,3,254,255);
|
||||
_assertPixelApprox(canvas, 37,40, 8,252,248,191, 2);
|
||||
_assertPixelApprox(canvas, 62,40, 6,10,250,127, 4);
|
||||
_assertPixelApprox(canvas, 87,40, 12,16,244,63, 8);
|
||||
});
|
||||
img.src = canvas.toDataURL();
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -35,14 +35,13 @@ deferTest();
|
|||
img.onload = t.step_func_done(function ()
|
||||
{
|
||||
ctx.drawImage(img, 0, 0);
|
||||
_assertPixel(canvas, 12,20, 255,255,0,255, "12,20", "255,255,0,255");
|
||||
_assertPixel(canvas, 50,20, 0,255,255,255, "50,20", "0,255,255,255");
|
||||
_assertPixel(canvas, 87,20, 0,0,255,255, "87,20", "0,0,255,255");
|
||||
_assertPixel(canvas, 50,45, 255,255,255,255, "50,45", "255,255,255,255");
|
||||
_assertPixel(canvas, 12,20, 255,255,0,255);
|
||||
_assertPixel(canvas, 50,20, 0,255,255,255);
|
||||
_assertPixel(canvas, 87,20, 0,0,255,255);
|
||||
_assertPixel(canvas, 50,45, 255,255,255,255);
|
||||
});
|
||||
img.src = data;
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue