⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 271218 in webkit


Ignore:
Timestamp:
Jan 6, 2021, 3:45:44 PM (6 years ago)
Author:
Aditya Keerthi
Message:

[macOS] Text inside form controls is off center on burton.com
https://bugs.webkit.org/show_bug.cgi?id=220376
<rdar://problem/72833977>

Reviewed by Devin Rousso.

Source/WebCore:

<select> elements on burton.com specify an empty size attribute. This
results in the "select:matches([size], [multiple]), select[size][multiple]"
ruleset being applied, which adds the rule "align-items: flex-start". That
rules causes the text within the element to be aligned to the top.

This rule is necessary for <select multiple> and <select> elements with
a size attribute greater than or equal to 2, which both have a listbox
appearance (a popup menu is not shown when clicking the element).
However, <select> elements with a size attribute less than or equal to 1
have a menulist appearance and display a popup when clicked.

<select size> also displays a popup when clicked, and like other browsers
it should have vertically centered text. WebKit already has an additional
ruleset for size="0" and size="1" to preserve the menulist appearance.
Consequently, we can augment the ruleset to include size="", removing the
"align-items: flex-start" rule for <select size> and ensuring the text is
vertically centered.

Test: fast/forms/select-empty-size.html

  • css/html.css:

(select:is([size], [multiple]), select[size][multiple]):

Update ruleset to use :is(), instead of the obsolete :matches().

(select:is([size=""], [size="0"], [size="1"])):

Add [size=""] to the list of matching attributes, since <select size>
should not have a listbox appearance. The new appearance matches
Chrome and Firefox.

LayoutTests:

Added a test to verify that the appearance of a <select> element with
an empty size attribute is the same as one without a size attribute.

  • fast/forms/select-empty-size-expected.html: Added.
  • fast/forms/select-empty-size.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r271209 r271218  
     12021-01-06  Aditya Keerthi  <akeerthi@apple.com>
     2
     3        [macOS] Text inside form controls is off center on burton.com
     4        https://bugs.webkit.org/show_bug.cgi?id=220376
     5        <rdar://problem/72833977>
     6
     7        Reviewed by Devin Rousso.
     8
     9        Added a test to verify that the appearance of a <select> element with
     10        an empty size attribute is the same as one without a size attribute.
     11
     12        * fast/forms/select-empty-size-expected.html: Added.
     13        * fast/forms/select-empty-size.html: Added.
     14
    1152021-01-06  Ryan Haddad  <ryanhaddad@apple.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r271216 r271218  
     12021-01-06  Aditya Keerthi  <akeerthi@apple.com>
     2
     3        [macOS] Text inside form controls is off center on burton.com
     4        https://bugs.webkit.org/show_bug.cgi?id=220376
     5        <rdar://problem/72833977>
     6
     7        Reviewed by Devin Rousso.
     8
     9        <select> elements on burton.com specify an empty size attribute. This
     10        results in the "select:matches([size], [multiple]), select[size][multiple]"
     11        ruleset being applied, which adds the rule "align-items: flex-start". That
     12        rules causes the text within the element to be aligned to the top.
     13
     14        This rule is necessary for <select multiple> and <select> elements with
     15        a size attribute greater than or equal to 2, which both have a listbox
     16        appearance (a popup menu is not shown when clicking the element).
     17        However, <select> elements with a size attribute less than or equal to 1
     18        have a menulist appearance and display a popup when clicked.
     19
     20        <select size> also displays a popup when clicked, and like other browsers
     21        it should have vertically centered text. WebKit already has an additional
     22        ruleset for size="0" and size="1" to preserve the menulist appearance.
     23        Consequently, we can augment the ruleset to include size="", removing the
     24        "align-items: flex-start" rule for <select size> and ensuring the text is
     25        vertically centered.
     26
     27        Test: fast/forms/select-empty-size.html
     28
     29        * css/html.css:
     30        (select:is([size], [multiple]), select[size][multiple]):
     31
     32        Update ruleset to use :is(), instead of the obsolete :matches().
     33
     34        (select:is([size=""], [size="0"], [size="1"])):
     35
     36        Add [size=""] to the list of matching attributes, since <select size>
     37        should not have a listbox appearance. The new appearance matches
     38        Chrome and Firefox.
     39
    1402021-01-06  Devin Rousso  <drousso@apple.com>
    241
  • trunk/Source/WebCore/css/html.css

    r270784 r271218  
    10071007
    10081008#if !(defined(WTF_PLATFORM_IOS_FAMILY) && WTF_PLATFORM_IOS_FAMILY)
    1009 select:matches([size], [multiple]), select[size][multiple] {
     1009select:is([size], [multiple]), select[size][multiple] {
    10101010    -webkit-appearance: listbox;
    10111011    align-items: flex-start;
     
    10151015}
    10161016
    1017 select:matches([size="0"], [size="1"]) {
     1017select:is([size=""], [size="0"], [size="1"]) {
    10181018    -webkit-appearance: menulist;
    10191019    align-items: center;
Note: See TracChangeset for help on using the changeset viewer.