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