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 "core/layout/MultiColumnFragmentainerGroup.h" | 5 #include "core/layout/MultiColumnFragmentainerGroup.h" |
6 | 6 |
7 #include "core/layout/ColumnBalancer.h" | 7 #include "core/layout/ColumnBalancer.h" |
8 #include "core/layout/FragmentationContext.h" | 8 #include "core/layout/FragmentationContext.h" |
9 #include "core/layout/LayoutMultiColumnSet.h" | 9 #include "core/layout/LayoutMultiColumnSet.h" |
10 | 10 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 } | 291 } |
292 | 292 |
293 LayoutUnit MultiColumnFragmentainerGroup::heightAdjustedForRowOffset(LayoutUnit
height) const | 293 LayoutUnit MultiColumnFragmentainerGroup::heightAdjustedForRowOffset(LayoutUnit
height) const |
294 { | 294 { |
295 // Let's avoid zero height, as that would cause an infinite amount of column
s to be created. | 295 // Let's avoid zero height, as that would cause an infinite amount of column
s to be created. |
296 return std::max(height - logicalTop() - m_columnSet.logicalTopFromMulticolCo
ntentEdge(), LayoutUnit(1)); | 296 return std::max(height - logicalTop() - m_columnSet.logicalTopFromMulticolCo
ntentEdge(), LayoutUnit(1)); |
297 } | 297 } |
298 | 298 |
299 LayoutUnit MultiColumnFragmentainerGroup::calculateMaxColumnHeight() const | 299 LayoutUnit MultiColumnFragmentainerGroup::calculateMaxColumnHeight() const |
300 { | 300 { |
301 LayoutBlockFlow* multicolBlock = m_columnSet.multiColumnBlockFlow(); | |
302 const ComputedStyle& multicolStyle = multicolBlock->styleRef(); | |
303 LayoutMultiColumnFlowThread* flowThread = m_columnSet.multiColumnFlowThread(
); | 301 LayoutMultiColumnFlowThread* flowThread = m_columnSet.multiColumnFlowThread(
); |
304 LayoutUnit availableHeight = flowThread->columnHeightAvailable(); | 302 LayoutUnit maxColumnHeight = flowThread->maxColumnLogicalHeight(); |
305 LayoutUnit maxColumnHeight = availableHeight ? availableHeight : LayoutUnit:
:max(); | |
306 if (!multicolStyle.logicalMaxHeight().isMaxSizeNone()) { | |
307 LayoutUnit logicalMaxHeight = multicolBlock->computeContentLogicalHeight
(MaxSize, multicolStyle.logicalMaxHeight(), LayoutUnit(-1)); | |
308 if (logicalMaxHeight != -1 && maxColumnHeight > logicalMaxHeight) | |
309 maxColumnHeight = logicalMaxHeight; | |
310 } | |
311 LayoutUnit maxHeight = heightAdjustedForRowOffset(maxColumnHeight); | 303 LayoutUnit maxHeight = heightAdjustedForRowOffset(maxColumnHeight); |
312 if (FragmentationContext* enclosingFragmentationContext = flowThread->enclos
ingFragmentationContext()) { | 304 if (FragmentationContext* enclosingFragmentationContext = flowThread->enclos
ingFragmentationContext()) { |
313 if (enclosingFragmentationContext->isFragmentainerLogicalHeightKnown())
{ | 305 if (enclosingFragmentationContext->isFragmentainerLogicalHeightKnown())
{ |
314 // We're nested inside another fragmentation context whose fragmenta
iner heights are | 306 // We're nested inside another fragmentation context whose fragmenta
iner heights are |
315 // known. This constrains the max height. | 307 // known. This constrains the max height. |
316 LayoutUnit remainingOuterLogicalHeight = enclosingFragmentationConte
xt->remainingLogicalHeightAt(blockOffsetInEnclosingFragmentationContext()); | 308 LayoutUnit remainingOuterLogicalHeight = enclosingFragmentationConte
xt->remainingLogicalHeightAt(blockOffsetInEnclosingFragmentationContext()); |
317 ASSERT(remainingOuterLogicalHeight > 0); | 309 ASSERT(remainingOuterLogicalHeight > 0); |
318 if (maxHeight > remainingOuterLogicalHeight) | 310 if (maxHeight > remainingOuterLogicalHeight) |
319 maxHeight = remainingOuterLogicalHeight; | 311 maxHeight = remainingOuterLogicalHeight; |
320 } | 312 } |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 append(MultiColumnFragmentainerGroup(m_columnSet)); | 531 append(MultiColumnFragmentainerGroup(m_columnSet)); |
540 return last(); | 532 return last(); |
541 } | 533 } |
542 | 534 |
543 void MultiColumnFragmentainerGroupList::deleteExtraGroups() | 535 void MultiColumnFragmentainerGroupList::deleteExtraGroups() |
544 { | 536 { |
545 shrink(1); | 537 shrink(1); |
546 } | 538 } |
547 | 539 |
548 } // namespace blink | 540 } // namespace blink |
OLD | NEW |