Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cd1b035579cc816291f6f2283d43e47ee2c45e74
      
https://github.com/WebKit/WebKit/commit/cd1b035579cc816291f6f2283d43e47ee2c45e74
  Author: Alan Baradlay <[email protected]>
  Date:   2026-02-10 (Tue, 10 Feb 2026)

  Changed paths:
    A LayoutTests/fast/inline/block-in-inline-float-and-margin-expected.html
    A LayoutTests/fast/inline/block-in-inline-float-and-margin.html
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h

  Log Message:
  -----------
  [block-in-inline] Incorrect float position when margin is present
https://bugs.webkit.org/show_bug.cgi?id=307439

Reviewed by Antti Koivisto.

1. Float boxes "avoid" margin boxes.
2. We don't adjust the line rect with block's margin until after we come across 
inline content (see comment in applyMarginInBlockDirectionIfNeeded)

This fix addresses the case when the very first (contentful) inline item is a 
float box.
In this case we need to apply the margin adjustment the same way we do when we 
see inline content.

Test: fast/inline/block-in-inline-float-and-margin.html

* LayoutTests/fast/inline/block-in-inline-float-and-margin-expected.html: Added.
* LayoutTests/fast/inline/block-in-inline-float-and-margin.html: Added.
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::applyMarginInBlockDirectionIfNeeded):
(WebCore::Layout::LineBuilder::tryPlacingFloatBox):
(WebCore::Layout::LineBuilder::handleInlineContent):
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h:

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



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

Reply via email to