Changeset 274411 in webkit


Ignore:
Timestamp:
Mar 15, 2021 4:27:16 AM (16 months ago)
Author:
svillar@igalia.com
Message:

Do not shrink radio buttons bellow its size
https://bugs.webkit.org/show_bug.cgi?id=215575

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

  • web-platform-tests/css/css-flexbox/radiobutton-min-size-expected.txt: Replaced FAIL by PASS expectations.

Source/WebCore:

A radio button used as a flex item would be invisible by default because it'll compute is
min-size to 0. That's why we should not let them shrink below their size (width/height).

  • platform/Theme.cpp:

(WebCore::Theme::minimumControlSize const): Do not let Radio buttons shrink bellow their size.

  • platform/Theme.h: make minimumControlSize() protected. Add a new non-virtual method with the same parameter

plus another one (the minimum size under which we cannot shrink) which calls the virtual method.

  • rendering/RenderTheme.cpp:

(WebCore::RenderTheme::adjustStyle): Pass the {style.width(),style.height()} as the minimum size under which
we should not shrink the control.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r274408 r274411  
     12021-03-10  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        Do not shrink radio buttons bellow its size
     4        https://bugs.webkit.org/show_bug.cgi?id=215575
     5
     6        Reviewed by Darin Adler.
     7
     8        * web-platform-tests/css/css-flexbox/radiobutton-min-size-expected.txt: Replaced FAIL by PASS expectations.
     9
    1102021-03-14  Sam Weinig  <weinig@apple.com>
    211
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/radiobutton-min-size-expected.txt

    r272795 r274411  
    55Text
    66
    7 FAIL two radio button widths are identical assert_equals: width should be equal expected 0 but got 12
     7PASS two radio button widths are identical
    88
  • trunk/Source/WebCore/ChangeLog

    r274410 r274411  
     12021-03-10  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        Do not shrink radio buttons bellow its size
     4        https://bugs.webkit.org/show_bug.cgi?id=215575
     5
     6        Reviewed by Darin Adler.
     7
     8        A radio button used as a flex item would be invisible by default because it'll compute is
     9        min-size to 0. That's why we should not let them shrink below their size (width/height).
     10
     11        * platform/Theme.cpp:
     12        (WebCore::Theme::minimumControlSize const): Do not let Radio buttons shrink bellow their size.
     13        * platform/Theme.h: make minimumControlSize() protected. Add a new non-virtual method with the same parameter
     14        plus another one (the minimum size under which we cannot shrink) which calls the virtual method.
     15        * rendering/RenderTheme.cpp:
     16        (WebCore::RenderTheme::adjustStyle): Pass the {style.width(),style.height()} as the minimum size under which
     17        we should not shrink the control.
     18
    1192021-03-15  Kimmo Kinnunen  <kkinnunen@apple.com>
    220
  • trunk/Source/WebCore/platform/Theme.cpp

    r272805 r274411  
    4747{
    4848    return zoomedSize;
     49}
     50
     51LengthSize Theme::minimumControlSize(ControlPart part, const FontCascade& fontCascade, const LengthSize& zoomedSize, const LengthSize& nonShrinkableZoomedSize, float zoom) const
     52{
     53    auto minSize = minimumControlSize(part, fontCascade, zoomedSize, zoom);
     54    if (part == ControlPart::RadioPart) {
     55        if (zoomedSize.width.isIntrinsicOrAuto())
     56            minSize.width = nonShrinkableZoomedSize.width;
     57        if (zoomedSize.height.isIntrinsicOrAuto())
     58            minSize.height = nonShrinkableZoomedSize.height;
     59    }
     60    return minSize;
    4961}
    5062
  • trunk/Source/WebCore/platform/Theme.h

    r270823 r274411  
    5858
    5959    // Returns the minimum size for a control in zoomed coordinates.
    60     virtual LengthSize minimumControlSize(ControlPart, const FontCascade&, const LengthSize& zoomedSize, float zoomFactor) const;
     60    LengthSize minimumControlSize(ControlPart, const FontCascade&, const LengthSize& zoomedSize, const LengthSize& nonShrinkableZoomedSize, float zoomFactor) const;
    6161   
    6262    // Allows the theme to modify the existing padding/border.
     
    8585    virtual ~Theme() = default;
    8686
     87    virtual LengthSize minimumControlSize(ControlPart, const FontCascade&, const LengthSize& zoomedSize, float zoomFactor) const;
     88
    8789private:
    8890    Theme(const Theme&) = delete;
  • trunk/Source/WebCore/rendering/RenderTheme.cpp

    r274232 r274411  
    169169
    170170        // Min-Width / Min-Height
    171         LengthSize minControlSize = Theme::singleton().minimumControlSize(part, style.fontCascade(), { style.minWidth(), style.minHeight() }, style.effectiveZoom());
     171        LengthSize minControlSize = Theme::singleton().minimumControlSize(part, style.fontCascade(), { style.minWidth(), style.minHeight() }, { style.width(), style.height() }, style.effectiveZoom());
    172172        if (minControlSize.width != style.minWidth())
    173173            style.setMinWidth(WTFMove(minControlSize.width));
Note: See TracChangeset for help on using the changeset viewer.