Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5063c133f4da4d377bf81ab1ec16886418ed0bef
      
https://github.com/WebKit/WebKit/commit/5063c133f4da4d377bf81ab1ec16886418ed0bef
  Author: Alan Baradlay <[email protected]>
  Date:   2026-07-26 (Sun, 26 Jul 2026)

  Changed paths:
    M Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
    M Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h

  Log Message:
  -----------
  [cleanup] Add FlexLayoutItem accessors so FlexFormattingContext stops 
dereferencing the flex item's renderer
https://bugs.webkit.org/show_bug.cgi?id=320286

Reviewed by Antti Koivisto.

FlexFormattingContext still reached through FlexLayoutItem::renderer for a 
handful of simple
queries -- the item's laid-out logical width/height, its logical-height 
border/padding, its
intrinsic size, whether it needs layout, and whether it is a table or a 
replaced element. Several
functions kept a `CheckedRef flexItem = flexLayoutItem.renderer` local just to 
spell those.

Add accessors on FlexLayoutItem for them, in the shape of the style() accessor 
it already had, and
use those at the call sites. The type queries are named isTable()/isReplaced() 
rather than after the
renderer classes they happen to be implemented with, since FlexLayoutItem does 
not otherwise expose
renderer types.

With this the formatting context does not dereference a flex item's renderer at 
all: what is left is
FlexLayoutState's completed-layout set, whose API is keyed by RenderBox, and 
the accessor bodies
themselves.

No change in behavior.

* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h:
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::FlexLayoutItem::logicalWidth):
(WebCore::FlexLayoutItem::logicalHeight):
(WebCore::FlexLayoutItem::borderAndPaddingLogicalHeight):
(WebCore::FlexLayoutItem::intrinsicSize):
(WebCore::FlexLayoutItem::needsLayout):
(WebCore::FlexLayoutItem::isTable):
(WebCore::FlexLayoutItem::isReplaced):
(WebCore::FlexFormattingContext::flexBaseSizeForFlexItem):
(WebCore::FlexFormattingContext::computeUsedNonAutoMinMainSize):
(WebCore::FlexFormattingContext::computeContentBasedMinMainSize):
(WebCore::FlexFormattingContext::computeMainSizeFromAspectRatioUsing):
(WebCore::FlexFormattingContext::applyStretchAlignmentToFlexItem):
(WebCore::FlexFormattingContext::applyStretchMinMaxCrossSize):

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



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

Reply via email to