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

Side by Side Diff: third_party/WebKit/Source/core/layout/ColumnBalancer.cpp

Issue 1909233002: Spec-compliant parsing and initial values for 'orphans' and 'widows'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Some unit tests had non-conformant widphans assumptions too. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/layout/ColumnBalancer.h" 5 #include "core/layout/ColumnBalancer.h"
6 6
7 #include "core/layout/LayoutMultiColumnFlowThread.h" 7 #include "core/layout/LayoutMultiColumnFlowThread.h"
8 #include "core/layout/LayoutMultiColumnSet.h" 8 #include "core/layout/LayoutMultiColumnSet.h"
9 #include "core/layout/api/LineLayoutBlockFlow.h" 9 #include "core/layout/api/LineLayoutBlockFlow.h"
10 10
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 132 }
133 133
134 void InitialColumnHeightFinder::examineBoxBeforeLeaving(const LayoutBox& box) 134 void InitialColumnHeightFinder::examineBoxBeforeLeaving(const LayoutBox& box)
135 { 135 {
136 } 136 }
137 137
138 static inline LayoutUnit columnLogicalHeightRequirementForLine(const ComputedSty le& style, const RootInlineBox& lastLine) 138 static inline LayoutUnit columnLogicalHeightRequirementForLine(const ComputedSty le& style, const RootInlineBox& lastLine)
139 { 139 {
140 // We may require a certain minimum number of lines per page in order to sat isfy 140 // We may require a certain minimum number of lines per page in order to sat isfy
141 // orphans and widows, and that may affect the minimum page height. 141 // orphans and widows, and that may affect the minimum page height.
142 unsigned minimumLineCount = std::max<unsigned>(style.hasAutoOrphans() ? 1 : style.orphans(), style.widows()); 142 unsigned minimumLineCount = std::max<unsigned>(style.orphans(), style.widows ());
143 const RootInlineBox* firstLine = &lastLine; 143 const RootInlineBox* firstLine = &lastLine;
144 for (unsigned i = 1; i < minimumLineCount && firstLine->prevRootBox(); i++) 144 for (unsigned i = 1; i < minimumLineCount && firstLine->prevRootBox(); i++)
145 firstLine = firstLine->prevRootBox(); 145 firstLine = firstLine->prevRootBox();
146 return lastLine.lineBottomWithLeading() - firstLine->lineTopWithLeading(); 146 return lastLine.lineBottomWithLeading() - firstLine->lineTopWithLeading();
147 } 147 }
148 148
149 void InitialColumnHeightFinder::examineLine(const RootInlineBox& line) 149 void InitialColumnHeightFinder::examineLine(const RootInlineBox& line)
150 { 150 {
151 LayoutUnit lineTop = line.lineTopWithLeading(); 151 LayoutUnit lineTop = line.lineTopWithLeading();
152 LayoutUnit lineTopInFlowThread = flowThreadOffset() + lineTop; 152 LayoutUnit lineTopInFlowThread = flowThreadOffset() + lineTop;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 // of said overflow ends up in the next column. That counts as space shortag e. 335 // of said overflow ends up in the next column. That counts as space shortag e.
336 const MultiColumnFragmentainerGroup& group = groupAtOffset(lineTopInFlowThre ad); 336 const MultiColumnFragmentainerGroup& group = groupAtOffset(lineTopInFlowThre ad);
337 LayoutUnit lineBottomWithOverflow = lineTopInFlowThread + line.lineBottom() - lineTop; 337 LayoutUnit lineBottomWithOverflow = lineTopInFlowThread + line.lineBottom() - lineTop;
338 if (group.columnLogicalTopForOffset(lineTopInFlowThread) != group.columnLogi calTopForOffset(lineBottomWithOverflow)) { 338 if (group.columnLogicalTopForOffset(lineTopInFlowThread) != group.columnLogi calTopForOffset(lineBottomWithOverflow)) {
339 LayoutUnit shortage = lineBottomWithOverflow - group.columnLogicalTopFor Offset(lineBottomWithOverflow); 339 LayoutUnit shortage = lineBottomWithOverflow - group.columnLogicalTopFor Offset(lineBottomWithOverflow);
340 recordSpaceShortage(shortage); 340 recordSpaceShortage(shortage);
341 } 341 }
342 } 342 }
343 343
344 } // namespace blink 344 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698