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

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

Issue 1880283006: ColumnBalancer: Count line box overflow as space shortage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 // that block. We want to record the distance from the top of the column to the bottom of 318 // that block. We want to record the distance from the top of the column to the bottom of
319 // this box as space shortage. 319 // this box as space shortage.
320 LayoutUnit logicalOffsetFromCurrentColumn = lineTopInFlowThread - group( ).columnLogicalTopForOffset(lineTopInFlowThread); 320 LayoutUnit logicalOffsetFromCurrentColumn = lineTopInFlowThread - group( ).columnLogicalTopForOffset(lineTopInFlowThread);
321 recordSpaceShortage(logicalOffsetFromCurrentColumn + lineHeight - m_pend ingStrut); 321 recordSpaceShortage(logicalOffsetFromCurrentColumn + lineHeight - m_pend ingStrut);
322 m_pendingStrut = LayoutUnit::min(); 322 m_pendingStrut = LayoutUnit::min();
323 return; 323 return;
324 } 324 }
325 ASSERT(isFirstAfterBreak(lineTopInFlowThread) || !line.paginationStrut() || !isLogicalTopWithinBounds(lineTopInFlowThread - line.paginationStrut())); 325 ASSERT(isFirstAfterBreak(lineTopInFlowThread) || !line.paginationStrut() || !isLogicalTopWithinBounds(lineTopInFlowThread - line.paginationStrut()));
326 if (isFirstAfterBreak(lineTopInFlowThread)) 326 if (isFirstAfterBreak(lineTopInFlowThread))
327 recordSpaceShortage(lineHeight - line.paginationStrut()); 327 recordSpaceShortage(lineHeight - line.paginationStrut());
328
329 // Even if the line box itself fits fine inside a column, some content may o verflow the line
330 // box bottom (due to restrictive line-height, for instance). We should chec k if some portion
331 // of said overflow ends up in the next column. That counts as space shortag e.
332 LayoutUnit lineBottomWithOverflow = lineTopInFlowThread + line.lineBottom() - lineTop;
333 if (group().columnLogicalTopForOffset(lineTopInFlowThread) != group().column LogicalTopForOffset(lineBottomWithOverflow)) {
334 LayoutUnit shortage = lineBottomWithOverflow - group().columnLogicalTopF orOffset(lineBottomWithOverflow);
335 recordSpaceShortage(shortage);
336 }
328 } 337 }
329 338
330 } // namespace blink 339 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698