-
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.
Implement
field-sizing: content
minimum width for text caret
https://bugs.webkit.org/show_bug.cgi?id=269128 Reviewed by Darin Adler. Updates text control computed style to include a minimum sizing so the caret shows. * LayoutTests/fast/forms/text/text-field-sizing-caret-expected.txt: Added. * LayoutTests/fast/forms/text/text-field-sizing-caret.html: Added. * LayoutTests/fast/forms/textarea/textarea-field-sizing-caret-expected.txt: Added. * LayoutTests/fast/forms/textarea/textarea-field-sizing-caret.html: Added. * Source/WebCore/html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::adjustInnerTextStyle const): Canonical link: https://commits.webkit.org/279115@main
- Loading branch information
1 parent
45503f8
commit c2e64ba
Showing
5 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
LayoutTests/fast/forms/text/text-field-sizing-caret-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,6 @@ | ||
|
||
|
||
PASS The width of an empty text input should be same as the caret width | ||
PASS The width of an empty search input should be same as the caret width | ||
PASS The width of an empty number input should be same as the caret width | ||
|
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,33 @@ | ||
<!DOCTYPE html> | ||
<script src="../../../resources/testharness.js"></script> | ||
<script src="../../../resources/testharnessreport.js"></script> | ||
<style> | ||
input { | ||
border: none; | ||
padding: 0px; | ||
field-sizing: content; | ||
} | ||
input::-webkit-search-cancel-button { | ||
display: none; | ||
} | ||
input::-webkit-inner-spin-button { | ||
display: none; | ||
} | ||
</style> | ||
<input id="text"> | ||
<input id="search" type="search"> | ||
<input id="number" type="number"> | ||
<script> | ||
text.focus(); | ||
finalCaretRect = internals.absoluteCaretBounds(); | ||
|
||
test(() => { | ||
assert_equals(document.querySelector('#text').offsetWidth, finalCaretRect.width); | ||
}, 'The width of an empty text input should be same as the caret width'); | ||
test(() => { | ||
assert_equals(document.querySelector('#search').offsetWidth, finalCaretRect.width); | ||
}, 'The width of an empty search input should be same as the caret width'); | ||
test(() => { | ||
assert_equals(document.querySelector('#number').offsetWidth, finalCaretRect.width); | ||
}, 'The width of an empty number input should be same as the caret width'); | ||
</script> |
5 changes: 5 additions & 0 deletions
5
LayoutTests/fast/forms/textarea/textarea-field-sizing-caret-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,5 @@ | ||
|
||
|
||
PASS The width of an empty textarea should be same as the caret width | ||
PASS The height of an empty textarea should be same as the caret height in a vertical writing-mode | ||
|
22 changes: 22 additions & 0 deletions
22
LayoutTests/fast/forms/textarea/textarea-field-sizing-caret.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,22 @@ | ||
<!DOCTYPE html> | ||
<script src="../../../resources/testharness.js"></script> | ||
<script src="../../../resources/testharnessreport.js"></script> | ||
<style> | ||
textarea { | ||
border: none; | ||
padding: 0px; | ||
field-sizing: content; | ||
} | ||
</style> | ||
<textarea id="textarea"></textarea> | ||
<textarea style="writing-mode:vertical-rl"></textarea> | ||
<script> | ||
textarea.focus(); | ||
finalCaretRect = internals.absoluteCaretBounds(); | ||
test(() => { | ||
assert_equals(document.querySelector('textarea').offsetWidth, finalCaretRect.width); | ||
}, 'The width of an empty textarea should be same as the caret width'); | ||
test(() => { | ||
assert_equals(document.querySelectorAll('textarea')[1].offsetHeight, finalCaretRect.width); | ||
}, 'The height of an empty textarea should be same as the caret height in a vertical writing-mode'); | ||
</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