Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Unified Diff: third_party/WebKit/Source/core/layout/ColumnBalancer.cpp

Issue 2509813004: Improve strut handling in initial column balancing pass. (Closed)
Patch Set: Rebaseline for column-rules-fixed-height. This test no longer triggers deep layout. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/ColumnBalancer.cpp
diff --git a/third_party/WebKit/Source/core/layout/ColumnBalancer.cpp b/third_party/WebKit/Source/core/layout/ColumnBalancer.cpp
index c7f23ba58b5b98898d65faa7ab630da6f389c49f..de1f38215a484fbdc9a8f7bcdb0344cedd8a8baf 100644
--- a/third_party/WebKit/Source/core/layout/ColumnBalancer.cpp
+++ b/third_party/WebKit/Source/core/layout/ColumnBalancer.cpp
@@ -173,14 +173,19 @@ void InitialColumnHeightFinder::examineBoxAfterEntering(
const LayoutBox& box,
LayoutUnit childLogicalHeight,
EBreak previousBreakAfterValue) {
+ if (m_lastBreakSeen > flowThreadOffset()) {
+ // We have moved backwards. We're probably in a parallel flow, caused by
+ // floats, sibling table cells, etc.
+ m_lastBreakSeen = LayoutUnit();
+ }
if (isLogicalTopWithinBounds(flowThreadOffset() - box.paginationStrut())) {
if (box.needsForcedBreakBefore(previousBreakAfterValue)) {
addContentRun(flowThreadOffset());
- } else {
- if (isFirstAfterBreak(flowThreadOffset())) {
- // This box is first after a soft break.
- recordStrutBeforeOffset(flowThreadOffset(), box.paginationStrut());
- }
+ } else if (isFirstAfterBreak(flowThreadOffset()) &&
+ m_lastBreakSeen != flowThreadOffset()) {
+ // This box is first after a soft break.
+ m_lastBreakSeen = flowThreadOffset();
+ recordStrutBeforeOffset(flowThreadOffset(), box.paginationStrut());
}
}
@@ -233,8 +238,11 @@ void InitialColumnHeightFinder::examineLine(const RootInlineBox& line) {
ASSERT(
isFirstAfterBreak(lineTopInFlowThread) || !line.paginationStrut() ||
!isLogicalTopWithinBounds(lineTopInFlowThread - line.paginationStrut()));
- if (isFirstAfterBreak(lineTopInFlowThread))
+ if (isFirstAfterBreak(lineTopInFlowThread) &&
+ m_lastBreakSeen != lineTopInFlowThread) {
+ m_lastBreakSeen = lineTopInFlowThread;
recordStrutBeforeOffset(lineTopInFlowThread, line.paginationStrut());
+ }
}
void InitialColumnHeightFinder::recordStrutBeforeOffset(
@@ -244,7 +252,7 @@ void InitialColumnHeightFinder::recordStrutBeforeOffset(
ASSERT(m_shortestStruts.size() == columnCount);
unsigned index = groupAtOffset(offsetInFlowThread)
.columnIndexAtOffset(offsetInFlowThread - strut,
- LayoutBox::AssociateWithLatterPage);
+ LayoutBox::AssociateWithFormerPage);
if (index >= columnCount)
return;
m_shortestStruts[index] = std::min(m_shortestStruts[index], strut);

Powered by Google App Engine
This is Rietveld 408576698