Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 999b6ea5d83a8c26e38887168ad2b4a354efffe3
      
https://github.com/WebKit/WebKit/commit/999b6ea5d83a8c26e38887168ad2b4a354efffe3
  Author: Sammy Gill <[email protected]>
  Date:   2026-05-17 (Sun, 17 May 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/shrink-to-fit-overflow-auto-scrollbar-width-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/shrink-to-fit-overflow-auto-scrollbar-width.html
    M 
LayoutTests/platform/glib/scrollbars/scrollbars-on-positioned-content-expected.txt
    M 
LayoutTests/platform/mac/scrollbars/scrollbars-on-positioned-content-expected.txt
    M 
LayoutTests/platform/win/scrollbars/scrollbars-on-positioned-content-expected.txt
    M Source/WebCore/rendering/RelayoutScopeForScrollbarChange.cpp
    M Source/WebCore/rendering/RenderBlock.cpp
    M Source/WebCore/rendering/RenderBlock.h
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/SubtreeScrollbarChangesState.cpp

  Log Message:
  -----------
  Shrink-to-fit boxes with do not update their width when a scrollbar is added 
mid-layout.
https://bugs.webkit.org/show_bug.cgi?id=314898
rdar://problem/177172896

Reviewed by Alan Baradlay.

When a block sized to fit its content (float, inline-block, out-of-flow with
auto insets, or intrinsic-keyword width) has overflow:auto and its content
overflows, a scrollbar is added mid-layout via updateScrollInfoAfterLayout.
The subsequent self-relayout in RelayoutScopeForScrollbarChange was calling
layoutBlock(RelayoutChildren::Yes) without invalidating preferred widths, so
maxPreferredLogicalWidth() returned its cached value (without the scrollbar
gutter). As a result the block kept the narrower pre-scrollbar width and
its content ended up with a horizontal scrollbar that shrunk the space
for the actual content.

The same issue existed in the !isSubtreeRootHandlingScrollbarChanges path
of SubtreeScrollbarChangesHandler's destructor, which relaid out deferred
descendants without invalidating their preferred widths.

* 
LayoutTests/platform/glib/scrollbars/scrollbars-on-positioned-content-expected.txt:
* 
LayoutTests/platform/mac/scrollbars/scrollbars-on-positioned-content-expected.txt:
* 
LayoutTests/platform/win/scrollbars/scrollbars-on-positioned-content-expected.txt:
Rebaseline this test because the rendering now matches other engines.

* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::relayoutRenderBlockForScrollbarChange):
Extract the relayout-after-scrollbar-change sequence into a shared helper.
When the block sizes to fit content, invalidate preferred widths so the
scrollbar gutter is picked up by the next width computation.

* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::sizesPreferredLogicalWidthToFitContent const):
Report true for out-of-flow boxes with auto width and auto on at least one
inline inset, so the helper invalidates preferred widths for them too.

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



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

Reply via email to