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 "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
(...skipping 20 matching lines...) Expand all Loading... |
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 WTF::Optional<NGLogicalOffset>& opt_origin_point = WTF::nullopt, | 34 const WTF::Optional<NGLogicalOffset>& opt_origin_point = WTF::nullopt, |
35 const WTF::Optional<NGLogicalOffset>& opt_leader_point = WTF::nullopt); | 35 const WTF::Optional<NGLogicalOffset>& opt_leader_point = WTF::nullopt); |
36 | 36 |
37 // Gets the next Layout Opportunity or nullptr if the search is exhausted. | 37 // Gets the next Layout Opportunity or nullptr if the search is exhausted. |
38 // TODO(chrome-layout-team): Refactor with using C++ <iterator> library. | 38 // TODO(chrome-layout-team): Refactor with using C++ <iterator> library. |
39 const NGLayoutOpportunity Next(); | 39 const NGLayoutOpportunity Next(); |
40 | 40 |
| 41 #ifndef NDEBUG |
| 42 // Prints Layout Opportunity tree for debug purposes. |
| 43 void ShowLayoutOpportunityTree() const; |
| 44 #endif |
| 45 |
41 private: | 46 private: |
42 // Mutable Getters. | 47 // Mutable Getters. |
43 NGLayoutOpportunityTreeNode* MutableOpportunityTreeRoot() { | 48 NGLayoutOpportunityTreeNode* MutableOpportunityTreeRoot() { |
44 return opportunity_tree_root_.get(); | 49 return opportunity_tree_root_.get(); |
45 } | 50 } |
46 | 51 |
47 // Read-only Getters. | 52 // Read-only Getters. |
48 const NGLayoutOpportunityTreeNode* OpportunityTreeRoot() const { | 53 const NGLayoutOpportunityTreeNode* OpportunityTreeRoot() const { |
49 return opportunity_tree_root_.get(); | 54 return opportunity_tree_root_.get(); |
50 } | 55 } |
51 | 56 |
52 const NGConstraintSpace* constraint_space_; | 57 const NGConstraintSpace* constraint_space_; |
53 | 58 |
54 NGLayoutOpportunities opportunities_; | 59 NGLayoutOpportunities opportunities_; |
55 NGLayoutOpportunities::const_iterator opportunity_iter_; | 60 NGLayoutOpportunities::const_iterator opportunity_iter_; |
56 Persistent<NGLayoutOpportunityTreeNode> opportunity_tree_root_; | 61 Persistent<NGLayoutOpportunityTreeNode> opportunity_tree_root_; |
57 }; | 62 }; |
58 | 63 |
59 } // namespace blink | 64 } // namespace blink |
60 | 65 |
61 #endif // NGLayoutOpportunityIterator_h | 66 #endif // NGLayoutOpportunityIterator_h |
OLD | NEW |