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

Changeset 287753 in webkit


Ignore:
Timestamp:
Jan 7, 2022, 9:32:52 AM (5 years ago)
Author:
Aditya Keerthi
Message:

Checkboxes on PurpleAir map controls are much smaller in Safari than other browsers
https://bugs.webkit.org/show_bug.cgi?id=234897
rdar://83367191

Reviewed by Darin Adler.

Source/WebCore:

Unlike other browser engines, WebKit adjusts the size of checkboxes and
radio buttons based on the font-size of the element, when the size is
unspecified. The checkboxes on PurpleAir have a font-size of 9px, which
results in WebKit painting a checkbox using NSControlSizeMini (with a
length of 10px). In constrast, Chrome and Firefox simply use their
default sizes (13px and 12.6px respectively).

To fix, remove the font-size adjustments for checkboxes and radio
buttons with an unspecified size, and use the current effective
default of NSControlSizeSmall (with a length of 12px) to paint the
controls.

This ensures our unspecified sizing behavior matches other browsers.
There may be some risk for other WebKit clients that currently rely
on font-size getting them their desired size. However, this risk is
believed to be minimal given the sizes of these controls are already
restricted to a 10 - 16px range.

Test: fast/forms/checkbox-radio-font-size.html

  • platform/mac/ThemeMac.mm:

(WebCore::checkboxSize):
(WebCore::radioSize):
(WebCore::ThemeMac::controlSize const):

LayoutTests:

  • fast/forms/checkbox-radio-font-size-expected.html: Added.
  • fast/forms/checkbox-radio-font-size.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r287752 r287753  
     12022-01-07  Aditya Keerthi  <akeerthi@apple.com>
     2
     3        Checkboxes on PurpleAir map controls are much smaller in Safari than other browsers
     4        https://bugs.webkit.org/show_bug.cgi?id=234897
     5        rdar://83367191
     6
     7        Reviewed by Darin Adler.
     8
     9        * fast/forms/checkbox-radio-font-size-expected.html: Added.
     10        * fast/forms/checkbox-radio-font-size.html: Added.
     11
    1122022-01-07  Diego Pino Garcia  <dpino@igalia.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r287744 r287753  
     12022-01-07  Aditya Keerthi  <akeerthi@apple.com>
     2
     3        Checkboxes on PurpleAir map controls are much smaller in Safari than other browsers
     4        https://bugs.webkit.org/show_bug.cgi?id=234897
     5        rdar://83367191
     6
     7        Reviewed by Darin Adler.
     8
     9        Unlike other browser engines, WebKit adjusts the size of checkboxes and
     10        radio buttons based on the font-size of the element, when the size is
     11        unspecified. The checkboxes on PurpleAir have a font-size of 9px, which
     12        results in WebKit painting a checkbox using NSControlSizeMini (with a
     13        length of 10px). In constrast, Chrome and Firefox simply use their
     14        default sizes (13px and 12.6px respectively).
     15
     16        To fix, remove the font-size adjustments for checkboxes and radio
     17        buttons with an unspecified size, and use the current effective
     18        default of NSControlSizeSmall (with a length of 12px) to paint the
     19        controls.
     20
     21        This ensures our unspecified sizing behavior matches other browsers.
     22        There may be some risk for other WebKit clients that currently rely
     23        on font-size getting them their desired size. However, this risk is
     24        believed to be minimal given the sizes of these controls are already
     25        restricted to a 10 - 16px range.
     26
     27        Test: fast/forms/checkbox-radio-font-size.html
     28
     29        * platform/mac/ThemeMac.mm:
     30        (WebCore::checkboxSize):
     31        (WebCore::radioSize):
     32        (WebCore::ThemeMac::controlSize const):
     33
    1342022-01-07  Alan Bujtas  <zalan@apple.com>
    235
  • trunk/Source/WebCore/platform/mac/ThemeMac.mm

    r287697 r287753  
    282282}
    283283
    284 static LengthSize checkboxSize(const FontCascade& font, const LengthSize& zoomedSize, float zoomFactor)
     284static LengthSize checkboxSize(const LengthSize& zoomedSize, float zoomFactor)
    285285{
    286286    // If the width and height are both specified, then we have nothing to do.
     
    288288        return zoomedSize;
    289289
    290     // Use the font size to determine the intrinsic width of the control.
    291     return sizeFromFont(font, zoomedSize, zoomFactor, checkboxSizes());
     290    return sizeFromNSControlSize(NSControlSizeSmall, zoomedSize, zoomFactor, checkboxSizes());
    292291}
    293292
     
    323322}
    324323
    325 static LengthSize radioSize(const FontCascade& font, const LengthSize& zoomedSize, float zoomFactor)
     324static LengthSize radioSize(const LengthSize& zoomedSize, float zoomFactor)
    326325{
    327326    // If the width and height are both specified, then we have nothing to do.
     
    329328        return zoomedSize;
    330329
    331     // Use the font size to determine the intrinsic width of the control.
    332     return sizeFromFont(font, zoomedSize, zoomFactor, radioSizes());
     330    return sizeFromNSControlSize(NSControlSizeSmall, zoomedSize, zoomFactor, radioSizes());
    333331}
    334332   
     
    823821    switch (part) {
    824822    case CheckboxPart:
    825         return checkboxSize(font, zoomedSize, zoomFactor);
     823        return checkboxSize(zoomedSize, zoomFactor);
    826824    case RadioPart:
    827         return radioSize(font, zoomedSize, zoomFactor);
     825        return radioSize(zoomedSize, zoomFactor);
    828826    case PushButtonPart:
    829827        // Height is reset to auto so that specified heights can be ignored.
Note: See TracChangeset for help on using the changeset viewer.