| 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/MultiColumnFragmentainerGroup.h" | 7 #include "core/layout/MultiColumnFragmentainerGroup.h" |
| 8 | 8 |
| 9 #include "core/layout/ColumnBalancer.h" | 9 #include "core/layout/ColumnBalancer.h" |
| 10 #include "core/layout/LayoutMultiColumnSet.h" | 10 #include "core/layout/LayoutMultiColumnSet.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 return isLastGroup() && m_columnSet.heightIsAuto(); | 47 return isLastGroup() && m_columnSet.heightIsAuto(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void MultiColumnFragmentainerGroup::resetColumnHeight() | 50 void MultiColumnFragmentainerGroup::resetColumnHeight() |
| 51 { | 51 { |
| 52 // Nuke previously stored minimum column height. Contents may have changed f
or all we know. | 52 // Nuke previously stored minimum column height. Contents may have changed f
or all we know. |
| 53 m_minimumColumnHeight = 0; | 53 m_minimumColumnHeight = 0; |
| 54 | 54 |
| 55 m_maxColumnHeight = calculateMaxColumnHeight(); | 55 m_maxColumnHeight = calculateMaxColumnHeight(); |
| 56 | 56 |
| 57 LayoutUnit oldColumnHeight = m_columnHeight; | |
| 58 | |
| 59 LayoutMultiColumnFlowThread* flowThread = m_columnSet.multiColumnFlowThread(
); | 57 LayoutMultiColumnFlowThread* flowThread = m_columnSet.multiColumnFlowThread(
); |
| 60 LayoutMultiColumnFlowThread* enclosingFlowThread = flowThread->enclosingFlow
Thread(); | 58 LayoutMultiColumnFlowThread* enclosingFlowThread = flowThread->enclosingFlow
Thread(); |
| 61 if (enclosingFlowThread && enclosingFlowThread->isPageLogicalHeightKnown())
{ | 59 if (enclosingFlowThread && enclosingFlowThread->isPageLogicalHeightKnown())
{ |
| 62 // TODO(mstensho): Do this better. If height is auto here, we shouldn't
set a | 60 // TODO(mstensho): Do this better. If height is auto here, we shouldn't
set a |
| 63 // height, or forced breaks and pagination struts might mess up column b
alancing. | 61 // height, or forced breaks and pagination struts might mess up column b
alancing. |
| 64 LayoutUnit columnHeight = heightIsAuto() ? m_maxColumnHeight : heightAdj
ustedForRowOffset(flowThread->columnHeightAvailable()); | 62 LayoutUnit columnHeight = heightIsAuto() ? m_maxColumnHeight : heightAdj
ustedForRowOffset(flowThread->columnHeightAvailable()); |
| 65 setAndConstrainColumnHeight(columnHeight); | 63 setAndConstrainColumnHeight(columnHeight); |
| 66 } else if (heightIsAuto()) { | 64 } else if (heightIsAuto()) { |
| 67 m_columnHeight = LayoutUnit(); | 65 m_columnHeight = LayoutUnit(); |
| 68 } else { | 66 } else { |
| 69 setAndConstrainColumnHeight(heightAdjustedForRowOffset(flowThread->colum
nHeightAvailable())); | 67 setAndConstrainColumnHeight(heightAdjustedForRowOffset(flowThread->colum
nHeightAvailable())); |
| 70 } | 68 } |
| 71 | |
| 72 if (m_columnHeight != oldColumnHeight) | |
| 73 m_columnSet.setChildNeedsLayout(MarkOnlyThis); | |
| 74 } | 69 } |
| 75 | 70 |
| 76 bool MultiColumnFragmentainerGroup::recalculateColumnHeight(BalancedColumnHeight
Calculation calculationMode) | 71 bool MultiColumnFragmentainerGroup::recalculateColumnHeight(BalancedColumnHeight
Calculation calculationMode) |
| 77 { | 72 { |
| 78 LayoutUnit oldColumnHeight = m_columnHeight; | 73 LayoutUnit oldColumnHeight = m_columnHeight; |
| 79 | 74 |
| 80 m_maxColumnHeight = calculateMaxColumnHeight(); | 75 m_maxColumnHeight = calculateMaxColumnHeight(); |
| 81 | 76 |
| 82 if (heightIsAuto()) { | 77 if (heightIsAuto()) { |
| 83 LayoutUnit newColumnHeight = calculateColumnHeight(calculationMode); | 78 LayoutUnit newColumnHeight = calculateColumnHeight(calculationMode); |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 append(MultiColumnFragmentainerGroup(m_columnSet)); | 556 append(MultiColumnFragmentainerGroup(m_columnSet)); |
| 562 return last(); | 557 return last(); |
| 563 } | 558 } |
| 564 | 559 |
| 565 void MultiColumnFragmentainerGroupList::deleteExtraGroups() | 560 void MultiColumnFragmentainerGroupList::deleteExtraGroups() |
| 566 { | 561 { |
| 567 shrink(1); | 562 shrink(1); |
| 568 } | 563 } |
| 569 | 564 |
| 570 } // namespace blink | 565 } // namespace blink |
| OLD | NEW |