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

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

Issue 1856373002: Only allow forced fragmentainer breaks at class A break points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Woho! LayoutTests/printing/css2.1/page-break-after-003.html now passes. Created 4 years, 8 months 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 7a10e96865801828969b5d056910147c514a13a2..abe44457319e7623e367c2421403985614aae554 100644
--- a/third_party/WebKit/Source/core/layout/ColumnBalancer.cpp
+++ b/third_party/WebKit/Source/core/layout/ColumnBalancer.cpp
@@ -12,6 +12,7 @@ namespace blink {
ColumnBalancer::ColumnBalancer(const MultiColumnFragmentainerGroup& group)
: m_group(group)
+ , m_previousBreakAfterValue(BreakAuto)
{
}
@@ -69,6 +70,7 @@ void ColumnBalancer::traverseSubtree(const LayoutBox& box)
if (childBox.getPaginationBreakability() != LayoutBox::ForbidBreaks
&& (!childBox.isLayoutBlockFlow() || !toLayoutBlockFlow(childBox).multiColumnFlowThread()))
traverseSubtree(childBox);
+ m_previousBreakAfterValue = childBox.breakAfter();
examineBoxBeforeLeaving(childBox);
m_flowThreadOffset -= offsetForThisChild;
@@ -98,21 +100,15 @@ LayoutUnit InitialColumnHeightFinder::initialMinimalBalancedHeight() const
void InitialColumnHeightFinder::examineBoxAfterEntering(const LayoutBox& box)
{
if (isLogicalTopWithinBounds(flowThreadOffset() - box.paginationStrut())) {
- ASSERT(isFirstAfterBreak(flowThreadOffset()) || !box.paginationStrut());
- if (box.hasForcedBreakBefore()) {
+ if (box.needsForcedBreakBefore(previousBreakAfterValue())) {
addContentRun(flowThreadOffset());
} else if (isFirstAfterBreak(flowThreadOffset())) {
// This box is first after a soft break.
+ ASSERT(isFirstAfterBreak(flowThreadOffset()) || !box.paginationStrut());
recordStrutBeforeOffset(flowThreadOffset(), box.paginationStrut());
}
}
- if (box.hasForcedBreakAfter()) {
- LayoutUnit logicalBottomInFlowThread = flowThreadOffset() + box.logicalHeight();
- if (isLogicalBottomWithinBounds(logicalBottomInFlowThread))
- addContentRun(logicalBottomInFlowThread);
- }
-
if (box.getPaginationBreakability() != LayoutBox::AllowAnyBreaks) {
LayoutUnit unsplittableLogicalHeight = box.logicalHeight();
if (box.isFloating())
@@ -247,11 +243,11 @@ void MinimumSpaceShortageFinder::examineBoxAfterEntering(const LayoutBox& box)
// Look for breaks before the child box.
if (isLogicalTopWithinBounds(flowThreadOffset() - box.paginationStrut())) {
- ASSERT(isFirstAfterBreak(flowThreadOffset()) || !box.paginationStrut());
- if (box.hasForcedBreakBefore()) {
+ if (box.needsForcedBreakBefore(previousBreakAfterValue())) {
m_forcedBreaksCount++;
} else if (isFirstAfterBreak(flowThreadOffset())) {
// This box is first after a soft break.
+ ASSERT(isFirstAfterBreak(flowThreadOffset()) || !box.paginationStrut());
LayoutUnit strut = box.paginationStrut();
// Figure out how much more space we would need to prevent it from being pushed to the next column.
recordSpaceShortage(box.logicalHeight() - strut);
@@ -266,9 +262,6 @@ void MinimumSpaceShortageFinder::examineBoxAfterEntering(const LayoutBox& box)
}
}
- if (box.hasForcedBreakAfter() && isLogicalBottomWithinBounds(flowThreadOffset() + box.logicalHeight()))
- m_forcedBreaksCount++;
-
if (breakability != LayoutBox::ForbidBreaks) {
// See if this breakable box crosses column boundaries.
LayoutUnit bottomInFlowThread = flowThreadOffset() + box.logicalHeight();
« no previous file with comments | « third_party/WebKit/Source/core/layout/ColumnBalancer.h ('k') | third_party/WebKit/Source/core/layout/LayoutBlockFlow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698