OLD | NEW |
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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 if (box.hasForcedBreakAfter()) | 239 if (box.hasForcedBreakAfter()) |
240 m_forcedBreaksCount++; | 240 m_forcedBreaksCount++; |
241 | 241 |
242 // Look for breaks before the child box. | 242 // Look for breaks before the child box. |
243 bool isFirstAfterBreak = this->isFirstAfterBreak(flowThreadOffset()); | 243 bool isFirstAfterBreak = this->isFirstAfterBreak(flowThreadOffset()); |
244 ASSERT(isFirstAfterBreak || !box.paginationStrut()); | 244 ASSERT(isFirstAfterBreak || !box.paginationStrut()); |
245 LayoutBox::PaginationBreakability breakability = box.paginationBreakability(
); | 245 LayoutBox::PaginationBreakability breakability = box.paginationBreakability(
); |
246 if (isFirstAfterBreak && !box.hasForcedBreakBefore()) { | 246 if (isFirstAfterBreak && !box.hasForcedBreakBefore()) { |
247 // This box is first after a soft break. | 247 // This box is first after a soft break. |
248 LayoutUnit strut = box.paginationStrut(); | 248 LayoutUnit strut = box.paginationStrut(); |
249 if (breakability == LayoutBox::ForbidBreaks) { | 249 // Figure out how much more space we would need to prevent it from being
pushed to the next column. |
250 // Since we cannot break inside the box, just figure out how much mo
re space we would | 250 recordSpaceShortage(box.logicalHeight() - strut); |
251 // need to prevent it from being pushed to the next column. | 251 if (breakability != LayoutBox::ForbidBreaks && m_pendingStrut == LayoutU
nit::min()) { |
252 recordSpaceShortage(box.logicalHeight() - strut); | |
253 } else if (m_pendingStrut == LayoutUnit::min()) { | |
254 // We now want to look for the first piece of unbreakable content (e
.g. a line or a | 252 // We now want to look for the first piece of unbreakable content (e
.g. a line or a |
255 // block-displayed image) inside this block. That ought to be a good
candidate for | 253 // block-displayed image) inside this block. That ought to be a good
candidate for |
256 // minimum space shortage; a much better one than reporting space sh
ortage for the | 254 // minimum space shortage; a much better one than reporting space sh
ortage for the |
257 // entire block (which we'll also do (further down), in case we coul
dn't find anything | 255 // entire block (which we'll also do (further down), in case we coul
dn't find anything |
258 // more suitable). | 256 // more suitable). |
259 m_pendingStrut = strut; | 257 m_pendingStrut = strut; |
260 } | 258 } |
261 } | 259 } |
262 | 260 |
263 if (breakability != LayoutBox::ForbidBreaks) { | 261 if (breakability != LayoutBox::ForbidBreaks) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 recordSpaceShortage(logicalOffsetFromCurrentColumn + lineHeight - m_pend
ingStrut); | 299 recordSpaceShortage(logicalOffsetFromCurrentColumn + lineHeight - m_pend
ingStrut); |
302 m_pendingStrut = LayoutUnit::min(); | 300 m_pendingStrut = LayoutUnit::min(); |
303 return; | 301 return; |
304 } | 302 } |
305 ASSERT(isFirstAfterBreak(lineTopInFlowThread) || !line.paginationStrut()); | 303 ASSERT(isFirstAfterBreak(lineTopInFlowThread) || !line.paginationStrut()); |
306 if (isFirstAfterBreak(lineTopInFlowThread)) | 304 if (isFirstAfterBreak(lineTopInFlowThread)) |
307 recordSpaceShortage(lineHeight - line.paginationStrut()); | 305 recordSpaceShortage(lineHeight - line.paginationStrut()); |
308 } | 306 } |
309 | 307 |
310 } // namespace blink | 308 } // namespace blink |
OLD | NEW |