mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Update web-platform-tests to revision 36acf7a01cb8ffbbafbd578229c5ad3fde2e47cc
This commit is contained in:
parent
305312e93b
commit
4499a0fbb6
151 changed files with 4858 additions and 2407 deletions
|
@ -33,6 +33,7 @@ const valid_values = [
|
|||
[ "1007", "1007px" ],
|
||||
[ " 00523 ", "523px" ],
|
||||
[ "200.25", "200.25px" ],
|
||||
[ "200.7", "200.7px" ],
|
||||
[ "200.", "200px" ],
|
||||
[ "+200", "200px" ],
|
||||
[ "200in", "200px" ],
|
||||
|
@ -99,39 +100,60 @@ function newImageInput() {
|
|||
* Array of tests. Each test consists of the following information:
|
||||
*
|
||||
* 1) An element creation function.
|
||||
* 2) The name of the attribute to set (and CSS property to get).
|
||||
* 3) A boolean indicating whether 0 is a valid value for the dimension
|
||||
* 2) The name of the attribute to set
|
||||
* 3) The name of the CSS property to get.
|
||||
* 4) A boolean indicating whether 0 is a valid value for the dimension
|
||||
* attribute.
|
||||
*/
|
||||
const tests = [
|
||||
[ newElem("hr"), "width", true ],
|
||||
[ newElem("iframe"), "width", true ],
|
||||
[ newElem("iframe"), "height", true ],
|
||||
[ newImageInput(), "width", true ],
|
||||
[ newImageInput(), "height", true ],
|
||||
[ newElem("marquee"), "width", true ],
|
||||
[ newElem("marquee"), "height", true ],
|
||||
[ newElem("video"), "width", true ],
|
||||
[ newElem("video"), "height", true ],
|
||||
[ newElem("object"), "width", true ],
|
||||
[ newElem("object"), "height", true ],
|
||||
[ newElem("embed"), "width", true ],
|
||||
[ newElem("embed"), "height", true ],
|
||||
[ newElem("img"), "width", true ],
|
||||
[ newElem("img"), "height", true ],
|
||||
[ newElem("td"), "width", false ],
|
||||
[ newElem("td"), "height", false ],
|
||||
[ newElem("hr"), "width", "width", true ],
|
||||
[ newElem("iframe"), "width", "width", true ],
|
||||
[ newElem("iframe"), "height", "height", true ],
|
||||
[ newImageInput(), "width", "width", true ],
|
||||
[ newImageInput(), "height", "height", true ],
|
||||
[ newElem("marquee"), "width", "width", true ],
|
||||
[ newElem("marquee"), "height", "height", true ],
|
||||
[ newElem("video"), "width", "width", true ],
|
||||
[ newElem("video"), "height", "height", true ],
|
||||
[ newElem("object"), "width", "width", true ],
|
||||
[ newElem("object"), "height", "height", true ],
|
||||
[ newElem("embed"), "width", "width", true ],
|
||||
[ newElem("embed"), "height", "height", true ],
|
||||
[ newElem("img"), "width", "width", true ],
|
||||
[ newElem("img"), "height", "height", true ],
|
||||
[ newElem("td"), "width", "width", false ],
|
||||
[ newElem("td"), "height", "height", false ],
|
||||
// https://github.com/whatwg/html/issues/4715 tracks the fact that for
|
||||
// <table width> and <table height> the "0 is valid" boolean should probably
|
||||
// be true.
|
||||
[ newElem("table"), "width", false ],
|
||||
[ newElem("table"), "height", false ],
|
||||
[ newElem("table"), "width", "width", false ],
|
||||
[ newElem("table"), "height", "height", false ],
|
||||
// https://github.com/whatwg/html/issues/4716 tracks the fact that for the
|
||||
// <tr height> case that "0 is valid" boolean should probably be true.
|
||||
[ newElem("tr"), "height", false ],
|
||||
[ newElem("tr"), "height", "height", false ],
|
||||
// https://github.com/whatwg/html/issues/4717 tracks the fact that for the
|
||||
// <col width> case that "0 is valid" boolean should probably be true.
|
||||
[ newElem("col"), "width", false ],
|
||||
[ newElem("col"), "width", "width", false ],
|
||||
[ newElem("embed"), "hspace", "marginLeft", true ],
|
||||
[ newElem("embed"), "hspace", "marginRight", true ],
|
||||
[ newElem("embed"), "vspace", "marginTop", true ],
|
||||
[ newElem("embed"), "vspace", "marginBottom", true ],
|
||||
[ newElem("img"), "hspace", "marginLeft", true ],
|
||||
[ newElem("img"), "hspace", "marginRight", true ],
|
||||
[ newElem("img"), "vspace", "marginTop", true ],
|
||||
[ newElem("img"), "vspace", "marginBottom", true ],
|
||||
[ newElem("object"), "hspace", "marginLeft", true ],
|
||||
[ newElem("object"), "hspace", "marginRight", true ],
|
||||
[ newElem("object"), "vspace", "marginTop", true ],
|
||||
[ newElem("object"), "vspace", "marginBottom", true ],
|
||||
[ newImageInput(), "hspace", "marginLeft", true ],
|
||||
[ newImageInput(), "hspace", "marginRight", true ],
|
||||
[ newImageInput(), "vspace", "marginTop", true ],
|
||||
[ newImageInput(), "vspace", "marginBottom", true ],
|
||||
[ newElem("marquee"), "hspace", "marginLeft", true ],
|
||||
[ newElem("marquee"), "hspace", "marginRight", true ],
|
||||
[ newElem("marquee"), "vspace", "marginTop", true ],
|
||||
[ newElem("marquee"), "vspace", "marginBottom", true ],
|
||||
];
|
||||
|
||||
|
||||
|
@ -141,7 +163,7 @@ function style(element) {
|
|||
|
||||
const container = document.getElementById("container");
|
||||
|
||||
for (let [ctor, attr, zero_allowed] of tests) {
|
||||
for (let [ctor, attr, prop, zero_allowed] of tests) {
|
||||
let valid, invalid;
|
||||
if (zero_allowed) {
|
||||
valid = valid_values_with_0;
|
||||
|
@ -157,13 +179,13 @@ for (let [ctor, attr, zero_allowed] of tests) {
|
|||
elem.setAttribute(attr, value);
|
||||
assert_equals(elem.getAttribute(attr), value);
|
||||
container.appendChild(elem);
|
||||
assert_equals(style(elem)[attr], result);
|
||||
}, `<${elem.localName} ${attr}="${value}"> mapping`);
|
||||
assert_equals(style(elem)[prop], result);
|
||||
}, `<${elem.localName} ${attr}="${value}"> mapping to ${prop}`);
|
||||
}
|
||||
|
||||
let default_elem = ctor();
|
||||
container.appendChild(default_elem);
|
||||
let defaultVal = style(default_elem)[attr];
|
||||
let defaultVal = style(default_elem)[prop];
|
||||
default_elem.remove();
|
||||
for (let value of invalid) {
|
||||
let elem = ctor();
|
||||
|
@ -172,8 +194,8 @@ for (let [ctor, attr, zero_allowed] of tests) {
|
|||
elem.setAttribute(attr, value);
|
||||
assert_equals(elem.getAttribute(attr), value);
|
||||
container.appendChild(elem);
|
||||
assert_equals(style(elem)[attr], defaultVal);
|
||||
}, `<${elem.localName} ${attr}="${value}"> mapping`);
|
||||
assert_equals(style(elem)[prop], defaultVal);
|
||||
}, `<${elem.localName} ${attr}="${value}"> mapping to ${prop}`);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1,11 +1,18 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<!-- Creating iframes is slow in browsers -->
|
||||
<meta name=timeout content=long>
|
||||
<title>Test handling of attributes that map to pixel length properties</title>
|
||||
<link rel="help"
|
||||
href="https://html.spec.whatwg.org/multipage/rendering.html#maps-to-the-pixel-length-property">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<body>
|
||||
<div id="container" style="display: none">
|
||||
<img id="defaultImg">
|
||||
<object id="defaultObject"></object>
|
||||
<input type="image" id="defaultInput"></input>
|
||||
</div>
|
||||
<script>
|
||||
/*
|
||||
* This test tests
|
||||
|
@ -69,13 +76,53 @@ const tests = [
|
|||
[ createFrame, "marginwidth", "marginRight", document.body ],
|
||||
[ createFrame, "marginheight", "marginTop", document.body ],
|
||||
[ createFrame, "marginheight", "marginBottom", document.body ],
|
||||
[ createBody, "marginwidth", "marginLeft", document.body ],
|
||||
[ createBody, "marginwidth", "marginRight", document.body ],
|
||||
[ createBody, "leftmargin", "marginLeft", document.body ],
|
||||
[ createBody, "rightmargin", "marginRight", document.body ],
|
||||
[ createBody, "marginheight", "marginTop", document.body ],
|
||||
[ createBody, "marginheight", "marginBottom", document.body ],
|
||||
[ createBody, "topmargin", "marginTop", document.body ],
|
||||
[ createBody, "bottommargin", "marginBottom", document.body ],
|
||||
[ newElem("img"), "border", "borderTopWidth", defaultImg ],
|
||||
[ newElem("img"), "border", "borderRightWidth", defaultImg ],
|
||||
[ newElem("img"), "border", "borderBottomWidth", defaultImg ],
|
||||
[ newElem("img"), "border", "borderLeftWidth", defaultImg ],
|
||||
[ newElem("object"), "border", "borderTopWidth", defaultObject ],
|
||||
[ newElem("object"), "border", "borderRightWidth", defaultObject ],
|
||||
[ newElem("object"), "border", "borderBottomWidth", defaultObject ],
|
||||
[ newElem("object"), "border", "borderLeftWidth", defaultObject ],
|
||||
[ newImageInput, "border", "borderTopWidth", defaultInput ],
|
||||
[ newImageInput, "border", "borderRightWidth", defaultInput ],
|
||||
[ newImageInput, "border", "borderBottomWidth", defaultInput ],
|
||||
[ newImageInput, "border", "borderLeftWidth", defaultInput ],
|
||||
];
|
||||
|
||||
function newElem(name) {
|
||||
return () => {
|
||||
var elem = document.createElement(name);
|
||||
document.getElementById("container").appendChild(elem);
|
||||
return [ elem, elem, () => elem.remove() ];
|
||||
}
|
||||
}
|
||||
|
||||
function newImageInput() {
|
||||
var elem = document.createElement("input");
|
||||
elem.type = "image";
|
||||
document.getElementById("container").appendChild(elem);
|
||||
return [ elem, elem, () => elem.remove() ];
|
||||
}
|
||||
|
||||
function createIframe() {
|
||||
let ifr = document.createElement("iframe");
|
||||
document.body.appendChild(ifr);
|
||||
return [ ifr, ifr.contentDocument.body, () => ifr.remove() ];
|
||||
}
|
||||
|
||||
function createBody() {
|
||||
let ifr = document.createElement("iframe");
|
||||
document.body.appendChild(ifr);
|
||||
return [ ifr.contentDocument.body, ifr.contentDocument.body, () => ifr.remove() ];
|
||||
}
|
||||
|
||||
function createFrame() {
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Test handling of attributes that should not be mapped into style, but
|
||||
incorrectly were in some browsers</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<body>
|
||||
<div id="container" style="display: none"></div>
|
||||
<iframe></iframe>
|
||||
<script>
|
||||
/*
|
||||
* We wand to test both quirks and standards mode. We can use the fact that
|
||||
* our document is in standards mode and the about:blank iframe we have is in
|
||||
* quirks mode.
|
||||
*/
|
||||
test(() => {
|
||||
assert_equals(document.compatMode, "CSS1Compat")
|
||||
}, "We should be in standards mode");
|
||||
const container = document.getElementById("container");
|
||||
|
||||
const frameDoc = document.querySelector("iframe").contentDocument;
|
||||
test(() => {
|
||||
assert_equals(frameDoc.compatMode, "BackCompat")
|
||||
}, "Subframe should be in quirks mode");
|
||||
const frameContainer = frameDoc.createElement("div");
|
||||
frameContainer.style.display = "none";
|
||||
frameDoc.body.appendChild(frameContainer);
|
||||
|
||||
function newElem(name) {
|
||||
return (parent) =>
|
||||
parent.appendChild(parent.ownerDocument.createElement(name));
|
||||
}
|
||||
|
||||
/*
|
||||
* Array of tests. Each test consists of the following information:
|
||||
*
|
||||
* 1) An element creation function, which takes a parent element as an
|
||||
* argument.
|
||||
* 2) The name of the attribute to set
|
||||
* 3) The name of the CSS property to get.
|
||||
*/
|
||||
const tests = [
|
||||
[ newElem("table"), "hspace", "marginLeft" ],
|
||||
[ newElem("table"), "hspace", "marginRight" ],
|
||||
[ newElem("table"), "vspace", "marginTop" ],
|
||||
[ newElem("table"), "vspace", "marginBottom" ],
|
||||
[ newElem("embed"), "border", "borderTopWidth" ],
|
||||
[ newElem("embed"), "border", "borderRightWidth" ],
|
||||
[ newElem("embed"), "border", "borderBottomWidth" ],
|
||||
[ newElem("embed"), "border", "borderLeftWidth" ],
|
||||
[ newElem("iframe"), "border", "borderTopWidth" ],
|
||||
[ newElem("iframe"), "border", "borderRightWidth" ],
|
||||
[ newElem("iframe"), "border", "borderBottomWidth" ],
|
||||
[ newElem("iframe"), "border", "borderLeftWidth" ],
|
||||
[ newElem("marquee"), "border", "borderTopWidth" ],
|
||||
[ newElem("marquee"), "border", "borderRightWidth" ],
|
||||
[ newElem("marquee"), "border", "borderBottomWidth" ],
|
||||
[ newElem("marquee"), "border", "borderLeftWidth" ],
|
||||
// Non-image input
|
||||
[ newElem("input"), "border", "borderTopWidth" ],
|
||||
[ newElem("input"), "border", "borderRightWidth" ],
|
||||
[ newElem("input"), "border", "borderBottomWidth" ],
|
||||
[ newElem("input"), "border", "borderLeftWidth" ],
|
||||
[ newElem("input"), "width", "width" ],
|
||||
[ newElem("input"), "height", "height" ],
|
||||
[ newElem("input"), "hspace", "marginLeft" ],
|
||||
[ newElem("input"), "hspace", "marginRight" ],
|
||||
[ newElem("input"), "vspace", "marginTop" ],
|
||||
[ newElem("input"), "vspace", "marginBottom" ],
|
||||
];
|
||||
|
||||
function style(element) {
|
||||
return element.ownerDocument.defaultView.getComputedStyle(element);
|
||||
}
|
||||
|
||||
for (let [ctor, attr, prop] of tests) {
|
||||
for (let parent of [container, frameContainer]) {
|
||||
let elem = ctor(parent);
|
||||
test(function() {
|
||||
let default_elem = ctor(parent);
|
||||
this.add_cleanup(() => {
|
||||
elem.remove();
|
||||
default_elem.remove();
|
||||
});
|
||||
elem.setAttribute(attr, "200");
|
||||
assert_equals(elem.getAttribute(attr), "200");
|
||||
assert_equals(style(elem)[prop], style(default_elem)[prop]);
|
||||
}, `<${elem.localName} ${attr}> should not be mapped to style ${prop} in ${parent.ownerDocument.compatMode} mode`);
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue