Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_tree_node.h

Issue 2438313003: [LayoutNG] Remove derived constraint spaces from opportunity iterator. (Closed)
Patch Set: .. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "platform/heap/Handle.h" 8 #include "platform/heap/Handle.h"
9 #include "core/layout/ng/ng_units.h" 9 #include "core/layout/ng/ng_units.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 // 3 node R-Tree that represents available space(left, bottom, right) or 13 // 3 node R-Tree that represents available space(left, bottom, right) or
14 // layout opportunity after the parent spatial rectangle is split by the 14 // layout opportunity after the parent spatial rectangle is split by the
15 // exclusion rectangle. 15 // exclusion rectangle.
16 struct NGLayoutOpportunityTreeNode 16 struct NGLayoutOpportunityTreeNode
17 : public GarbageCollected<NGLayoutOpportunityTreeNode> { 17 : public GarbageCollected<NGLayoutOpportunityTreeNode> {
18 // Default constructor. 18 // Default constructor.
19 // Creates a Layout Opportunity tree node that is limited by it's own edge 19 // Creates a Layout Opportunity tree node that is limited by it's own edge
20 // from above. 20 // from above.
21 // @param space Constraint space associated with this node. 21 // @param layout_area The layout area for this node.
22 NGLayoutOpportunityTreeNode(const NGConstraintSpace* space) : space(space) { 22 NGLayoutOpportunityTreeNode(const NGLogicalRect layout_area)
23 exclusion_edge.start = space->Offset().inline_offset; 23 : layout_area(layout_area) {
24 exclusion_edge.end = exclusion_edge.start + space->Size().inline_size; 24 exclusion_edge.start = layout_area.offset.inline_offset;
25 exclusion_edge.end = exclusion_edge.start + layout_area.size.inline_size;
25 } 26 }
26 27
27 // Constructor that creates a node with explicitly set exclusion edge. 28 // Constructor that creates a node with explicitly set exclusion edge.
28 // @param space Constraint space associated with this node. 29 // @param space Constraint space associated with this node.
29 // @param exclusion_edge Edge that limits this node's space from above. 30 // @param exclusion_edge Edge that limits this node's space from above.
30 NGLayoutOpportunityTreeNode(NGConstraintSpace* space, NGEdge exclusion_edge) 31 NGLayoutOpportunityTreeNode(const NGLogicalRect layout_area,
31 : space(space), exclusion_edge(exclusion_edge) {} 32 NGEdge exclusion_edge)
32 33 : layout_area(layout_area), exclusion_edge(exclusion_edge) {}
33 // Constraint space that is associated with this node.
34 Member<const NGConstraintSpace> space;
35 34
36 // Children of the node. 35 // Children of the node.
37 Member<NGLayoutOpportunityTreeNode> left; 36 Member<NGLayoutOpportunityTreeNode> left;
38 Member<NGLayoutOpportunityTreeNode> bottom; 37 Member<NGLayoutOpportunityTreeNode> bottom;
39 Member<NGLayoutOpportunityTreeNode> right; 38 Member<NGLayoutOpportunityTreeNode> right;
40 39
41 // Exclusion that split apart this layout opportunity. 40 // Exclusion that split apart this layout area.
42 Member<const NGExclusion> exclusion; 41 Member<const NGExclusion> exclusion;
43 42
44 // Edge that limits this layout opportunity from above. 43 // The top layout area associated with this node.
44 NGLogicalRect layout_area;
ikilpatrick 2016/10/21 20:24:11 I renamed this area, as if it has an exclusion it
Gleb Lanbin 2016/10/21 21:06:59 how about this struct NGLayoutOpportunityTreeNode
ikilpatrick 2016/10/21 21:45:27 Renamed back to opportunity for now.
45
46 // Edge that limits this layout area from above.
45 NGEdge exclusion_edge; 47 NGEdge exclusion_edge;
46 48
47 // Whether this node is a leaf node. 49 // Whether this node is a leaf node.
48 // The node is a leaf if it doen't have an exclusion that splits it apart. 50 // The node is a leaf if it doesn't have an exclusion that splits it apart.
49 bool IsLeafNode() const { return !exclusion; } 51 bool IsLeafNode() const { return !exclusion; }
50 52
51 DEFINE_INLINE_TRACE() { 53 DEFINE_INLINE_TRACE() {
52 visitor->trace(space);
53 visitor->trace(left); 54 visitor->trace(left);
54 visitor->trace(bottom); 55 visitor->trace(bottom);
55 visitor->trace(right); 56 visitor->trace(right);
56 visitor->trace(exclusion); 57 visitor->trace(exclusion);
57 } 58 }
58 }; 59 };
59 60
60 } // namespace blink 61 } // namespace blink
61 #endif // NGLayoutOpportunityTreeNode_h 62 #endif // NGLayoutOpportunityTreeNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698