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