Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add nowrap white-space to UA Stylesheet for option element
https://bugs.webkit.org/show_bug.cgi?id=257477

Reviewed by Tim Nguyen.

This patch aligns WebKit with Blink / Chromium and Gecko / Firefox.

Merge: https://chromium.googlesource.com/chromium/src/+/bcb42ec47ad8a9a6726e1e12e112838c4dfe3142

When the option element is rendered, neither spaces nor line breaks are
preserved in the text, so `nowrap` makes more sense.

* Source/WebCore/css/html.css: As above
* LayoutTests/fast/forms/select/options-default-white-space.html: Add Test Case
* LayoutTests/fast/forms/select/options-default-white-space-expected.txt: Add Test Case Expectation

Canonical link: https://commits.webkit.org/264691@main
  • Loading branch information
Ahmad-S792 authored and Ahmad Saleem committed May 30, 2023
1 parent 003e0fd commit 574b3a2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
@@ -0,0 +1,4 @@


PASS <option>'s user agent 'white-space' should be 'nowrap'.

13 changes: 13 additions & 0 deletions LayoutTests/fast/forms/select/options-default-white-space.html
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<select>
<option id=option value="hello">Hello</option>
</select>
<script>
test(() => {
assert_equals(
window.getComputedStyle(option)['white-space'],
'nowrap');
}, `<option>'s user agent 'white-space' should be 'nowrap'.`);
</script>
1 change: 1 addition & 0 deletions Source/WebCore/css/html.css
Expand Up @@ -1111,6 +1111,7 @@ optgroup {

option {
font-weight: normal;
white-space: nowrap;
}

output {
Expand Down

0 comments on commit 574b3a2

Please sign in to comment.