Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9a1636cb65a8b7e2599c91fc5f61f9539f4493a4
      
https://github.com/WebKit/WebKit/commit/9a1636cb65a8b7e2599c91fc5f61f9539f4493a4
  Author: Alan Baradlay <[email protected]>
  Date:   2023-05-25 (Thu, 25 May 2023)

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

  Log Message:
  -----------
  [IFC][out-of-flow] Subsequent layouts generate duplicated out-of-flow boxes
https://bugs.webkit.org/show_bug.cgi?id=257338

Reviewed by Simon Fraser.

This was regressed when we started diverting float/out-of-flow only content 
from legacy to IFC (i.e. when the block container has no inline inflow content).

1. during inline item collection (that's where we flatten out the layout tree 
for inline content (e.g. <div>some text<span>nested</span></div>)
  we also collect the out-of-flow boxes and add them to the formatting state 
(while the class name (InlineItemsBuilder) may sound misleading as it collects 
non-inline items too,
  it does save us an additional tree traversal).
2. Inline layout can either be triggered as a full or partial layout. When we 
see an out-of-flow box, we fall back to full layout and full
  layout with _inline content_ either destroys all the cached states or in some 
cases (e.g. resize) it does not need to collect any content at all -> no 
duplication.

However the dedicated floats/out-of-flow content only codepath has a slightly 
different (and unoptimized) behavior
of always calling into InlineItemsBuilder to recollect content. This works fine 
for inline items (no duplication there) as we replace them in the formatting 
state,
it sadly accumulates out-of-flow boxes.

This patch fixes this duplicated boxes issue by applying the same "replace" 
logic what we do for inline items.

* Source/WebCore/layout/FormattingState.h:
(WebCore::Layout::FormattingState::setOutOfFlowBoxes):
* Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp:
(WebCore::Layout::InlineItemsBuilder::build):
(WebCore::Layout::InlineItemsBuilder::collectInlineItems):
* Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.h:

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


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

Reply via email to