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 NGLayoutOpportunityIterator_h | 5 #ifndef NGLayoutOpportunityIterator_h |
6 #define NGLayoutOpportunityIterator_h | 6 #define NGLayoutOpportunityIterator_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/layout/ng/ng_layout_opportunity_tree_node.h" | 9 #include "core/layout/ng/ng_layout_opportunity_tree_node.h" |
10 #include "wtf/Optional.h" | 10 #include "wtf/Optional.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // @param opt_leader_point Optional 'leader' parameter that is used to specify | 28 // @param opt_leader_point Optional 'leader' parameter that is used to specify |
29 // the ending point of temporary excluded rectangle | 29 // the ending point of temporary excluded rectangle |
30 // which starts from 'origin'. This rectangle may | 30 // which starts from 'origin'. This rectangle may |
31 // represent a text fragment for example. | 31 // represent a text fragment for example. |
32 NGLayoutOpportunityIterator( | 32 NGLayoutOpportunityIterator( |
33 const NGConstraintSpace* space, | 33 const NGConstraintSpace* space, |
34 const NGLogicalSize& available_size, | 34 const NGLogicalSize& available_size, |
35 const WTF::Optional<NGLogicalOffset>& opt_offset = WTF::nullopt, | 35 const WTF::Optional<NGLogicalOffset>& opt_offset = WTF::nullopt, |
36 const WTF::Optional<NGLogicalOffset>& opt_leader_point = WTF::nullopt); | 36 const WTF::Optional<NGLogicalOffset>& opt_leader_point = WTF::nullopt); |
37 | 37 |
38 // Gets the next Layout Opportunity or nullptr if the search is exhausted. | 38 // Gets the next Layout Opportunity or empty one if the search is exhausted. |
39 // TODO(chrome-layout-team): Refactor with using C++ <iterator> library. | 39 // TODO(chrome-layout-team): Refactor with using C++ <iterator> library. |
| 40 // TODO(glebl): Refactor the iterator to return unique_ptr here. |
40 const NGLayoutOpportunity Next(); | 41 const NGLayoutOpportunity Next(); |
41 | 42 |
42 // Offset that specifies the starting point to search layout opportunities. | 43 // Offset that specifies the starting point to search layout opportunities. |
43 // It's either {@code opt_offset} or space->BfcOffset(). | 44 // It's either {@code opt_offset} or space->BfcOffset(). |
44 NGLogicalOffset Offset() const { return offset_; } | 45 NGLogicalOffset Offset() const { return offset_; } |
45 | 46 |
46 #ifndef NDEBUG | 47 #ifndef NDEBUG |
47 // Prints Layout Opportunity tree for debug purposes. | 48 // Prints Layout Opportunity tree for debug purposes. |
48 void ShowLayoutOpportunityTree() const; | 49 void ShowLayoutOpportunityTree() const; |
49 #endif | 50 #endif |
(...skipping 13 matching lines...) Expand all Loading... |
63 | 64 |
64 NGLayoutOpportunities opportunities_; | 65 NGLayoutOpportunities opportunities_; |
65 NGLayoutOpportunities::const_iterator opportunity_iter_; | 66 NGLayoutOpportunities::const_iterator opportunity_iter_; |
66 std::unique_ptr<NGLayoutOpportunityTreeNode> opportunity_tree_root_; | 67 std::unique_ptr<NGLayoutOpportunityTreeNode> opportunity_tree_root_; |
67 NGLogicalOffset offset_; | 68 NGLogicalOffset offset_; |
68 }; | 69 }; |
69 | 70 |
70 } // namespace blink | 71 } // namespace blink |
71 | 72 |
72 #endif // NGLayoutOpportunityIterator_h | 73 #endif // NGLayoutOpportunityIterator_h |
OLD | NEW |