Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 55b5406cac968f0d51f107807530ee74708f40ea
      
https://github.com/WebKit/WebKit/commit/55b5406cac968f0d51f107807530ee74708f40ea
  Author: Alan Baradlay <[email protected]>
  Date:   2026-05-04 (Mon, 04 May 2026)

  Changed paths:
    M LayoutTests/fast/replaced/table-percent-height.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-ui/widget-percentage-height-001-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-ui/widget-percentage-height-001-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-ui/widget-percentage-height-001.html
    M LayoutTests/platform/mac/fast/replaced/table-percent-height-expected.txt
    M Source/WebCore/rendering/RenderBlock.cpp
    M Source/WebCore/rendering/RenderBlock.h
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderTheme.h
    M Source/WebCore/rendering/ios/RenderThemeIOS.h
    M Source/WebCore/rendering/ios/RenderThemeIOS.mm

  Log Message:
  -----------
  Percent height border-box content should get correct height in percent height 
cells
https://bugs.webkit.org/show_bug.cgi?id=299410

Reviewed by Antti Koivisto.

When a form control like a checkbox or radio button has height: 100% and its
containing block has auto height, the percentage cannot resolve against 
anything.
Per CSS Sizing 3, an unresolvable percentage "behaves as auto." Per CSS UI 4,
widgets (form controls with native appearance) are "laid out like replaced
elements," so auto height means their intrinsic size - not zero.

RenderReplaced already handles this correctly: it never returns nullopt for
percentage heights and falls back to intrinsicLogicalHeight() for auto. But
checkboxes and radios in WebKit are RenderBlock (not RenderReplaced), so they go
through RenderBox::computePercentageLogicalHeight, which returns nullopt when 
the
percentage cannot resolve. The caller then falls back to the content height,
which is zero for these empty blocks.

The fix has two parts:

1. Override intrinsicSize() on RenderBlock to return the theme's control size 
for
   elements with appearance.

2. In the PreferredSize overload of computePercentageLogicalHeight, fall back to
   intrinsicLogicalHeight() when the percentage cannot resolve. This gives
   RenderBlock-based form controls the same fallback behavior that 
RenderReplaced
   already has.

Tests: 
imported/w3c/web-platform-tests/css/css-ui/widget-percentage-height-001-ref.html
           
imported/w3c/web-platform-tests/css/css-ui/widget-percentage-height-001.html

* LayoutTests/fast/replaced/table-percent-height.html:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-ui/widget-percentage-height-001-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-ui/widget-percentage-height-001-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-ui/widget-percentage-height-001.html:
 Added.
* LayoutTests/platform/mac/fast/replaced/table-percent-height-expected.txt:
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::intrinsicSize const):
* Source/WebCore/rendering/RenderBlock.h:
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::computePercentageLogicalHeight const):
* Source/WebCore/rendering/RenderTheme.h:
* Source/WebCore/rendering/ios/RenderThemeIOS.h:
* Source/WebCore/rendering/ios/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::controlSize const):
  The iOS theme had no controlSize override for checkbox and radio. controlSize
  returns the intrinsic control dimensions, which RenderBlock::intrinsicSize()
  uses to provide replaced-element-like sizing for form controls.

  controlSize now returns max of font size and 16px for checkbox and radio. The
  16px matches the iOS UA stylesheet which sets width/height to 16px for these
  controls.

Canonical link: https://commits.webkit.org/312526@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to