-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://bugs.webkit.org/show_bug.cgi?id=265237 rdar://118710238 Reviewed by Tim Nguyen. This re-imports WPT css/cssom tests. Upstream commit: web-platform-tests/wpt@73d59dc * LayoutTests/imported/w3c/web-platform-tests/css/cssom/HTMLLinkElement-load-event-002-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/HTMLLinkElement-load-event-002.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/HTMLLinkElement-load-event-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/HTMLLinkElement-load-event.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/HTMLStyleElement-load-event-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/HTMLStyleElement-load-event.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/caretPositionFromPoint-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/caretPositionFromPoint-with-transformation.html: * LayoutTests/imported/w3c/web-platform-tests/css/cssom/caretPositionFromPoint.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/change-rule-with-layers-crash.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssimportrule.html: * LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssom-pagerule-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssom-pagerule.html: * LayoutTests/imported/w3c/web-platform-tests/css/cssom/delete-namespace-rule-when-child-rule-exists-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/delete-namespace-rule-when-child-rule-exists.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-insets-absolute-crash.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-insets-absolute-logical-crash.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-insets-absolute-roundtrip-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-insets-absolute-roundtrip.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-insets-grid-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-insets-grid.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-insets-multicol-absolute-crash.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-insets-relpos-inline-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-insets-relpos-inline.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-margins-roundtrip-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-margins-roundtrip.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-pseudo-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-pseudo.html: * LayoutTests/imported/w3c/web-platform-tests/css/cssom/insert-dir-rule-crash.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/insert-dir-rule-in-iframe-crash.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/insert-invalid-where-rule-crash.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/selectorSerialize.html: * LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-values-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-values.html: * LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-values-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-values.html: * LayoutTests/imported/w3c/web-platform-tests/css/cssom/stylesheet-dom-mutation-event-crash.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/cssom/w3c-import.log: * LayoutTests/platform/glib/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-insets-relpos-inline-expected.txt: Added. Canonical link: https://commits.webkit.org/271070@main
- Loading branch information
Showing
39 changed files
with
729 additions
and
13 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
...sts/imported/w3c/web-platform-tests/css/cssom/HTMLLinkElement-load-event-002-expected.txt
This file contains 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,4 @@ | ||
|
||
PASS Load event doesn't fire on removed link | ||
PASS Load event doesn't fire for removed sheet | ||
|
60 changes: 60 additions & 0 deletions
60
LayoutTests/imported/w3c/web-platform-tests/css/cssom/HTMLLinkElement-load-event-002.html
This file contains 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,60 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<title>Link element load event doesn't block the parser.</title> | ||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> | ||
<link rel="author" title="Mozilla" href="https://mozilla.org"> | ||
<link rel="help" href="https://html.spec.whatwg.org/#link-type-stylesheet"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
let NUM_LOADS = 0; | ||
|
||
function sheetUrl(token) { | ||
return "stylesheet-same-origin.css?" + token; | ||
} | ||
|
||
function createLink(token) { | ||
let link = document.createElement("link"); | ||
link.rel = "stylesheet"; | ||
link.href = sheetUrl(token); | ||
return link; | ||
} | ||
|
||
function waitForEnoughTimeToLoadSheet(token) { | ||
return new Promise(resolve => { | ||
let link = createLink(token); | ||
link.onload = resolve; | ||
document.head.appendChild(link); | ||
}); | ||
} | ||
|
||
promise_test(async function (t) { | ||
let link = createLink("removed"); | ||
link.addEventListener("load", t.unreached_func("got unexpected load event")); | ||
link.addEventListener("error", t.unreached_func("got unexpected error event")); | ||
document.head.appendChild(link); | ||
link.remove(); | ||
|
||
await waitForEnoughTimeToLoadSheet("removed-wait"); | ||
}, "Load event doesn't fire on removed link"); | ||
|
||
promise_test(async function (t) { | ||
let link = createLink("changed-initial"); | ||
let sawLoad = false; | ||
let load = new Promise(resolve => { | ||
link.addEventListener("load", function(e) { | ||
assert_false(sawLoad, "Should only see load event once"); | ||
sawLoad = true; | ||
resolve(); | ||
}); | ||
}); | ||
link.addEventListener("error", t.unreached_func("got unexpected error event")); | ||
document.head.appendChild(link); | ||
link.href = sheetUrl("changed-change"); | ||
|
||
await waitForEnoughTimeToLoadSheet("changed-wait"); | ||
await load; | ||
|
||
assert_true(sawLoad, "Should've seen the load event only once"); | ||
}, "Load event doesn't fire for removed sheet"); | ||
</script> |
3 changes: 3 additions & 0 deletions
3
...utTests/imported/w3c/web-platform-tests/css/cssom/HTMLLinkElement-load-event-expected.txt
This file contains 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,3 @@ | ||
|
||
PASS Link element load event doesn't block the parser. | ||
|
32 changes: 32 additions & 0 deletions
32
LayoutTests/imported/w3c/web-platform-tests/css/cssom/HTMLLinkElement-load-event.html
This file contains 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,32 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<title>Link element load event doesn't block the parser.</title> | ||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> | ||
<link rel="author" title="Mozilla" href="https://mozilla.org"> | ||
<link rel="help" href="https://html.spec.whatwg.org/#link-type-stylesheet"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
let NUM_LOADS = 0; | ||
</script> | ||
<link rel="stylesheet" href="data:text/css,*{}" onload="++NUM_LOADS"> | ||
<script> | ||
let t = async_test(document.title); | ||
window.addEventListener("load", t.step_func_done(() => { | ||
assert_equals(NUM_LOADS, 2, "Load event should've fired for all links"); | ||
})); | ||
t.step(function() { | ||
assert_equals(document.styleSheets.length, 1, "Should expose the sheet to the OM before running script"); | ||
// We can't quite assert that NUM_LOADS is zero (even though it almost-always | ||
// should be the case), in case the parser yields just before executing the | ||
// script but after parsing the link load. | ||
let loadsBefore = NUM_LOADS; | ||
// Intentionally the same href as above, to test caching behavior. | ||
document.write(` | ||
<link rel="stylesheet" href="data:text/css,*{}" onload="++NUM_LOADS"> | ||
`); | ||
assert_equals(document.styleSheets.length, 2, "Should expose both sheets to the OM before running second script"); | ||
assert_equals(NUM_LOADS, loadsBefore, "Shouldn't fire the load event sync"); | ||
assert_not_equals(document.styleSheets[0], document.styleSheets[1], "Should be different sheets"); | ||
}); | ||
</script> |
3 changes: 3 additions & 0 deletions
3
...tTests/imported/w3c/web-platform-tests/css/cssom/HTMLStyleElement-load-event-expected.txt
This file contains 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,3 @@ | ||
|
||
PASS style elements fire load events properly | ||
|
23 changes: 23 additions & 0 deletions
23
LayoutTests/imported/w3c/web-platform-tests/css/cssom/HTMLStyleElement-load-event.html
This file contains 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,23 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<title>style elements fire load events properly</title> | ||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> | ||
<link rel="author" title="Mozilla" href="https://mozilla.org"> | ||
<link rel="help" href="https://html.spec.whatwg.org/#update-a-style-block"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
let NUM_LOADS = 0; | ||
</script> | ||
<style onload="++NUM_LOADS"></style> | ||
<style onload="++NUM_LOADS">:root { background-color: lime }</style> | ||
<style onload="++NUM_LOADS">:root { background-color: lime }</style> <!-- Intentionally the same --> | ||
<script> | ||
async_test(function(t) { | ||
assert_equals(document.styleSheets.length, 3, "Should expose the three stylesheets to the OM sync"); | ||
assert_equals(NUM_LOADS, 0, "Should not fire load event sync"); | ||
window.addEventListener("load", t.step_func_done(() => { | ||
assert_equals(NUM_LOADS, 3, "Load event should've fired for all nodes"); | ||
})); | ||
}); | ||
</script> |
8 changes: 8 additions & 0 deletions
8
LayoutTests/imported/w3c/web-platform-tests/css/cssom/caretPositionFromPoint-expected.txt
This file contains 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 @@ | ||
aaa | ||
|
||
PASS document.caretPositionFromPoint() throws when called without the correct parameters | ||
FAIL document.caretPositionFromPoint() should return null for a document with no viewport doc.caretPositionFromPoint is not a function. (In 'doc.caretPositionFromPoint(0, 0)', 'doc.caretPositionFromPoint' is undefined) | ||
FAIL document.caretPositionFromPoint() should return null if given coordinates outside of the viewport document.caretPositionFromPoint is not a function. (In 'document.caretPositionFromPoint(-5, 5)', 'document.caretPositionFromPoint' is undefined) | ||
FAIL document.caretPositionFromPoint() should return a CaretPosition at the specified location document.caretPositionFromPoint is not a function. (In 'document.caretPositionFromPoint(x, y)', 'document.caretPositionFromPoint' is undefined) | ||
FAIL CaretRange.getClientRect() should return a DOMRect that matches one obtained from a manually constructed Range document.caretPositionFromPoint is not a function. (In 'document.caretPositionFromPoint(x, y)', 'document.caretPositionFromPoint' is undefined) | ||
|
This file contains 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
67 changes: 67 additions & 0 deletions
67
LayoutTests/imported/w3c/web-platform-tests/css/cssom/caretPositionFromPoint.html
This file contains 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,67 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<title>document.caretPositionFromPoint()</title> | ||
<link rel="help" href="https://drafts.csswg.org/cssom-view-1/#dom-document-caretpositionfrompoint"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<style> | ||
#textDiv { | ||
display: inline-block; | ||
} | ||
</style> | ||
<div id="textDiv">aaa</div> | ||
<script> | ||
test(() => { | ||
assert_throws_js(TypeError, () => { document.caretPositionFromPoint(); }); | ||
assert_throws_js(TypeError, () => { document.caretPositionFromPoint(5); }); | ||
assert_throws_js(TypeError, () => { document.caretPositionFromPoint("foo", 5); }); | ||
}, "document.caretPositionFromPoint() throws when called without the correct parameters"); | ||
|
||
test(() => { | ||
const doc = document.implementation.createHTMLDocument(""); | ||
assert_equals(doc.caretPositionFromPoint(0, 0), null); | ||
}, "document.caretPositionFromPoint() should return null for a document with no viewport"); | ||
|
||
test(() => { | ||
assert_equals(document.caretPositionFromPoint(-5, 5), null); | ||
assert_equals(document.caretPositionFromPoint(5, -5), null); | ||
assert_equals(document.caretPositionFromPoint(document.documentElement.clientWidth * 2, 5), null); | ||
assert_equals(document.caretPositionFromPoint(5, document.documentElement.clientHeight * 2), null); | ||
}, "document.caretPositionFromPoint() should return null if given coordinates outside of the viewport"); | ||
|
||
test(() => { | ||
const textDiv = document.getElementById("textDiv"); | ||
const rect = textDiv.getBoundingClientRect(); | ||
const characterWidth = rect.width / textDiv.textContent.length; | ||
const characterIndex = 2 | ||
const x = rect.left + characterWidth * characterIndex; | ||
const y = rect.top + rect.height / 2; | ||
const caretPosition = document.caretPositionFromPoint(x, y); | ||
assert_true(caretPosition instanceof CaretPosition); | ||
assert_true(caretPosition.offsetNode instanceof Text); | ||
assert_equals(typeof(caretPosition.offset), "number"); | ||
assert_equals(caretPosition.offsetNode, textDiv.firstChild); | ||
assert_equals(caretPosition.offset, characterIndex); | ||
}, "document.caretPositionFromPoint() should return a CaretPosition at the specified location"); | ||
|
||
test(() => { | ||
const textDiv = document.getElementById("textDiv"); | ||
const rect = textDiv.getBoundingClientRect(); | ||
const characterWidth = rect.width / textDiv.textContent.length; | ||
const characterIndex = 2 | ||
const x = rect.left + characterWidth * characterIndex; | ||
const y = rect.top + rect.height / 2; | ||
const caretPosition = document.caretPositionFromPoint(x, y); | ||
const caretRangeExpected = new Range(); | ||
caretRangeExpected.setStart(textDiv.firstChild, characterIndex); | ||
caretRectExpected = caretRangeExpected.getBoundingClientRect(); | ||
assert_true(caretPosition.getClientRect instanceof Function); | ||
const caretRectActual = caretPosition.getClientRect(); | ||
assert_true(caretRectActual instanceof DOMRect); | ||
assert_not_equals(caretRectActual, caretPosition.getClientRect(), "CaretPosition.getClientRect() should return a new DOMRect every time"); | ||
assert_equals(caretRectActual.x, caretRectExpected.x); | ||
assert_equals(caretRectActual.y, caretRectExpected.y); | ||
assert_equals(caretRectActual.width, 0, "Caret range should be collapsed"); | ||
assert_equals(caretRectActual.height, caretRectExpected.height); | ||
}, "CaretRange.getClientRect() should return a DOMRect that matches one obtained from a manually constructed Range"); | ||
</script> |
19 changes: 19 additions & 0 deletions
19
LayoutTests/imported/w3c/web-platform-tests/css/cssom/change-rule-with-layers-crash.html
This file contains 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,19 @@ | ||
<!DOCTYPE html> | ||
<title>CSSOM Test: Chrome crash when modifying rules with @layer</title> | ||
<link rel="help" href="https://crbug.com/1499277"> | ||
<link rel="author" title="Steinar H. Gunderson" href="mailto:sesse@chromium.org"> | ||
<style id="s"> | ||
.x { | ||
transition: color 0.5s; | ||
@layer warning { | ||
:first-child { } | ||
:last-child { } | ||
} | ||
} | ||
</style> | ||
<p>Test passes if it does not crash.</p> | ||
<script> | ||
document.body.offsetTop; | ||
s.sheet.cssRules[0].style.transitionDuration = '1s'; | ||
</script> | ||
|
This file contains 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 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 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
3 changes: 3 additions & 0 deletions
3
...3c/web-platform-tests/css/cssom/delete-namespace-rule-when-child-rule-exists-expected.txt
This file contains 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,3 @@ | ||
|
||
FAIL Deleting a @namespace rule when list contains anything other than @import or @namespace rules should throw InvalidStateError. assert_throws_dom: function "() => styleSheet.deleteRule(0)" did not throw | ||
|
16 changes: 16 additions & 0 deletions
16
...ported/w3c/web-platform-tests/css/cssom/delete-namespace-rule-when-child-rule-exists.html
This file contains 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,16 @@ | ||
<!DOCTYPE html> | ||
<title>Deleting a @namespace rule when list contains anything other than @import or @namespace rules should throw InvalidStateError.</title> | ||
<link rel="help" href="https://drafts.csswg.org/cssom-1/#remove-a-css-rule"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<style> | ||
@namespace a url(); | ||
</style> | ||
<script> | ||
test(function () { | ||
let styleSheet = document.styleSheets[0]; | ||
styleSheet.cssRules[0]; | ||
styleSheet.insertRule(`b {}`, 1); | ||
assert_throws_dom("InvalidStateError", () => styleSheet.deleteRule(0)); | ||
}, "Deleting a @namespace rule when list contains anything other than @import or @namespace rules should throw InvalidStateError."); | ||
</script> |
Oops, something went wrong.