Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7ca5a9d0bf70542a737d9bb926910cf8e654b556
      
https://github.com/WebKit/WebKit/commit/7ca5a9d0bf70542a737d9bb926910cf8e654b556
  Author: Alan Baradlay <[email protected]>
  Date:   2023-09-05 (Tue, 05 Sep 2023)

  Changed paths:
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h

  Log Message:
  -----------
  [IFC] Stop placing previously suspended floats on over-constrained line
https://bugs.webkit.org/show_bug.cgi?id=261078

Reviewed by Antti Koivisto.

1. When a float over-constrains a line (i.e. shrink it to zero horizontal 
available space) we suspend float layout but continue with laying out inline 
content until line breaking.
2. Any additional float we find until line breaking gets added to a suspended 
list (see InlineLineBuilder::m_suspendedFloats).
3. This suspended list of floats is input to next line building. We start 
processing such floats before looking at inline content.
(this is trunk behavior)

In case of multiple floats in the suspended list, we may get into a situation 
when we can't place all of these floats on the current line (over-constraining)
Currently we continue placing over-constraining floats according to normal 
float layout (in practice it means we start placing floats "under" the current 
line box).

This patch changes this behavior by
1. letting only the first suspended float over-constrain the line and if we 
don't have any available space left
2. suspend float layout (again)
3. move over to the next line

In addition to keep line state consistent, this patch also helps to keep 
margin-trim logic simple (see InlineLineBuilder::m_lineIsConstrainedByFloat).

* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::placeInlineAndFloatContent):
(WebCore::Layout::LineBuilder::shouldTryToPlaceFloatBox const):
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h:

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to