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