Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7b75575a866d7778c80c60cdbb76b58ee0eed5d6
      
https://github.com/WebKit/WebKit/commit/7b75575a866d7778c80c60cdbb76b58ee0eed5d6
  Author: Alan Baradlay <[email protected]>
  Date:   2026-07-23 (Thu, 23 Jul 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/css3/flexbox/flex-flow-margins-auto-size-expected.txt
    A 
LayoutTests/fast/writing-mode/orthogonal-block-child-max-content-width-expected.txt
    A 
LayoutTests/fast/writing-mode/orthogonal-block-child-max-content-width.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001a-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001b-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001c-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001d-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001e-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001f-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001g-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001h-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001i-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001j-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001k-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001l-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001m-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001n-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001o-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001p-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001q-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001r-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001s-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001t-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001u-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001v-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001w-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001x-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/padding-percent-orthogonal-dynamic-expected.txt
    M 
LayoutTests/platform/glib/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.txt
    M 
LayoutTests/platform/ios/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.txt
    M 
LayoutTests/platform/mac/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.txt
    M Source/WebCore/page/LocalFrameViewLayoutContext.cpp
    M Source/WebCore/page/LocalFrameViewLayoutContext.h
    M Source/WebCore/rendering/RenderBlock.cpp
    M Source/WebCore/rendering/RenderBlockFlow.cpp
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderBox.h
    M Source/WebCore/rendering/RenderFlexibleBox.cpp
    M Source/WebCore/rendering/RenderLayoutState.cpp
    M Source/WebCore/rendering/RenderLayoutState.h

  Log Message:
  -----------
  [css-writing-modes] Incorrect intrinsic width contribution for orthogonal 
block children in block layout
https://bugs.webkit.org/show_bug.cgi?id=319639

Reviewed by Antti Koivisto.

    <div style="width: max-content">
        <div style="writing-mode: vertical-lr">foobar</div>
    </div>

The max-content width should shrink-wrap to the vertical child's block-axis
size (the height of one line of "foobar"). Instead the outer block collapsed to
zero width.

When a block container gathers the intrinsic inline-size contribution of an
orthogonal child, that contribution is the child's block-axis size (its logical
height), which is only knowable by laying the child out. RenderFlexibleBox and
RenderTableCell already lay out orthogonal children for this, but block layout
had no equivalent path: it returned only the child's border+padding estimate for
a not-yet-laid-out orthogonal child, so the contribution was ~0.

Add RenderBox::computeIntrinsicLogicalHeight(), which computes a box's 
block-axis
intrinsic size, laying the box out when a content-based height is needed and
re-arming its dirty bit so the regular layout pass runs again afterwards. A
container gathering the inline-axis contribution of an orthogonal child calls
this directly: the caller decides, based on the writing-mode relationship,
whether it needs the child's width (computeChildIntrinsicLogicalWidths, now
strictly width-only) or its height. Because the probe only runs on
already-dirty children, re-arming leaves the tree's dirty state unchanged; the
real pass reuses the probe's result when the child's used width is unchanged, or
cascades a relayout via recomputeLogicalWidth() when it changes.

While being measured, the child's own min/max block-size follows the
intrinsic-size rules of CSS Sizing 3 section 5.1 (a cyclic-percentage max-size
resolves as none; a cyclic-percentage min-size resolves with the percentage part
as zero) rather than against the not-yet-known container. The layout context
tracks the box being measured, and RenderBox::computeLogicalHeight passes
IsComputingIntrinsicSize to constrainLogicalHeightByMinMax for it.

Moving the block-size computation onto RenderBox also corrects the aspect-ratio
branch, which previously fed the container's aspect-ratio/replaced-ness into the
child's blockSizeFromAspectRatio() call; it now uses the child's own.

(See https://drafts.csswg.org/css-writing-modes/#orthogonal-flows and
https://drafts.csswg.org/css-sizing-3/#intrinsic-contribution)

* Source/WebCore/rendering/RenderBox.h:
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::computeIntrinsicLogicalHeight): Added. Computes the box's
block-axis intrinsic size, laying it out under an intrinsic-size scope when a
content-based height is needed, then re-arming its dirty bit.
(WebCore::RenderBox::computeLogicalHeight const): Resolve the box's own min/max
block-size per CSS Sizing 3 section 5.1 while it is being measured for its
intrinsic size contribution.
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeBlockIntrinsicLogicalWidths const): Dispatch an
orthogonal child to computeIntrinsicLogicalHeight().
(WebCore::RenderBlock::computeChildIntrinsicLogicalWidths const): Now strictly
computes the child's logical widths; asserts the child is not orthogonal.
(WebCore::RenderBlock::computeIntrinsicLogicalWidthsForFieldsetLegend const):
Dispatch an orthogonal legend to computeIntrinsicLogicalHeight().
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::computeInlineIntrinsicLogicalWidths const): Dispatch
(WebCore::RenderBlockFlow::layoutBlock):
orthogonal ruby-annotation, block-level and atomic-inline/float children to
computeIntrinsicLogicalHeight().
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computeIntrinsicLogicalWidths const): Dispatch an
orthogonal flex item to computeIntrinsicLogicalHeight().
* Source/WebCore/page/LocalFrameViewLayoutContext.h:
* Source/WebCore/page/LocalFrameViewLayoutContext.cpp:
(WebCore::LocalFrameViewLayoutContext::beginIntrinsicLogicalHeightComputationFor):
(WebCore::LocalFrameViewLayoutContext::endIntrinsicLogicalHeightComputationFor):
(WebCore::LocalFrameViewLayoutContext::isComputingIntrinsicLogicalHeightFor 
const):
(WebCore::LocalFrameViewLayoutContext::addIntrinsicLogicalHeightComputationFor):
(WebCore::LocalFrameViewLayoutContext::removeIntrinsicLogicalHeightComputationFor):
Track the box currently being laid out for an intrinsic-size measurement.
* LayoutTests/fast/writing-mode/orthogonal-block-child-max-content-width.html: 
Added.
* 
LayoutTests/fast/writing-mode/orthogonal-block-child-max-content-width-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001-expected.txt:
Rebaseline: all subtests now pass.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/padding-percent-orthogonal-dynamic-expected.txt:
Rebaseline: first subtest now passes (dynamic re-layout subtest still fails).
* 
LayoutTests/platform/mac/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.txt:
* 
LayoutTests/platform/ios/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.txt:
* 
LayoutTests/platform/glib/fast/table/border-collapsing/border-collapsing-head-foot-vertical-expected.txt:
Rebaseline (mac, ios, glib): orthogonal nested-table cells now size to their 
content.
* LayoutTests/TestExpectations: Unmark the now-passing orthogonal-flows tests
(float-in-htb-in-vrl, nested-orthogonal-001, 
two/three-levels-of-orthogonal-flows).
* LayoutTests/css3/flexbox/flex-flow-margins-auto-size-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001a-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001b-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001c-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001d-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001e-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001f-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001g-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001h-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001i-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001j-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001k-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001l-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001m-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001n-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001o-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001p-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001q-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001r-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001s-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001t-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001u-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001v-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001w-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/orthogonal-parent-shrink-to-fit-001x-expected.txt:
* Source/WebCore/rendering/RenderLayoutState.cpp:
(WebCore::IntrinsicLogicalHeightComputationScope::IntrinsicLogicalHeightComputationScope):
(WebCore::IntrinsicLogicalHeightComputationScope::~IntrinsicLogicalHeightComputationScope):
* Source/WebCore/rendering/RenderLayoutState.h:

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



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

Reply via email to