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 NGLayoutOpportunityTreeNode_h | 5 #ifndef NGLayoutOpportunityTreeNode_h |
6 #define NGLayoutOpportunityTreeNode_h | 6 #define NGLayoutOpportunityTreeNode_h |
7 | 7 |
8 #include "core/layout/ng/ng_units.h" | 8 #include "core/layout/ng/ng_units.h" |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class NGConstraintSpace; | 13 class NGConstraintSpace; |
14 struct NGExclusion; | 14 struct NGExclusion; |
15 | 15 |
16 // 3 node R-Tree that represents available space(left, bottom, right) or | 16 // 3 node R-Tree that represents available space(left, bottom, right) or |
17 // layout opportunity after the parent spatial rectangle is split by the | 17 // layout opportunity after the parent spatial rectangle is split by the |
18 // exclusion rectangle. | 18 // exclusion rectangle. |
19 struct CORE_EXPORT NGLayoutOpportunityTreeNode | 19 struct CORE_EXPORT NGLayoutOpportunityTreeNode |
20 : public GarbageCollected<NGLayoutOpportunityTreeNode> { | 20 : public GarbageCollected<NGLayoutOpportunityTreeNode> { |
21 // Default constructor. | 21 // Default constructor. |
22 // Creates a Layout Opportunity tree node that is limited by it's own edge | 22 // Creates a Layout Opportunity tree node that is limited by it's own edge |
23 // from above. | 23 // from above. |
24 // @param space Constraint space associated with this node. | 24 // @param opportunity The layout opportunity for this node. |
25 NGLayoutOpportunityTreeNode(const NGConstraintSpace* space); | 25 NGLayoutOpportunityTreeNode(const NGLogicalRect opportunity); |
26 | 26 |
27 // Constructor that creates a node with explicitly set exclusion edge. | 27 // Constructor that creates a node with explicitly set exclusion edge. |
28 // @param space Constraint space associated with this node. | 28 // @param opportunity The layout opportunity for this node. |
29 // @param exclusion_edge Edge that limits this node's space from above. | 29 // @param exclusion_edge Edge that limits this node's opportunity from above. |
30 NGLayoutOpportunityTreeNode(NGConstraintSpace* space, NGEdge exclusion_edge); | 30 NGLayoutOpportunityTreeNode(const NGLogicalRect opportunity, |
31 | 31 NGEdge exclusion_edge); |
32 // Constraint space that is associated with this node. | |
33 Member<const NGConstraintSpace> space; | |
34 | 32 |
35 // Children of the node. | 33 // Children of the node. |
36 Member<NGLayoutOpportunityTreeNode> left; | 34 Member<NGLayoutOpportunityTreeNode> left; |
37 Member<NGLayoutOpportunityTreeNode> bottom; | 35 Member<NGLayoutOpportunityTreeNode> bottom; |
38 Member<NGLayoutOpportunityTreeNode> right; | 36 Member<NGLayoutOpportunityTreeNode> right; |
39 | 37 |
40 // Exclusion that split apart this layout opportunity. | 38 // Exclusion that split apart this layout opportunity. |
41 Member<const NGExclusion> exclusion; | 39 Member<const NGExclusion> exclusion; |
42 | 40 |
| 41 // The top layout opportunity associated with this node. |
| 42 NGLogicalRect opportunity; |
| 43 |
43 // Edge that limits this layout opportunity from above. | 44 // Edge that limits this layout opportunity from above. |
44 NGEdge exclusion_edge; | 45 NGEdge exclusion_edge; |
45 | 46 |
46 // Whether this node is a leaf node. | 47 // Whether this node is a leaf node. |
47 // The node is a leaf if it doen't have an exclusion that splits it apart. | 48 // The node is a leaf if it doesn't have an exclusion that splits it apart. |
48 bool IsLeafNode() const { return !exclusion; } | 49 bool IsLeafNode() const { return !exclusion; } |
49 | 50 |
50 DECLARE_TRACE(); | 51 DECLARE_TRACE(); |
51 }; | 52 }; |
52 | 53 |
53 } // namespace blink | 54 } // namespace blink |
54 #endif // NGLayoutOpportunityTreeNode_h | 55 #endif // NGLayoutOpportunityTreeNode_h |
OLD | NEW |