layout: Add very basic support for showing text in input boxes (#32365)

This only paints text in input fields. Selection and cursor are still
not painted.

In addition to adding this feature, the change also updates the
user-agent.css with the latest from the HTML specification. Extra
padding and extraneous settings (such as a bogus line-height and
min-height) are also removed from servo.css. This leads to some new
passes.

There are some new passes, this introduces failures as inserting text
reveals issues that were hidden before. Notably:

- failures in `/html/editing/editing-0/spelling-and-grammar-checking/`:
  We do not support spell-checking.
- Most of the rest of the new failures are missing features of input
  boxes that are also missing in legacy layout.
This commit is contained in:
Martin Robinson 2024-06-20 12:13:50 +02:00 committed by GitHub
parent 3d6accbbe3
commit 44064b1439
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
65 changed files with 225 additions and 204 deletions

View file

@ -0,0 +1,2 @@
[text-transform-bicameral-018.xht]
expected: FAIL

View file

@ -7,12 +7,3 @@
[.target > * 5]
expected: FAIL
[.target > * 7]
expected: FAIL
[.target > * 9]
expected: FAIL
[.target > * 11]
expected: FAIL

View file

@ -1,9 +0,0 @@
[baseline-source-last-textarea-001.tentative.html]
[.target > * 7]
expected: FAIL
[.target > * 9]
expected: FAIL
[.target > * 11]
expected: FAIL

View file

@ -1,4 +0,0 @@
[transform-input-001.html]
type: reftest
bug: https://github.com/servo/servo/issues/21092
expected: FAIL

View file

@ -1,4 +0,0 @@
[transform-input-002.html]
type: reftest
bug: https://github.com/servo/servo/issues/21092
expected: FAIL

View file

@ -1,4 +0,0 @@
[transform-input-003.html]
type: reftest
bug: https://github.com/servo/servo/issues/21092
expected: FAIL

View file

@ -1,4 +0,0 @@
[transform-input-004.html]
type: reftest
bug: https://github.com/servo/servo/issues/21092
expected: FAIL

View file

@ -1,4 +0,0 @@
[transform-input-005.html]
type: reftest
bug: https://github.com/servo/servo/issues/21092
expected: FAIL

View file

@ -1,4 +0,0 @@
[transform-input-006.html]
type: reftest
bug: https://github.com/servo/servo/issues/21092
expected: FAIL

View file

@ -1,3 +0,0 @@
[transform-input-007.html]
bug: https://github.com/servo/servo/issues/21092
expected: FAIL

View file

@ -1,4 +0,0 @@
[transform-input-008.html]
type: reftest
bug: https://github.com/servo/servo/issues/21092
expected: FAIL

View file

@ -1,3 +0,0 @@
[transform-input-010.html]
bug: https://github.com/servo/servo/issues/21092
expected: FAIL

View file

@ -1,3 +0,0 @@
[transform-input-012.html]
bug: https://github.com/servo/servo/issues/21092
expected: FAIL

View file

@ -1,4 +0,0 @@
[transform-input-013.html]
type: reftest
bug: https://github.com/servo/servo/issues/21092
expected: FAIL

View file

@ -1,4 +0,0 @@
[transform-input-014.html]
type: reftest
bug: https://github.com/servo/servo/issues/21092
expected: FAIL

View file

@ -1,4 +0,0 @@
[transform-input-015.html]
type: reftest
bug: https://github.com/servo/servo/issues/21092
expected: FAIL

View file

@ -1,4 +0,0 @@
[transform-input-016.html]
type: reftest
bug: https://github.com/servo/servo/issues/21092
expected: FAIL

View file

@ -1,5 +1,4 @@
[transform-input-018.html]
type: reftest
bug: https://github.com/servo/servo/issues/21092
expected:
if os == "mac": FAIL
expected: FAIL

View file

@ -1,4 +0,0 @@
[transform-input-019.html]
type: reftest
bug: https://github.com/servo/servo/issues/21092
expected: FAIL

View file

@ -0,0 +1,2 @@
[appearance-textfield-001.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[webkit-appearance-textfield-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[textarea-padding-bend-overlaps-content-001.tentative.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[textarea-padding-bstart-moves-content-001.tentative.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[input-checkbox-switch-indeterminate.tentative.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[range-tick-marks-02.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[selectlist-button-type-appearance.tentative.html]
expected: FAIL

View file

@ -1,34 +1,6 @@
[flex-item-compressible-001.html]
[.flexbox 14]
expected: FAIL
[.flexbox 15]
expected: FAIL
[.flexbox 12]
expected: FAIL
[.flexbox 13]
expected: FAIL
[.flexbox 10]
expected: FAIL
[.flexbox 11]
expected: FAIL
[.flexbox 4]
expected: FAIL
[.flexbox 5]
expected: FAIL
[.flexbox 3]
expected: FAIL
[.flexbox 8]
expected: FAIL
[.flexbox 9]
expected: FAIL

View file

@ -1,15 +1,9 @@
[baseline-source-first-textarea-001.tentative.html]
[.target > * 9]
expected: FAIL
[.target > * 1]
expected: FAIL
[.target > * 5]
expected: FAIL
[.target > * 7]
expected: FAIL
[.target > * 9]
expected: FAIL
[.target > * 11]
expected: FAIL

View file

@ -1,9 +0,0 @@
[baseline-source-last-textarea-001.tentative.html]
[.target > * 7]
expected: FAIL
[.target > * 9]
expected: FAIL
[.target > * 11]
expected: FAIL

View file

@ -0,0 +1,2 @@
[input-scrollable-region-001.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[scrollable-overflow-input-001.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[scrollable-overflow-input-002.html]
expected: FAIL

View file

@ -19,3 +19,15 @@
[Replaced elements outside a table cannot be table-row-group and are considered inline -- input=file elements]
expected: FAIL
[Replaced elements outside a table cannot be table-row and are considered inline -- input=text elements]
expected: FAIL
[Replaced elements outside a table cannot be table-row and are considered inline -- input=button elements]
expected: FAIL
[Replaced elements outside a table cannot be table-row-group and are considered inline -- input=text elements]
expected: FAIL
[Replaced elements outside a table cannot be table-row-group and are considered inline -- input=button elements]
expected: FAIL

View file

@ -1,2 +0,0 @@
[transform-input-002.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[appearance-textfield-001.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[input-security-none-sensitive-text-input.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[webkit-appearance-textfield-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[spelling-markers-009.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[spelling-markers-010.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[text-transform.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[textarea-padding-bend-overlaps-content-001.tentative.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[textarea-padding-bstart-moves-content-001.tentative.html]
expected: FAIL

View file

@ -316,3 +316,21 @@
[<input type="button" value="x" style="overflow: scroll; appearance: none;">]
expected: FAIL
[<input type="range" style="overflow: visible; appearance: auto;">]
expected: FAIL
[<input type="range" style="overflow: visible; appearance: none;">]
expected: FAIL
[<input type="color" value="#000000" style="overflow: visible; appearance: auto;">]
expected: FAIL
[<input type="color" value="#000000" style="overflow: visible; appearance: none;">]
expected: FAIL
[<input type="image" src="data:(png)" alt="x" style="overflow: visible; appearance: auto;">]
expected: FAIL
[<input type="image" src="data:(png)" alt="x" style="overflow: visible; appearance: none;">]
expected: FAIL

View file

@ -7,6 +7,3 @@
[align-items:stretch should work]
expected: FAIL
[align-items:flex-start should work]
expected: FAIL

View file

@ -1,2 +0,0 @@
[input-type-button-newline-2.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[input-type-button-newline.html]
expected: FAIL

View file

@ -8,9 +8,6 @@
[number: Explicit height and auto width]
expected: FAIL
[number: Text caret is taller than the placeholder]
expected: FAIL
[number: Text caret is shorter than the placeholder]
expected: FAIL

View file

@ -0,0 +1,2 @@
[input-checkbox-switch-rtl.tentative.html]
expected: FAIL

View file

@ -1,3 +0,0 @@
[selection.html]
[test scrollLeft preservation for input]
expected: FAIL

View file

@ -1,3 +0,0 @@
[input-type-button.html]
[label value]
expected: FAIL

View file

@ -3473,7 +3473,7 @@
]
],
"input_line_height.html": [
"1de07c88ae2092e2e9885d30e2001e9fe09ca8b3",
"f1c1d742000a6c4c11d40806e07aeba502141368",
[
null,
[
@ -6547,7 +6547,7 @@
]
],
"textarea_space_calculation.html": [
"20945e971b543cbc11741863314ccf3595654e80",
"ee5ea7b1c01f5a11188bc50eca3a60ea2c15edf2",
[
null,
[
@ -9115,7 +9115,7 @@
[]
],
"input_line_height_ref.html": [
"16d4fd99712bd1d21cc8320f2e273a867f3fb807",
"f29e061cc35625fa039473e702f78dbc5a7d9c14",
[]
],
"input_placeholder_ref.html": [
@ -10073,7 +10073,7 @@
[]
],
"textarea_space_calculation-ref.html": [
"b777beb062b67a51c1efdfe4afa55568fd3724e6",
"56abdf23c8f88a9f236d54ef798734becc372027",
[]
],
"transform_3d_from_outside_viewport_ref.html": [

View file

@ -1,2 +0,0 @@
[button_css_width.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[submit_focus_a.html]
expected: FAIL

View file

@ -7,6 +7,7 @@
<body>
<div style="line-height: 100px">
<input type="text"></input>
<input type="text"></input>
</div>
</body>
</html>

View file

@ -5,7 +5,10 @@
</head>
<body>
<div style="line-height: 100px">
<input type="text" style="line-height: 1.8"></input>
<!-- https://html.spec.whatwg.org/multipage/#form-controls defines `line-height` for form
controls to be `initial` ie `normal`. -->
<input type="text" style="line-height: initial;"></input>
<input type="text" style="line-height: normal;"></input>
</div>
</body>
</html>

View file

@ -1,8 +1,18 @@
<!doctype html>
<title>REFERENCE: textarea does not take up more space than it takes up</title>
<style>
textarea{height:2em;width:2em}
div{width:2em;font-size:12px;line-height:3px}
textarea {
height:2em;
width:2em;
/* `em` units are based on font size, so this size
has to be the same as the font size in the div. */
font-size:12px;
}
div {
width: 2em;
font-size: 12px;
line-height: 3px
}
</style>
<h1>To pass, no red should be visible</h1>
<div>

View file

@ -3,8 +3,19 @@
<title>textarea does not take up more space than it takes up</title>
<link rel="match" href="textarea_space_calculation-ref.html">
<style>
textarea{height:2em;width:2em}
div{background:red;width:2em;font-size:12px;line-height:3px}
textarea {
height:2em;
width:2em;
/* `em` units are based on font size, so this size
has to be the same as the font size in the div. */
font-size:12px;
}
div {
background: red;
width: 2em;
font-size: 12px;
line-height: 3px
}
</style>
<h1>To pass, no red should be visible</h1>
<div>