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

Side by Side Diff: Source/core/layout/MultiColumnFragmentainerGroup.cpp

Issue 1209693002: Remove LayoutFlowThread::maxLogicalHeight(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
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/MultiColumnFragmentainerGroup.h" 7 #include "core/layout/MultiColumnFragmentainerGroup.h"
8 8
9 #include "core/layout/LayoutMultiColumnSet.h" 9 #include "core/layout/LayoutMultiColumnSet.h"
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 106 }
107 107
108 // We can get rid of the content runs now, if we haven't already done so. Th ey are only needed 108 // We can get rid of the content runs now, if we haven't already done so. Th ey are only needed
109 // to calculate the initial balanced column height. In fact, we have to get rid of them before 109 // to calculate the initial balanced column height. In fact, we have to get rid of them before
110 // the next layout pass, since each pass will rebuild this. 110 // the next layout pass, since each pass will rebuild this.
111 m_contentRuns.clear(); 111 m_contentRuns.clear();
112 112
113 if (m_columnHeight == oldColumnHeight) 113 if (m_columnHeight == oldColumnHeight)
114 return false; // No change. We're done. 114 return false; // No change. We're done.
115 115
116 m_minSpaceShortage = LayoutFlowThread::maxLogicalHeight(); 116 m_minSpaceShortage = LayoutUnit::max();
117 return true; // Need another pass. 117 return true; // Need another pass.
118 } 118 }
119 119
120 void MultiColumnFragmentainerGroup::expandToEncompassFlowThreadOverflow() 120 void MultiColumnFragmentainerGroup::expandToEncompassFlowThreadOverflow()
121 { 121 {
122 ASSERT(isLastGroup()); 122 ASSERT(isLastGroup());
123 // Get the offset within the flow thread in its block progression direction. Then get the 123 // Get the offset within the flow thread in its block progression direction. Then get the
124 // flow thread's remaining logical height including its overflow and expand our rect 124 // flow thread's remaining logical height including its overflow and expand our rect
125 // to encompass that remaining height and overflow. The idea is that we will generate 125 // to encompass that remaining height and overflow. The idea is that we will generate
126 // additional columns and pages to hold that overflow, since people do write bad 126 // additional columns and pages to hold that overflow, since people do write bad
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 } 330 }
331 height -= logicalTop(); 331 height -= logicalTop();
332 return max(height, LayoutUnit(1)); // Let's avoid zero height, as that would probably cause an infinite amount of columns to be created. 332 return max(height, LayoutUnit(1)); // Let's avoid zero height, as that would probably cause an infinite amount of columns to be created.
333 } 333 }
334 334
335 LayoutUnit MultiColumnFragmentainerGroup::calculateMaxColumnHeight() const 335 LayoutUnit MultiColumnFragmentainerGroup::calculateMaxColumnHeight() const
336 { 336 {
337 LayoutBlockFlow* multicolBlock = m_columnSet.multiColumnBlockFlow(); 337 LayoutBlockFlow* multicolBlock = m_columnSet.multiColumnBlockFlow();
338 const ComputedStyle& multicolStyle = multicolBlock->styleRef(); 338 const ComputedStyle& multicolStyle = multicolBlock->styleRef();
339 LayoutUnit availableHeight = m_columnSet.multiColumnFlowThread()->columnHeig htAvailable(); 339 LayoutUnit availableHeight = m_columnSet.multiColumnFlowThread()->columnHeig htAvailable();
340 LayoutUnit maxColumnHeight = availableHeight ? availableHeight : LayoutFlowT hread::maxLogicalHeight(); 340 LayoutUnit maxColumnHeight = availableHeight ? availableHeight : LayoutUnit: :max();
341 if (!multicolStyle.logicalMaxHeight().isMaxSizeNone()) { 341 if (!multicolStyle.logicalMaxHeight().isMaxSizeNone()) {
342 LayoutUnit logicalMaxHeight = multicolBlock->computeContentLogicalHeight (MaxSize, multicolStyle.logicalMaxHeight(), -1); 342 LayoutUnit logicalMaxHeight = multicolBlock->computeContentLogicalHeight (MaxSize, multicolStyle.logicalMaxHeight(), -1);
343 if (logicalMaxHeight != -1 && maxColumnHeight > logicalMaxHeight) 343 if (logicalMaxHeight != -1 && maxColumnHeight > logicalMaxHeight)
344 maxColumnHeight = logicalMaxHeight; 344 maxColumnHeight = logicalMaxHeight;
345 } 345 }
346 return heightAdjustedForRowOffset(maxColumnHeight); 346 return heightAdjustedForRowOffset(maxColumnHeight);
347 } 347 }
348 348
349 void MultiColumnFragmentainerGroup::setAndConstrainColumnHeight(LayoutUnit newHe ight) 349 void MultiColumnFragmentainerGroup::setAndConstrainColumnHeight(LayoutUnit newHe ight)
350 { 350 {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 // We cannot stretch any further. We'll just have to live with the overf lowing columns. This 426 // We cannot stretch any further. We'll just have to live with the overf lowing columns. This
427 // typically happens if the max column height is less than the height of the tallest piece 427 // typically happens if the max column height is less than the height of the tallest piece
428 // of unbreakable content (e.g. lines). 428 // of unbreakable content (e.g. lines).
429 return m_columnHeight; 429 return m_columnHeight;
430 } 430 }
431 431
432 // If the initial guessed column height wasn't enough, stretch it now. Stret ch by the lowest 432 // If the initial guessed column height wasn't enough, stretch it now. Stret ch by the lowest
433 // amount of space shortage found during layout. 433 // amount of space shortage found during layout.
434 434
435 ASSERT(m_minSpaceShortage > 0); // We should never _shrink_ the height! 435 ASSERT(m_minSpaceShortage > 0); // We should never _shrink_ the height!
436 ASSERT(m_minSpaceShortage != LayoutFlowThread::maxLogicalHeight()); // If th is happens, we probably have a bug. 436 ASSERT(m_minSpaceShortage != LayoutUnit::max()); // If this happens, we prob ably have a bug.
437 if (m_minSpaceShortage == LayoutFlowThread::maxLogicalHeight()) 437 if (m_minSpaceShortage == LayoutUnit::max())
438 return m_columnHeight; // So bail out rather than looping infinitely. 438 return m_columnHeight; // So bail out rather than looping infinitely.
439 439
440 return m_columnHeight + m_minSpaceShortage; 440 return m_columnHeight + m_minSpaceShortage;
441 } 441 }
442 442
443 LayoutRect MultiColumnFragmentainerGroup::columnRectAt(unsigned columnIndex) con st 443 LayoutRect MultiColumnFragmentainerGroup::columnRectAt(unsigned columnIndex) con st
444 { 444 {
445 LayoutUnit columnLogicalWidth = m_columnSet.pageLogicalWidth(); 445 LayoutUnit columnLogicalWidth = m_columnSet.pageLogicalWidth();
446 LayoutUnit columnLogicalHeight = m_columnHeight; 446 LayoutUnit columnLogicalHeight = m_columnHeight;
447 LayoutUnit columnLogicalTop; 447 LayoutUnit columnLogicalTop;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 append(MultiColumnFragmentainerGroup(m_columnSet)); 578 append(MultiColumnFragmentainerGroup(m_columnSet));
579 return last(); 579 return last();
580 } 580 }
581 581
582 void MultiColumnFragmentainerGroupList::deleteExtraGroups() 582 void MultiColumnFragmentainerGroupList::deleteExtraGroups()
583 { 583 {
584 shrink(1); 584 shrink(1);
585 } 585 }
586 586
587 } // namespace blink 587 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698