Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 75f22acf41f4639f3487a5954712331b579c91a7
      
https://github.com/WebKit/WebKit/commit/75f22acf41f4639f3487a5954712331b579c91a7
  Author: Sammy Gill <[email protected]>
  Date:   2026-08-17 (Mon, 17 Aug 2026)

  Changed paths:
    M Source/WebCore/rendering/RenderBlock.cpp
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderBox.h
    M Source/WebCore/rendering/RenderObject.h
    M Source/WebCore/style/StyleExtractorCustom.h

  Log Message:
  -----------
  Remove the unused trimmed-margin rare data bits from RenderBox
https://bugs.webkit.org/show_bug.cgi?id=321967
rdar://185151625

Reviewed by Alan Baradlay.

RenderBox tracked which of a box's margins had been trimmed by margin-trim in
a RenderObjectRareData EnumSet, but nothing observable ever consulted it.

The only writer was RenderBlock::setTrimmedMarginForChild(), which asserts on
the inline sides, so the set only ever held BlockStart / BlockEnd. Its callers
are all in RenderBlockFlow; grid never populated the bits, and inline-axis
trimming in RenderBox::computeOrTrimInlineMargin() returns 0 without recording
anything.

The only reader was the margin-right branch of MarginEdgeSharedAdaptor in
StyleExtractorCustom.h. That check is unreachable for block-level boxes:
rendererCanHaveTrimmedMargin() requires a horizontal-writing-mode containing
block, and in a horizontal writing mode physical right always maps to an inline
side, which the set never contains. The grid-item path required the grid to
specify margin-trim, which grid does not implement. Even where it did fire, the
other three margin properties already fall through to the used value, so
computed style reports the trimmed 0px without needing the bits.

The bits were also never cleared on relayout or style change, so any future
reader would have observed stale trim state.

* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::setTrimmedMarginForChild): Drop the 
markMarginAsTrimmed() call.
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::markMarginAsTrimmed): Deleted.
(WebCore::RenderBox::hasTrimmedMargin): Deleted.
* Source/WebCore/rendering/RenderBox.h:
* Source/WebCore/rendering/RenderObject.h: Remove 
RenderObjectRareData::trimmedMargins.
* Source/WebCore/style/StyleExtractorCustom.h: Remove 
rendererCanHaveTrimmedMargin()
and toMarginTrimSide() along with the margin-right early return that used them.

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



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

Reply via email to