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

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

Issue 1421883002: Even block flows with inline children must be examined when balancing columns. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/multicol/balance-floats-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 6
7 #include "core/layout/ColumnBalancer.h" 7 #include "core/layout/ColumnBalancer.h"
8 8
9 #include "core/layout/LayoutMultiColumnSet.h" 9 #include "core/layout/LayoutMultiColumnSet.h"
10 10
(...skipping 15 matching lines...) Expand all
26 if (box.childrenInline() && box.isLayoutBlockFlow()) { 26 if (box.childrenInline() && box.isLayoutBlockFlow()) {
27 // Look for breaks between lines. 27 // Look for breaks between lines.
28 for (const RootInlineBox* line = toLayoutBlockFlow(box).firstRootBox(); line; line = line->nextRootBox()) { 28 for (const RootInlineBox* line = toLayoutBlockFlow(box).firstRootBox(); line; line = line->nextRootBox()) {
29 LayoutUnit lineTopInFlowThread = m_flowThreadOffset + line->lineTopW ithLeading(); 29 LayoutUnit lineTopInFlowThread = m_flowThreadOffset + line->lineTopW ithLeading();
30 if (lineTopInFlowThread < group().logicalTopInFlowThread()) 30 if (lineTopInFlowThread < group().logicalTopInFlowThread())
31 continue; 31 continue;
32 if (lineTopInFlowThread >= group().logicalBottomInFlowThread()) 32 if (lineTopInFlowThread >= group().logicalBottomInFlowThread())
33 break; 33 break;
34 examineLine(*line); 34 examineLine(*line);
35 } 35 }
36 return;
37 } 36 }
38 37
39 const LayoutFlowThread* flowThread = group().columnSet().flowThread(); 38 const LayoutFlowThread* flowThread = group().columnSet().flowThread();
40 bool isHorizontalWritingMode = flowThread->isHorizontalWritingMode(); 39 bool isHorizontalWritingMode = flowThread->isHorizontalWritingMode();
41 40
42 // Look for breaks between and inside children. 41 // Look for breaks between and inside block-level children. Even if this is a block flow with
42 // inline children, there may be interesting floats to examine here.
43 for (const LayoutObject* child = box.slowFirstChild(); child; child = child- >nextSibling()) { 43 for (const LayoutObject* child = box.slowFirstChild(); child; child = child- >nextSibling()) {
44 if (!child->isBox()) 44 if (!child->isBox() || child->isInline())
45 continue; 45 continue;
46 const LayoutBox& childBox = toLayoutBox(*child); 46 const LayoutBox& childBox = toLayoutBox(*child);
47 LayoutRect overflowRect = childBox.layoutOverflowRect(); 47 LayoutRect overflowRect = childBox.layoutOverflowRect();
48 LayoutUnit childLogicalBottomWithOverflow = childBox.logicalTop() + (isH orizontalWritingMode ? overflowRect.maxY() : overflowRect.maxX()); 48 LayoutUnit childLogicalBottomWithOverflow = childBox.logicalTop() + (isH orizontalWritingMode ? overflowRect.maxY() : overflowRect.maxX());
49 if (m_flowThreadOffset + childLogicalBottomWithOverflow <= group().logic alTopInFlowThread()) { 49 if (m_flowThreadOffset + childLogicalBottomWithOverflow <= group().logic alTopInFlowThread()) {
50 // This child is fully above the fragmentainer group we're examining . 50 // This child is fully above the fragmentainer group we're examining .
51 continue; 51 continue;
52 } 52 }
53 LayoutUnit childLogicalTopWithOverflow = childBox.logicalTop() + (isHori zontalWritingMode ? overflowRect.y() : overflowRect.x()); 53 LayoutUnit childLogicalTopWithOverflow = childBox.logicalTop() + (isHori zontalWritingMode ? overflowRect.y() : overflowRect.x());
54 if (m_flowThreadOffset + childLogicalTopWithOverflow >= group().logicalB ottomInFlowThread()) { 54 if (m_flowThreadOffset + childLogicalTopWithOverflow >= group().logicalB ottomInFlowThread()) {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 recordSpaceShortage(logicalOffsetFromCurrentColumn + lineHeight - m_pend ingStrut); 235 recordSpaceShortage(logicalOffsetFromCurrentColumn + lineHeight - m_pend ingStrut);
236 m_pendingStrut = LayoutUnit::min(); 236 m_pendingStrut = LayoutUnit::min();
237 return; 237 return;
238 } 238 }
239 ASSERT(isFirstAfterBreak(lineTopInFlowThread) || !line.paginationStrut()); 239 ASSERT(isFirstAfterBreak(lineTopInFlowThread) || !line.paginationStrut());
240 if (isFirstAfterBreak(lineTopInFlowThread)) 240 if (isFirstAfterBreak(lineTopInFlowThread))
241 recordSpaceShortage(lineHeight - line.paginationStrut()); 241 recordSpaceShortage(lineHeight - line.paginationStrut());
242 } 242 }
243 243
244 } // namespace blink 244 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/multicol/balance-floats-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698