| 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 #ifndef FragmentainerIterator_h | 5 #ifndef FragmentainerIterator_h |
| 6 #define FragmentainerIterator_h | 6 #define FragmentainerIterator_h |
| 7 | 7 |
| 8 #include "core/layout/MultiColumnFragmentainerGroup.h" |
| 8 #include "platform/geometry/LayoutRect.h" | 9 #include "platform/geometry/LayoutRect.h" |
| 9 | 10 |
| 10 namespace blink { | 11 namespace blink { |
| 11 | 12 |
| 12 class LayoutFlowThread; | 13 class LayoutFlowThread; |
| 13 class LayoutMultiColumnSet; | 14 class LayoutMultiColumnSet; |
| 14 class MultiColumnFragmentainerGroup; | |
| 15 | 15 |
| 16 // Used to find the fragmentainers that intersect with a given portion of the | 16 // Used to find the fragmentainers that intersect with a given portion of the |
| 17 // flow thread. The portion typically corresponds to the bounds of some | 17 // flow thread. The portion typically corresponds to the bounds of some |
| 18 // descendant layout object. The iterator walks in block direction order. | 18 // descendant layout object. The iterator walks in block direction order. |
| 19 class FragmentainerIterator { | 19 class FragmentainerIterator { |
| 20 public: | 20 public: |
| 21 // Initialize the iterator, and move to the first fragmentainer of interest. | 21 // Initialize the iterator, and move to the first fragmentainer of interest. |
| 22 // The clip rectangle is optional. If it's empty, it means that no clipping | 22 // The clip rectangle is optional. If it's empty, it means that no clipping |
| 23 // will be performed, and that the only thing that can limit the set of | 23 // will be performed, and that the only thing that can limit the set of |
| 24 // fragmentainers to visit is |physicalBoundingBox|. | 24 // fragmentainers to visit is |physicalBoundingBox|. |
| 25 FragmentainerIterator( | 25 FragmentainerIterator( |
| 26 const LayoutFlowThread&, | 26 const LayoutFlowThread&, |
| 27 const LayoutRect& physicalBoundingBoxInFlowThread, | 27 const LayoutRect& physicalBoundingBoxInFlowThread, |
| 28 const LayoutRect& clipRectInMulticolContainer = LayoutRect()); | 28 const LayoutRect& clipRectInMulticolContainer = LayoutRect()); |
| 29 | 29 |
| 30 // Advance to the next fragmentainer. Not allowed to call this if atEnd() is | 30 // Advance to the next fragmentainer. Not allowed to call this if atEnd() is |
| 31 // true. | 31 // true. |
| 32 void advance(); | 32 void advance(); |
| 33 | 33 |
| 34 // Return true if we have walked through all relevant fragmentainers. | 34 // Return true if we have walked through all relevant fragmentainers. |
| 35 bool atEnd() const { return !m_currentColumnSet; } | 35 bool atEnd() const { return !m_currentColumnSet; } |
| 36 | 36 |
| 37 // The physical translation to apply to shift the box when converting from | 37 // The physical translation to apply to shift the box when converting from |
| 38 // flowthread to visual coordinates. | 38 // flowthread to visual coordinates. |
| 39 LayoutSize paginationOffset() const; | 39 LayoutSize paginationOffset() const; |
| 40 | 40 |
| 41 // Return the physical content box of the current fragmentainer, relative to | |
| 42 // the flow thread. | |
| 43 LayoutRect fragmentainerInFlowThread() const; | |
| 44 | |
| 45 // Return the physical clip rectangle of the current fragmentainer, relative | 41 // Return the physical clip rectangle of the current fragmentainer, relative |
| 46 // to the flow thread. | 42 // to the flow thread. |
| 47 LayoutRect clipRectInFlowThread() const; | 43 LayoutRect clipRectInFlowThread( |
| 44 MultiColumnFragmentainerGroup::ClipRectAxesSelector = |
| 45 MultiColumnFragmentainerGroup::BothAxes) const; |
| 48 | 46 |
| 49 private: | 47 private: |
| 50 const LayoutFlowThread& m_flowThread; | 48 const LayoutFlowThread& m_flowThread; |
| 51 const LayoutRect m_clipRectInMulticolContainer; | 49 const LayoutRect m_clipRectInMulticolContainer; |
| 52 | 50 |
| 53 const LayoutMultiColumnSet* m_currentColumnSet; | 51 const LayoutMultiColumnSet* m_currentColumnSet; |
| 54 unsigned m_currentFragmentainerGroupIndex; | 52 unsigned m_currentFragmentainerGroupIndex; |
| 55 unsigned m_currentFragmentainerIndex; | 53 unsigned m_currentFragmentainerIndex; |
| 56 unsigned m_endFragmentainerIndex; | 54 unsigned m_endFragmentainerIndex; |
| 57 | 55 |
| 58 LayoutUnit m_logicalTopInFlowThread; | 56 LayoutUnit m_logicalTopInFlowThread; |
| 59 LayoutUnit m_logicalBottomInFlowThread; | 57 LayoutUnit m_logicalBottomInFlowThread; |
| 60 | 58 |
| 61 const MultiColumnFragmentainerGroup& currentGroup() const; | 59 const MultiColumnFragmentainerGroup& currentGroup() const; |
| 62 void moveToNextFragmentainerGroup(); | 60 void moveToNextFragmentainerGroup(); |
| 63 bool setFragmentainersOfInterest(); | 61 bool setFragmentainersOfInterest(); |
| 64 void setAtEnd() { m_currentColumnSet = nullptr; } | 62 void setAtEnd() { m_currentColumnSet = nullptr; } |
| 65 bool hasClipRect() const { return !m_clipRectInMulticolContainer.isEmpty(); } | 63 bool hasClipRect() const { return !m_clipRectInMulticolContainer.isEmpty(); } |
| 66 }; | 64 }; |
| 67 | 65 |
| 68 } // namespace blink | 66 } // namespace blink |
| 69 | 67 |
| 70 #endif // FragmentainerIterator_h | 68 #endif // FragmentainerIterator_h |
| OLD | NEW |