| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/FragmentainerIterator.h" | 5 #include "core/layout/FragmentainerIterator.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutMultiColumnSet.h" | 7 #include "core/layout/LayoutMultiColumnSet.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 } | 92 } |
| 93 | 93 |
| 94 bool FragmentainerIterator::setFragmentainersOfInterest() | 94 bool FragmentainerIterator::setFragmentainersOfInterest() |
| 95 { | 95 { |
| 96 const MultiColumnFragmentainerGroup& group = currentGroup(); | 96 const MultiColumnFragmentainerGroup& group = currentGroup(); |
| 97 | 97 |
| 98 // Figure out the start and end fragmentainers for the block range we're int
erested in. We | 98 // Figure out the start and end fragmentainers for the block range we're int
erested in. We |
| 99 // might not have to walk the entire fragmentainer group. | 99 // might not have to walk the entire fragmentainer group. |
| 100 group.columnIntervalForBlockRangeInFlowThread(m_logicalTopInFlowThread, m_lo
gicalBottomInFlowThread, m_currentFragmentainerIndex, m_endFragmentainerIndex); | 100 group.columnIntervalForBlockRangeInFlowThread(m_logicalTopInFlowThread, m_lo
gicalBottomInFlowThread, m_currentFragmentainerIndex, m_endFragmentainerIndex); |
| 101 | 101 |
| 102 // Now intersect with the fragmentainers that actually intersect with the cl
ip rect, to narrow | 102 // Now intersect with the fragmentainers that actually intersect with the vi
sual clip rect, to |
| 103 // it down even further. | 103 // narrow it down even further. The clip rect needs to be relative to the cu
rrent fragmentainer |
| 104 // group. |
| 105 LayoutRect clipRect = m_clipRectInMulticolContainer; |
| 106 LayoutSize offset = group.flowThreadTranslationAtOffset(group.logicalTopInFl
owThread(), CoordinateSpaceConversion::Visual); |
| 107 clipRect.move(-offset); |
| 104 unsigned firstFragmentainerInClipRect, lastFragmentainerInClipRect; | 108 unsigned firstFragmentainerInClipRect, lastFragmentainerInClipRect; |
| 105 group.columnIntervalForVisualRect(m_clipRectInMulticolContainer, firstFragme
ntainerInClipRect, lastFragmentainerInClipRect); | 109 group.columnIntervalForVisualRect(clipRect, firstFragmentainerInClipRect, la
stFragmentainerInClipRect); |
| 106 // If the two fragmentainer intervals are disjoint, there's nothing of inter
est in this | 110 // If the two fragmentainer intervals are disjoint, there's nothing of inter
est in this |
| 107 // fragmentainer group. | 111 // fragmentainer group. |
| 108 if (firstFragmentainerInClipRect > m_endFragmentainerIndex || lastFragmentai
nerInClipRect < m_currentFragmentainerIndex) | 112 if (firstFragmentainerInClipRect > m_endFragmentainerIndex || lastFragmentai
nerInClipRect < m_currentFragmentainerIndex) |
| 109 return false; | 113 return false; |
| 110 if (m_currentFragmentainerIndex < firstFragmentainerInClipRect) | 114 if (m_currentFragmentainerIndex < firstFragmentainerInClipRect) |
| 111 m_currentFragmentainerIndex = firstFragmentainerInClipRect; | 115 m_currentFragmentainerIndex = firstFragmentainerInClipRect; |
| 112 if (m_endFragmentainerIndex > lastFragmentainerInClipRect) | 116 if (m_endFragmentainerIndex > lastFragmentainerInClipRect) |
| 113 m_endFragmentainerIndex = lastFragmentainerInClipRect; | 117 m_endFragmentainerIndex = lastFragmentainerInClipRect; |
| 114 DCHECK(m_endFragmentainerIndex >= m_currentFragmentainerIndex); | 118 DCHECK(m_endFragmentainerIndex >= m_currentFragmentainerIndex); |
| 115 return true; | 119 return true; |
| 116 } | 120 } |
| 117 | 121 |
| 118 void FragmentainerIterator::updateOutput() | 122 void FragmentainerIterator::updateOutput() |
| 119 { | 123 { |
| 120 const MultiColumnFragmentainerGroup& group = currentGroup(); | 124 const MultiColumnFragmentainerGroup& group = currentGroup(); |
| 121 | 125 |
| 122 // Set the physical translation offset. | 126 // Set the physical translation offset. |
| 123 LayoutUnit fragmentainerLogicalTopInFlowThread = group.logicalTopInFlowThrea
d() + m_currentFragmentainerIndex * group.logicalHeight(); | 127 LayoutUnit fragmentainerLogicalTopInFlowThread = group.logicalTopInFlowThrea
d() + m_currentFragmentainerIndex * group.logicalHeight(); |
| 124 m_paginationOffset = group.flowThreadTranslationAtOffset(fragmentainerLogica
lTopInFlowThread, CoordinateSpaceConversion::Visual); | 128 m_paginationOffset = group.flowThreadTranslationAtOffset(fragmentainerLogica
lTopInFlowThread, CoordinateSpaceConversion::Visual); |
| 125 | 129 |
| 126 // Set the overflow clip rect that corresponds to the fragmentainer. | 130 // Set the overflow clip rect that corresponds to the fragmentainer. |
| 127 m_clipRectInFlowThread = group.flowThreadPortionOverflowRectAt(m_currentFrag
mentainerIndex); | 131 m_clipRectInFlowThread = group.flowThreadPortionOverflowRectAt(m_currentFrag
mentainerIndex); |
| 128 | 132 |
| 129 // Flip it into a physical rectangle. | 133 // Flip it into a physical rectangle. |
| 130 m_flowThread.flipForWritingMode(m_clipRectInFlowThread); | 134 m_flowThread.flipForWritingMode(m_clipRectInFlowThread); |
| 131 } | 135 } |
| 132 | 136 |
| 133 } // namespace blink | 137 } // namespace blink |
| OLD | NEW |