Avoid duplicate block-in-inline break tokens.
Regardless of whether the break inside a block-in-inline was to be
resumed in a parallel flow or not, we'd also include it as a break token
in the same flow.
This was usually harmless, since any next line in the same fragmentainer
would typically not be a block-in-inline, since all consecutive blocks
inside inlines are put inside the same block-in-inline wrapper during
box generation.
However, there are ways to end up with adjacent block-in-inline
wrappers: If a block that previously wasn't inflow becomes inflow
(change from float:left to float:none, for instance), a new wrapper is
created around the now-inflow block, even if there's already an adjacent
wrapper there for an adjacent block.
<span>
<div id="first" style="float:left;"></div>
<div id="second"></div>
</span>
This generates a box tree like this:
LayoutInline SPAN
LayoutNGBlockFlow (floating) DIV #first
LayoutNGBlockFlow (anonymous)
LayoutNGBlockFlow DIV #second
If we (after initial layout) change #first to float:none, we end up with
this:
LayoutInline SPAN
LayoutNGBlockFlow (anonymous)
LayoutNGBlockFlow DIV #first
LayoutNGBlockFlow (anonymous)
LayoutNGBlockFlow DIV #second
The fix is to make sure that we only create one break token for a
fragmented block wrapper. Move the code that examines the outgoing
block-in-inline break token a bit further up, to eliminate the need for
LineInfo::BlockInInlineBreakToken(), and to keep things a bit more
tightly together. Add a DCHECK to LineBreaker::HandleBlockInInline(),
which would have failed without this fix.
Bug: 1495515
Change-Id: I6d019b8c2e6c03046e122fecce76e044f3aeabb3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4973967
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1216882}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone! Instead, follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.