Skip to content

Commit

Permalink
Synchronize css/cssom & css/css-highlight-api WPT
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=269601
rdar://123152284

Reviewed by Tim Nguyen.

This initially landed as 274916@main but got backed out in 274996@main
as collateral damage. The expectations are different as some of the
getComputedStyle() changes also got backed out as collateral damage.

Aligns with this upstream commit included:
web-platform-tests/wpt@8ca6fb2

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/resources/resource-files.json:
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/highlight-priority.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/highlight-pseudo-computed-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/highlight-pseudo-computed.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/highlight-pseudo-from-font-computed-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/highlight-pseudo-from-font-computed.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/historical.window-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/historical.window.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/historical.window.js: Added.
(test):
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-001-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-001-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-001.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-002-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-002-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-002.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-003-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-003-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-003.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-004-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-004-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-004.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-005-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-005.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-006-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-006.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-001-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-001-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-001.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-002-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-002.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-003-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-003.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-004-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-004.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-dynamic-font-metrics-001-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-dynamic-font-metrics-001.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-dynamic-logical-metrics-001-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-dynamic-logical-metrics-001.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-001-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-001-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-001.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-002-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-002-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-002.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-003-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-003-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-003.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-004-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-004-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-004.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-005-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-005-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-005.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-logical-metrics-001-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-logical-metrics-001-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-logical-metrics-001.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-logical-metrics-002-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-logical-metrics-002-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-logical-metrics-002.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-below-selection-transparency-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-below-selection-transparency-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-below-selection-transparency.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-priority-text-decoration-001-expected.html: Removed.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-priority-text-decoration-001-ref.html: Removed.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-priority-text-decoration-001.html: Removed.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-staticrange-004-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-staticrange-004-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-staticrange-004.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-staticrange-005-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-staticrange-005.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-vertical-writing-mode-001-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-vertical-writing-mode-001-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-vertical-writing-mode-001.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/resources/iframe-container.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/resources/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-pseudo-with-argument-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-pseudo-with-argument.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/w3c-import.log:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/css/css-highlight-api/highlight-pseudo-computed-expected.txt: Added.
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-pseudo-with-argument-expected.txt: Added.
* LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-highlight-api/highlight-pseudo-computed-expected.txt: Added.
* LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-pseudo-with-argument-expected.txt: Added.

Canonical link: https://commits.webkit.org/275031@main
  • Loading branch information
annevk committed Feb 20, 2024
1 parent 816ab2f commit 7d26bfc
Show file tree
Hide file tree
Showing 85 changed files with 1,946 additions and 91 deletions.
24 changes: 20 additions & 4 deletions LayoutTests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -4989,9 +4989,29 @@ webkit.org/b/220325 http/wpt/css/css-highlight-api/highlight-text-cascade.html [

# Tests need updating relating to Highlight Spec
imported/w3c/web-platform-tests/css/css-highlight-api/painting/css-target-text-decoration-001.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-001.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-002.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-003.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-004.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-005.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-006.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-002.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-003.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-004.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-dynamic-font-metrics-001.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-dynamic-logical-metrics-001.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-001.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-002.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-003.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-004.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-005.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-logical-metrics-001.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-logical-metrics-002.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-below-selection-transparency.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-below-target-text.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-inheritance-001.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-inheritance-002.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-vertical-writing-mode-001.html [ ImageOnlyFailure ]

http/tests/webgl/1.0.x/conformance/textures/misc/origin-clean-conformance-offscreencanvas.html [ Skip ]
http/tests/webgl/2.0.y/conformance/textures/misc/origin-clean-conformance-offscreencanvas.html [ Skip ]
Expand Down Expand Up @@ -6523,10 +6543,6 @@ imported/w3c/web-platform-tests/css/css-tables/zero-rowspan-001.html [ ImageOnly
imported/w3c/web-platform-tests/css/css-tables/zero-rowspan-002.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-tables/html5-table-formatting-fixed-layout-1.html [ Pass Failure ]

# This test started failing when we started supporting passing a Range to the Highlight constructor.
# We used to only support StaticRange objects and thus ignore the passed in parameter, which
# caused the test to pass by luck.

# New failures after re-importing css-overflow
imported/w3c/web-platform-tests/css/css-overflow/margin-block-end-scroll-area-001.html [ Skip ]
imported/w3c/web-platform-tests/css/css-overflow/overflow-clip-margin-010.html [ Skip ]
Expand Down
17 changes: 17 additions & 0 deletions LayoutTests/imported/w3c/resources/resource-files.json
Original file line number Diff line number Diff line change
Expand Up @@ -2881,15 +2881,29 @@
"web-platform-tests/css/css-grid/table-grid-item-dynamic-003-ref.html",
"web-platform-tests/css/css-grid/table-grid-item-dynamic-004-ref.html",
"web-platform-tests/css/css-grid/test-plan/index.html",
"web-platform-tests/css/css-highlight-api/highlight-priority-painting-ref.html",
"web-platform-tests/css/css-highlight-api/painting/css-highlight-painting-underline-offset-001-ref.html",
"web-platform-tests/css/css-highlight-api/painting/css-target-text-decoration-001-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-001-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-002-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-003-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-container-metrics-004-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-dynamic-container-metrics-001-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-001-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-002-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-003-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-004-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-font-metrics-005-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-logical-metrics-001-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-logical-metrics-002-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-001-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-002-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-003-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-004-2-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-004-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-below-grammar-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-below-selection-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-below-selection-transparency-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-below-target-text-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-iframe-001-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-iframe-003-ref.html",
Expand All @@ -2901,9 +2915,12 @@
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-invalidation-007-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-overlapping-highlights-001-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-overlapping-highlights-002-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-prioritization-003-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-staticrange-001-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-staticrange-004-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-text-decoration-001-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-text-decoration-dynamic-001-ref.html",
"web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-vertical-writing-mode-001-ref.html",
"web-platform-tests/css/css-highlight-api/painting/invalidation/css-highlight-invalidation-001-ref.html",
"web-platform-tests/css/css-images/image-fit-001.xht",
"web-platform-tests/css/css-images/image-fit-006.xht",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,5 @@
assert_equals(highlightBlue.priority, -1);
});
</script>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@

FAIL getComputedStyle() for ::highlight(foo) assert_equals: Background color is green. expected "rgb(0, 128, 0)" but got ""
FAIL Different getComputedStyle() for ::highlight(bar) and same element assert_equals: Background color is cyan. expected "rgb(0, 255, 255)" but got ""
FAIL getComputedStyle() for ::highlight(foo): should be element's default assert_equals: Background color is element's default. expected "rgba(0, 0, 0, 0)" but got ""
FAIL getComputedStyle() for ::highlight(foo)) should be element's default assert_equals: Background color is element's default. expected "rgba(0, 0, 0, 0)" but got ""
FAIL getComputedStyle() for ::highlight(foo)( should be element's default assert_equals: Background color is element's default. expected "rgba(0, 0, 0, 0)" but got ""
PASS getComputedStyle() for ::highlight should be element's default
FAIL getComputedStyle() for ::highlight(foo)(foo) should be element's default assert_equals: Background color is element's default. expected "rgba(0, 0, 0, 0)" but got ""
FAIL getComputedStyle() for ::highlight(foo)() should be element's default assert_equals: Background color is element's default. expected "rgba(0, 0, 0, 0)" but got ""
FAIL getComputedStyle() for :::highlight(foo) should be element's default assert_equals: Background color is element's default. expected "rgba(0, 0, 0, 0)" but got ""
FAIL getComputedStyle() for ::highlight(foo). should be element's default assert_equals: Background color is element's default. expected "rgba(0, 0, 0, 0)" but got ""
FAIL getComputedStyle() for ::highlight(foo,bar) should be element's default assert_equals: Background color is element's default. expected "rgba(0, 0, 0, 0)" but got ""
PASS getComputedStyle() for ::highlight(foo): should not return a style.
PASS getComputedStyle() for ::highlight(foo)) should not return a style.
PASS getComputedStyle() for ::highlight(foo)( should not return a style.
FAIL getComputedStyle() for ::highlight should not return a style. assert_equals: Invalid pseudo identifiers should not return a style. expected 0 but got 418
PASS getComputedStyle() for ::highlight(foo)(foo) should not return a style.
PASS getComputedStyle() for ::highlight(foo)() should not return a style.
PASS getComputedStyle() for :::highlight(foo) should not return a style.
PASS getComputedStyle() for ::highlight(foo). should not return a style.
PASS getComputedStyle() for ::highlight(foo,bar) should not return a style.
PASS getComputedStyle() for ::highlight(foo bar) should not return a style.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
background-color: green;
color: lime;
}

#target::highlight(bar) {
background-color: cyan;
color: fuchsia;
Expand All @@ -30,12 +31,10 @@
assert_equals(style.color, "rgb(255, 0, 255)", "Color is fuchsia.");
}, `Different getComputedStyle() for ${highlightPseudo} and same element`);

for (const illHighlightPseudo of ["::highlight(foo):", "::highlight(foo))", "::highlight(foo)(", "::highlight", "::highlight(foo)(foo)", "::highlight(foo)()", ":::highlight(foo)", "::highlight(foo).", "::highlight(foo,bar)"]) {
for (const illHighlightPseudo of ["::highlight(foo):", "::highlight(foo))", "::highlight(foo)(", "::highlight", "::highlight(foo)(foo)", "::highlight(foo)()", ":::highlight(foo)", "::highlight(foo).", "::highlight(foo,bar)", "::highlight(foo bar)"]) {
test(() => {
let style = getComputedStyle(target, illHighlightPseudo);
let defaultStyle = getComputedStyle(target);
assert_equals(style.backgroundColor, defaultStyle.backgroundColor, "Background color is element's default.");
assert_equals(style.color, defaultStyle.color, "Color is element's default.");
}, `getComputedStyle() for ${illHighlightPseudo} should be element's default`);
assert_equals(style.length, 0, "Invalid pseudo identifiers should not return a style.");
}, `getComputedStyle() for ${illHighlightPseudo} should not return a style.`);
}
</script>
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
A green 10px offset underline 4px thick
A blue 20px offset underline 2px thick

FAIL getComputedStyle() for root element assert_equals: Text underline offset is 8px. expected "8px" but got ""
FAIL getComputedStyle() for root highlight applied to div assert_equals: Text underline offset is 10px. expected "10px" but got ""
FAIL getComputedStyle() for div specific highlight assert_equals: Text underline offset is 20px. expected "20px" but got ""

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!doctype html>
<meta charset="utf-8">
<title>CSS ::highlight Pseudo-Element Test: ::highlight selector getComputedStyle</title>
<link rel="help" href="https://drafts.csswg.org/css-highlight-api-1/">
<meta name="assert" value="Font relative units are correctly reported in getComputedStyle">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
:root {
font-size: 16px;
}
div {
margin: 40px;
font-size: 20px;
}
::highlight(highlight1) {
text-underline-offset: 0.5em;
text-decoration-line: underline;
text-decoration-color: green;
text-decoration-thickness: 0.25rem;
}
#h2::highlight(highlight1) {
text-underline-offset: 1.0em;
text-decoration-line: underline;
text-decoration-color: blue;
text-decoration-thickness: 0.125rem;
}
</style>
<div id="h1">A green 10px offset underline 4px thick</div>
<div id="h2">A blue 20px offset underline 2px thick</div>
<script>
let r1 = new Range();
r1.setStart(h1, 0);
r1.setEnd(h1, 1);
let r2 = new Range();
r2.setStart(h2, 0);
r2.setEnd(h2, 1);
CSS.highlights.set("highlight1", new Highlight(r1, r2));

let highlightPseudo = "::highlight(highlight1)";
test(() => {
let style = getComputedStyle(document.documentElement, highlightPseudo);
assert_equals(style.textUnderlineOffset, "8px", "Text underline offset is 8px.");
assert_equals(style.textDecorationThickness, "4px", "Text decoration thickness is 4px.");
}, `getComputedStyle() for root element`);

test(() => {
let style = getComputedStyle(h1, highlightPseudo);
assert_equals(style.textUnderlineOffset, "10px", "Text underline offset is 10px.");
assert_equals(style.textDecorationThickness, "4px", "Text decoration thickness is 4px.");
}, `getComputedStyle() for root highlight applied to div`);

test(() => {
let style = getComputedStyle(h2, highlightPseudo);
assert_equals(style.textUnderlineOffset, "20px", "Text underline offset is 20px.");
assert_equals(style.textDecorationThickness, "2px", "Text decoration thickness is 2px.");
}, `getComputedStyle() for div specific highlight`);

</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

PASS HighlightRegister was renamed

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- This file is required for WebKit test infrastructure to run the templated test -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// https://drafts.csswg.org/css-highlight-api-1/

"use strict";

test(() => {
assert_equals(self.HighlightRegister, undefined);
}, "HighlightRegister was renamed");
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<title>CSS Highlight API Test Reference</title>
<head>
<style>
div {
width: 200px;
height: 100px;
}
#h1 {
text-underline-offset: 1svw;
text-decoration-line: underline;
text-decoration-color: green;
text-decoration-thickness: 2svh;
}
</style>
</head>
<body>
<div id="h1">With container size</div>
</body>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<title>CSS Highlight API Test Reference</title>
<head>
<style>
div {
width: 200px;
height: 100px;
}
#h1 {
text-underline-offset: 1svw;
text-decoration-line: underline;
text-decoration-color: green;
text-decoration-thickness: 2svh;
}
</style>
</head>
<body>
<div id="h1">With container size</div>
</body>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<title>CSS Highlight API Test: Highlights using container sizes</title>
<link rel="help" href="https://drafts.csswg.org/css-highlight-api-1/">
<link rel="help" href="https://drafts.csswg.org/css-pseudo/#highlight-styling">
<link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-lengths">
<link rel="match" href="custom-highlight-container-metrics-001-ref.html">
<meta name="assert" value="lengths depending on containers take the correct values in a universal highlight with no container">
<head>
<style>
div {
width: 200px;
height: 100px;
}
::highlight(highlight1) {
text-underline-offset: 1cqw;
text-decoration-line: underline;
text-decoration-color: green;
text-decoration-thickness: 2cqh;
}
</style>
</head>
<body>
<div id="h1">With container size</div>
<script>
let r1 = new Range();
r1.setStart(h1, 0);
r1.setEnd(h1, 1);
CSS.highlights.set("highlight1", new Highlight(r1));
</script>
</body>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<title>CSS Highlight API Test Reference</title>
<head>
<style>
.wrapper {
width: 200px;
height: 100px;
text-underline-offset: 4px;
text-decoration-line: underline;
text-decoration-color: green;
text-decoration-thickness: 4px;
}
#h2 {
text-underline-offset: 2svw;
text-decoration-line: underline;
text-decoration-color: green;
text-decoration-thickness: 4svh;
}
</style>
</head>
<body>
<div class="wrapper">With container size</div>
<div id="h2">Without container size</div>
</body>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<title>CSS Highlight API Test Reference</title>
<head>
<style>
.wrapper {
width: 200px;
height: 100px;
text-underline-offset: 4px;
text-decoration-line: underline;
text-decoration-color: green;
text-decoration-thickness: 4px;
}
#h2 {
text-underline-offset: 2svw;
text-decoration-line: underline;
text-decoration-color: green;
text-decoration-thickness: 4svh;
}
</style>
</head>
<body>
<div class="wrapper">With container size</div>
<div id="h2">Without container size</div>
</body>
Loading

0 comments on commit 7d26bfc

Please sign in to comment.