Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 808795beeb2707eda80651a4770ee457729e316c
      
https://github.com/WebKit/WebKit/commit/808795beeb2707eda80651a4770ee457729e316c
  Author: Alan Baradlay <[email protected]>
  Date:   2026-08-12 (Wed, 12 Aug 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-with-overhanging-legend-on-a-line-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-with-overhanging-legend-on-a-line-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-with-overhanging-legend-on-a-line.html
    M Source/WebCore/layout/integration/LayoutIntegrationBoxGeometryUpdater.cpp

  Log Message:
  -----------
  [block-in-inline] A fieldset on a line takes its legend's overhang twice
https://bugs.webkit.org/show_bug.cgi?id=321504

Reviewed by Antti Koivisto.

A legend that reaches past its fieldset's border edge is carried as an 
intrinsic border, which
RenderBlock::borderBefore adds to the fieldset's border. The border box height 
the fieldset ends up with is
measured with that border in it, so RenderBox::contentBoxHeight has nothing 
left and clamps at zero.

updateLayoutBoxDimensions builds the geometry for a box on a line from both of 
those: the content box height from
the renderer, and the border from adjustBorderForTableAndFieldset, which adds 
the intrinsic border again. The
margin box the line gets is then max(0, H - BP) + BP, which is BP rather than H 
whenever the legend overhangs, so
the fieldset takes the overhang twice and its container grows by it.

The overhang belongs to the fieldset's own content: the lines inside it start 
below the legend. It says nothing
about the box a line holds, whose inner layout the render tree does. So take it 
where the fieldset is the
formatting context root and nowhere else, which leaves logicalBorder about a 
table's collapsed borders. The
content box size comes from what is left of the border box, since the 
renderer's own answer is measured against a
border that has the overhang in it. Only the fieldset's own block axis grew, 
which is the container's inline axis
when the two writing modes differ in orientation.

* 
LayoutTests/imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-with-overhanging-legend-on-a-line.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-with-overhanging-legend-on-a-line-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-with-overhanging-legend-on-a-line-expected.html:
 Added.
* Source/WebCore/layout/integration/LayoutIntegrationBoxGeometryUpdater.cpp:
(WebCore::LayoutIntegration::adjustBorderForTable):
(WebCore::LayoutIntegration::intrinsicBorder):
(WebCore::LayoutIntegration::contentLogicalWidthForRenderer):
(WebCore::LayoutIntegration::contentLogicalHeightForRenderer):
(WebCore::LayoutIntegration::BoxGeometryUpdater::updateLayoutBoxDimensions):
(WebCore::LayoutIntegration::BoxGeometryUpdater::setFormattingContextRootGeometry):
(WebCore::LayoutIntegration::BoxGeometryUpdater::formattingContextConstraints):
(WebCore::LayoutIntegration::adjustBorderForTableAndFieldset): Deleted.
(WebCore::LayoutIntegration::BoxGeometryUpdater::logicalBorder):

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



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

Reply via email to