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

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

Issue 1472053002: Jump to the next outer column when an inner column is too short. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reduce diff - early return so that we can revert some indentation changes Created 5 years 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/Source/core/layout/LayoutMultiColumnSet.h ('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 /* 1 /*
2 * Copyright (C) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 remainingLogicalHeight = intMod(remainingLogicalHeight, pageLogicalHeigh t); 90 remainingLogicalHeight = intMod(remainingLogicalHeight, pageLogicalHeigh t);
91 } 91 }
92 return remainingLogicalHeight; 92 return remainingLogicalHeight;
93 } 93 }
94 94
95 bool LayoutMultiColumnSet::isPageLogicalHeightKnown() const 95 bool LayoutMultiColumnSet::isPageLogicalHeightKnown() const
96 { 96 {
97 return firstFragmentainerGroup().logicalHeight(); 97 return firstFragmentainerGroup().logicalHeight();
98 } 98 }
99 99
100 LayoutUnit LayoutMultiColumnSet::nextLogicalTopForUnbreakableContent(LayoutUnit flowThreadOffset, LayoutUnit contentLogicalHeight) const
101 {
102 ASSERT(pageLogicalTopForOffset(flowThreadOffset) == flowThreadOffset); // Th at's all we bother to handle.
leviw_travelin_and_unemployed 2015/11/25 19:26:34 Nit: This comment doesn't help me.
mstensho (USE GERRIT) 2015/11/25 20:08:17 Removed. "|flowThreadOffset| is expected to be at
103 LayoutMultiColumnFlowThread* enclosingFlowThread = multiColumnFlowThread()-> enclosingFlowThread();
104 if (!enclosingFlowThread) {
105 // If there's no enclosing fragmentation context, there'll ever be only one row, and all
106 // columns there will have the same height.
107 return flowThreadOffset;
108 }
109
110 if (pageLogicalHeightForOffset(flowThreadOffset) >= contentLogicalHeight)
leviw_travelin_and_unemployed 2015/11/25 19:26:34 This makes sense, but it appears in the current co
mstensho (USE GERRIT) 2015/11/25 20:08:17 Right. No need to be that robust. Let's add an ass
leviw_travelin_and_unemployed 2015/11/25 22:00:49 I was hoping you'd say that ;)
111 return flowThreadOffset;
112
113 // There's a likelihood for subsequent rows to be taller than the first one.
114 // TODO(mstensho): if we're doubly nested (e.g. multicol in multicol in mult icol), we need to
115 // look beyond the first row here.
leviw_travelin_and_unemployed 2015/11/25 19:26:34 http://i.imgur.com/EqQOTR9.jpg
mstensho (USE GERRIT) 2015/11/25 20:08:17 http://renholdsnytt.no/var/askmedia/storage/images
leviw_travelin_and_unemployed 2015/11/25 22:00:49 HA!
116 const MultiColumnFragmentainerGroup& firstRow = firstFragmentainerGroup();
117 LayoutUnit firstRowLogicalBottomInFlowThread = firstRow.logicalTopInFlowThre ad() + firstRow.logicalHeight() * usedColumnCount();
118 if (flowThreadOffset >= firstRowLogicalBottomInFlowThread)
119 return flowThreadOffset; // We're not in the first row. Give up.
120 LayoutUnit newLogicalHeight = enclosingFlowThread->pageLogicalHeightForOffse t(firstRowLogicalBottomInFlowThread);
121 if (contentLogicalHeight > newLogicalHeight) {
122 // The next outer column or page doesn't have enough space either. Give up and stay where
123 // we are.
124 return flowThreadOffset;
125 }
126 return firstRowLogicalBottomInFlowThread;
127 }
128
100 LayoutMultiColumnSet* LayoutMultiColumnSet::nextSiblingMultiColumnSet() const 129 LayoutMultiColumnSet* LayoutMultiColumnSet::nextSiblingMultiColumnSet() const
101 { 130 {
102 for (LayoutObject* sibling = nextSibling(); sibling; sibling = sibling->next Sibling()) { 131 for (LayoutObject* sibling = nextSibling(); sibling; sibling = sibling->next Sibling()) {
103 if (sibling->isLayoutMultiColumnSet()) 132 if (sibling->isLayoutMultiColumnSet())
104 return toLayoutMultiColumnSet(sibling); 133 return toLayoutMultiColumnSet(sibling);
105 } 134 }
106 return nullptr; 135 return nullptr;
107 } 136 }
108 137
109 LayoutMultiColumnSet* LayoutMultiColumnSet::previousSiblingMultiColumnSet() cons t 138 LayoutMultiColumnSet* LayoutMultiColumnSet::previousSiblingMultiColumnSet() cons t
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 379
351 LayoutRect LayoutMultiColumnSet::flowThreadPortionRect() const 380 LayoutRect LayoutMultiColumnSet::flowThreadPortionRect() const
352 { 381 {
353 LayoutRect portionRect(LayoutUnit(), logicalTopInFlowThread(), pageLogicalWi dth(), logicalHeightInFlowThread()); 382 LayoutRect portionRect(LayoutUnit(), logicalTopInFlowThread(), pageLogicalWi dth(), logicalHeightInFlowThread());
354 if (!isHorizontalWritingMode()) 383 if (!isHorizontalWritingMode())
355 return portionRect.transposedRect(); 384 return portionRect.transposedRect();
356 return portionRect; 385 return portionRect;
357 } 386 }
358 387
359 } 388 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698