Skip to content

Commit

Permalink
Re-import html/rendering/widgets WPT tests
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=274462

Reviewed by Tim Nguyen.

Upstream commit: web-platform-tests/wpt@4593ea7

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/resources/resource-files.json:
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/WEB_FEATURES.yml: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/computed-style-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/computed-style.html:
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/display-none-or-contents-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/display-none-or-contents-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/display-none-or-contents.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/input-type-button-clip-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/input-type-button-clip-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/input-type-button-clip.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/input-date-baseline-print-expected.html: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/input-password-background-suppresses-appearance-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/input-password-background-suppresses-appearance-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/input-password-background-suppresses-appearance.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/input-text-size-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/input-text-size.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/textarea-cols-rows-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/textarea-cols-rows.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/textarea-scrollbar-sizing-001-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/textarea-scrollbar-sizing-001.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/textarea-scrollbar-sizing-002-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/textarea-scrollbar-sizing-002.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/w3c-import.log:
* LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/computed-style-expected.txt:

Canonical link: https://commits.webkit.org/279080@main
  • Loading branch information
lukewarlow committed May 21, 2024
1 parent 7b0ca13 commit 8f9c15b
Show file tree
Hide file tree
Showing 26 changed files with 396 additions and 18 deletions.
6 changes: 6 additions & 0 deletions LayoutTests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,9 @@ imported/w3c/web-platform-tests/html/rendering/replaced-elements/the-select-elem
imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/anonymous-button-content-box.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/inline-level.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/propagate-text-decoration.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/display-none-or-contents.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/input-type-button-clip.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/html/rendering/widgets/input-password-background-suppresses-appearance.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/option-checked-styling.html [ ImageOnlyFailure ]

#[ iOS MacOS ] imported/w3c/web-platform-tests/html/rendering/widgets/the-select-element/option-add-label-quirks.html(layout-tests) is a constant IMAGE failure
Expand Down Expand Up @@ -1659,6 +1662,9 @@ imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/subgrid/masonry-s
# Timeout
imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-columns-crash.html [ Skip ]

# Textarea vertical writing mode bug
webkit.org/b/274332 imported/w3c/web-platform-tests/html/rendering/widgets/textarea-scrollbar-sizing-002.html [ Skip ]

# CSS Grid Baseline tests
imported/w3c/web-platform-tests/css/css-grid/alignment/grid-justify-baseline-001.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-grid/alignment/self-baseline/grid-self-baseline-002-b.html [ ImageOnlyFailure ]
Expand Down
4 changes: 4 additions & 0 deletions LayoutTests/imported/w3c/resources/resource-files.json
Original file line number Diff line number Diff line change
Expand Up @@ -7239,7 +7239,9 @@
"web-platform-tests/html/rendering/widgets/appearance/appearance-transition-001-ref.html",
"web-platform-tests/html/rendering/widgets/appearance/appearance-transition-002-ref.html",
"web-platform-tests/html/rendering/widgets/button-layout/anonymous-button-content-box-ref.html",
"web-platform-tests/html/rendering/widgets/button-layout/display-none-or-contents-ref.html",
"web-platform-tests/html/rendering/widgets/button-layout/inline-level-ref.html",
"web-platform-tests/html/rendering/widgets/button-layout/input-type-button-clip-ref.html",
"web-platform-tests/html/rendering/widgets/button-layout/input-type-button-newline-2-mismatch.html",
"web-platform-tests/html/rendering/widgets/button-layout/input-type-button-newline-mismatch.html",
"web-platform-tests/html/rendering/widgets/button-layout/propagate-text-decoration-ref.html",
Expand All @@ -7249,9 +7251,11 @@
"web-platform-tests/html/rendering/widgets/input-checkbox-switch-ref.html",
"web-platform-tests/html/rendering/widgets/input-checkbox-switch-rtl-notref.html",
"web-platform-tests/html/rendering/widgets/input-date-baseline-min-height-ref.html",
"web-platform-tests/html/rendering/widgets/input-date-baseline-print.html",
"web-platform-tests/html/rendering/widgets/input-date-baseline-ref.html",
"web-platform-tests/html/rendering/widgets/input-date-content-size-ref.html",
"web-platform-tests/html/rendering/widgets/input-no-centering-ref.html",
"web-platform-tests/html/rendering/widgets/input-password-background-suppresses-appearance-ref.html",
"web-platform-tests/html/rendering/widgets/input-radio-disabled-checked-notref.html",
"web-platform-tests/html/rendering/widgets/input-time-content-size-ref.html",
"web-platform-tests/html/rendering/widgets/the-select-element/option-checked-styling-ref.html",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
features:
- name: field-sizing
files:
- field-sizing-*

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<input type="button">
<input type="submit">
<input type="color">
<input type="image">
<button></button>
</div>
<script>
Expand All @@ -33,4 +34,19 @@
}, `computed display of ${tag} with display: ${val}`);
});
}
</script>

for (let input of document.querySelectorAll("input")) {
test(() => {
if (input.type == "image") {
assert_equals(getComputedStyle(input).overflow, "visible", "Should not be clip by default");
return;
}
assert_equals(getComputedStyle(input).overflow, "clip", "Should be clip by default");
assert_equals(getComputedStyle(input).overflowClipMargin, "0px", "Should use 0 margin");
input.style.overflow = "visible";
input.style.overflowClipMargin = "10px";
assert_equals(getComputedStyle(input).overflow, "clip", "Clip be !important");
assert_equals(getComputedStyle(input).overflowClipMargin, "0px", "Clip margin should be !important too");
}, `<input type=${input.type}> overflow/overflow-clip-margin`);
}
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!DOCTYPE html>
<title>button (in button layout) with display: none/contents</title>
2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!DOCTYPE html>
<title>button (in button layout) with display: none/contents</title>
2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<title>button (in button layout) with display: none/contents</title>
<link rel=match href=display-none-or-contents-ref.html>
<link rel=help href=https://html.spec.whatwg.org/multipage/rendering.html#button-layout-2>
<style>
#none{ display: none}
#contents { display: contents; font: initial }
</style>
<!-- Button layout should not impact "display: none" or "display: contents" on button elements -->
<!-- https://github.com/whatwg/html/pull/10244 -->
<button id=none>1</button>
<button id=contents>2</button>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!doctype html>
<style>
button {
width: 10ch;
overflow: clip;
text-overflow: ellipsis;
}
</style>
<button>aaaaaaaaaaaaaaaaaaaaaa</button>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!doctype html>
<style>
button {
width: 10ch;
overflow: clip;
text-overflow: ellipsis;
}
</style>
<button>aaaaaaaaaaaaaaaaaaaaaa</button>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<meta charset="utf-8">
<title>button input is clipped by default, and text-overflow: ellipsis works</title>
<link rel="help" href="https://github.com/whatwg/html/issues/9976">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1800077">
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="author" title="Mozilla" href="https://mozilla.org">
<link rel="match" href="input-type-button-clip-ref.html">
<style>
input {
width: 10ch;
text-overflow: ellipsis;
}
</style>
<input type="button" value="aaaaaaaaaaaaaaaaaaaaaa">
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,18 @@ List of files:
/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/anonymous-button-content-box-ref.html
/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/anonymous-button-content-box.html
/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/computed-style.html
/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/display-none-or-contents-expected.html
/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/display-none-or-contents-ref.html
/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/display-none-or-contents.html
/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/display-other.html
/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/flex.html
/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/grid.html
/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/inline-level-expected.html
/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/inline-level-ref.html
/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/inline-level.html
/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/input-type-button-clip-expected.html
/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/input-type-button-clip-ref.html
/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/input-type-button-clip.html
/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/input-type-button-newline-2-expected-mismatch.html
/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/input-type-button-newline-2-mismatch.html
/LayoutTests/imported/w3c/web-platform-tests/html/rendering/widgets/button-layout/input-type-button-newline-2.html
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!doctype html>
<meta charset="utf-8">
<input type="password" style="appearance: none; background-color: blue">
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!doctype html>
<meta charset="utf-8">
<input type="password" style="appearance: none; background-color: blue">
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!doctype html>
<meta charset="utf-8">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1895561">
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="match" href="input-password-background-suppresses-appearance-ref.html">
<title>backgrounds disable native password input appearance</title>
<input type="password" style="background-color: blue">
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@


PASS A misssing attribute is equivalent to size=20
PASS An invalid attribute value is equivalent to size=20
PASS The width depends on a size attribute
PASS Size attribute value affects layout-dependent computed style
PASS Size attribute value is not a presentational hint

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<link rel="help" href="https://html.spec.whatwg.org/C/#the-input-element-as-a-text-entry-widget">
<title>Test `size` attribute behaivor</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>

<input id="missing">
<input id="invalid" size="-1">
<input id="size0" size="0">
<input id="size1" size="1">
<input id="size10" size="10">
<input id="size20" size="20">
<input id="size21" size="21">
<input id="computed" style="border:none; padding:0;" size="19">
<input id="computedNone" style="display:none" size="17">

<script>
test(() => {
assert_equals(missing.offsetWidth, size20.offsetWidth);
}, 'A misssing attribute is equivalent to size=20');

test(() => {
assert_equals(invalid.offsetWidth, size20.offsetWidth, 'size="-1"');
assert_equals(size0.offsetWidth, size20.offsetWidth, 'size="0"');
}, 'An invalid attribute value is equivalent to size=20');

test(() => {
assert_less_than(size1.offsetWidth, size10.offsetWidth, '1 < 10');
assert_less_than(size10.offsetWidth, size20.offsetWidth, '10 < 20');
assert_less_than(size20.offsetWidth, size21.offsetWidth, '20 < 21');
}, 'The width depends on a size attribute');

test(() => {
const computedString = getComputedStyle(computed).width;
assert_equals(computed.offsetWidth,
Math.round(computedString.substring(0, computedString.length - 2)));
}, 'Size attribute value affects layout-dependent computed style');

test(() => {
const computedString = getComputedStyle(computedNone).width;
assert_equals(computedString, 'auto');
}, 'Size attribute value is not a presentational hint');
</script>

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@


PASS A misssing attribute is equivalent to cols=20 rows=2
PASS An invalid attribute value is equivalent to cols=20 rows=2
PASS The width depends on a cols attribute
PASS The height depends on a rows attribute
PASS Cols/rows attribute values affect layout-dependent computed style
PASS Cols/rows attribute values are not presentational hints

Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!DOCTYPE html>
<link rel="help" href="https://html.spec.whatwg.org/C/#the-textarea-element-2">
<title>Test `cols` `rows` attributes behaivor</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>

<textarea id="missing"></textarea>
<textarea id="invalid" cols="-1" rows="-1"></textarea>
<textarea id="computed" style="border:none; padding:0;" cols="19" rows="5"></textarea>
<textarea id="computedNone" style="display:none" cols="17" rows="7"></textarea>

<textarea id="cols0" cols="0"></textarea>
<textarea id="cols1" cols="1"></textarea>
<textarea id="cols10" cols="10"></textarea>
<textarea id="cols20" cols="20"></textarea>
<textarea id="cols21" cols="21"></textarea>

<textarea id="rows0" rows="0"></textarea>
<textarea id="rows1" rows="1"></textarea>
<textarea id="rows2" rows="2"></textarea>
<textarea id="rows3" rows="3"></textarea>

<script>
test(() => {
assert_equals(missing.offsetWidth, cols20.offsetWidth);
assert_equals(missing.offsetHeight, rows2.offsetHeight);
}, 'A misssing attribute is equivalent to cols=20 rows=2');

test(() => {
assert_equals(invalid.offsetWidth, cols20.offsetWidth);
assert_equals(invalid.offsetHeight, rows2.offsetHeight);
assert_equals(cols0.offsetWidth, cols20.offsetWidth);
assert_equals(rows0.offsetHeight, rows2.offsetHeight);
}, 'An invalid attribute value is equivalent to cols=20 rows=2');

test(() => {
assert_less_than(cols1.offsetWidth, cols10.offsetWidth, '1 < 10');
assert_less_than(cols10.offsetWidth, cols20.offsetWidth, '10 < 20');
assert_less_than(cols20.offsetWidth, cols21.offsetWidth, '20 < 21');
}, 'The width depends on a cols attribute');

test(() => {
assert_less_than(rows1.offsetHeight, rows2.offsetHeight, '1 < 2');
assert_less_than(rows2.offsetHeight, rows3.offsetHeight, '2 < 3');
}, 'The height depends on a rows attribute');

test(() => {
const computedWidth = getComputedStyle(computed).width;
assert_equals(computed.offsetWidth,
parseInt(computedWidth.substring(0, computedWidth.length - 2)));

const computedHeight = getComputedStyle(computed).height;
assert_equals(computed.offsetHeight,
parseInt(computedHeight.substring(0, computedHeight.length - 2)));
}, 'Cols/rows attribute values affect layout-dependent computed style');

test(() => {
const computedNoneStyle = getComputedStyle(computedNone);
assert_equals(computedNoneStyle.width, 'auto');
assert_equals(computedNoneStyle.height, 'auto');
}, 'Cols/rows attribute values are not presentational hints');
</script>

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@


PASS rows=1 doesnt include scrollbar thickness
PASS rows=1 overflow scroll includes scrollbar thickness
PASS cols=3 includes scrollbar thickness

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<link rel="help" href="https://html.spec.whatwg.org/C/#the-textarea-element-2">
<title>Test textarea width and height accounting for scrollbars</title>
<meta name="author" title="Luke Warlow" href="mailto:lwarlow@igalia.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<textarea id="rows1" rows="1"></textarea>
<textarea id="rows1Hidden" rows="1" style="overflow-x: hidden"></textarea>
<textarea id="rows1Scroll" rows="1" style="overflow-x: scroll"></textarea>
<textarea id="cols3" cols="3"></textarea>
<textarea id="cols3Hidden" cols="3" style="overflow-y: hidden"></textarea>
<textarea id="cols3Scroll" cols="3" style="overflow-y: scroll"></textarea>
<div id="scrollableDiv" style="overflow:scroll"></div>

<script>
const scrollbarsHaveThickness = (scrollableDiv.offsetHeight != 0);
test(() => {
assert_equals(rows1.offsetWidth, rows1Hidden.offsetWidth);
assert_equals(rows1.offsetHeight, rows1Hidden.offsetHeight);
}, 'rows=1 doesnt include scrollbar thickness');

test(() => {
assert_equals(rows1.offsetWidth, rows1Scroll.offsetWidth);
if (scrollbarsHaveThickness) {
assert_less_than(rows1.offsetHeight, rows1Scroll.offsetHeight);
} else {
assert_equals(rows1.offsetHeight, rows1Scroll.offsetHeight);
}
}, 'rows=1 overflow scroll includes scrollbar thickness');

test(() => {
assert_equals(cols3.offsetWidth, cols3Scroll.offsetWidth);
if (scrollbarsHaveThickness) {
assert_greater_than(cols3.offsetWidth, cols3Hidden.offsetWidth);
} else {
assert_equals(cols3.offsetWidth, cols3Hidden.offsetWidth);
}
assert_equals(cols3.offsetHeight, cols3Scroll.offsetHeight);
assert_equals(cols3.offsetHeight, cols3Hidden.offsetHeight);
}, 'cols=3 includes scrollbar thickness');
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@


FAIL rows=1 doesnt include scrollbar thickness assert_equals: expected 146 but got 161
PASS rows=1 overflow scroll includes scrollbar thickness
FAIL cols=3 includes scrollbar thickness assert_greater_than: expected a number greater than 42 but got 42

Loading

0 comments on commit 8f9c15b

Please sign in to comment.