DescriptionColumn balancing refactoring. Don't propagate data during layout.
The column balancing machinery needs the following to calculate an optimal
column height:
1. Flow thread height
2. Flow thread logical top position of all forced breaks
3. The total number of forced breaks
4. Minimum space shortage at any soft break
The first two are needed to estimate an initial column height. The last two are
needed if the initial column height estimate wasn't good enough and we need to
stretch it.
We used to propagate this information to the flow thread continuously during
layout. Then the flow thread, after layout, would use this information for
column balancing (either estimate an initial column height, or stretch columns
based on minimum space shortage) and then re-lay out. This was problematic,
because during layout, we sometimes go back, and re-lay out e.g. a block
because the initial logical top was wrong (due to complex margin collapsing).
This would confuse the column balancing machinery (forced breaks being reported
and counted twice, space shortage being incorrectly reported, and so on).
Instead, traverse the tree after flow thread layout, to collect the information
that we need. This fixes an existing corner-case bug, allows for future
optimizations.
There is still one thing that the flow thread needs to be notified about during
layout, if we have nested multicol: It needs to know where content is laid out
(especially if the content is in a new column), in order to tell if we need to
insert another fragmentainer group (i.e. column row). It would be nice to get
rid of this as well in the future, but we need it for now. Renamed the poorly
named setPageBreak() to the more call-back-like paginatedContentWasLaidOut().
The new class ColumnBalancer and its subclasses are now in charge of column
balancing. Moved / refactored relevant code into those classes.
Taken from LayoutMultiColumnFlowThread, LayoutMultiColumnSet,
MultiColumnFramentainerGroup, and even LayoutBlockFlow.
BUG=521964
R=jchaffraix@chromium.org,leviw@chromium.org
Committed: https://crrev.com/ce77a26bc7b22cf511e91b336f40ae405712f66b
Cr-Commit-Position: refs/heads/master@{#353463}
Patch Set 1 #
Total comments: 10
Patch Set 2 : code review #Patch Set 3 : more code review #Messages
Total messages: 16 (3 generated)
|