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 NGConstraintSpace_h | 5 #ifndef NGConstraintSpace_h |
6 #define NGConstraintSpace_h | 6 #define NGConstraintSpace_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/layout/ng/ng_physical_constraint_space.h" | 9 #include "core/layout/ng/ng_physical_constraint_space.h" |
10 #include "core/layout/ng/ng_writing_mode.h" | 10 #include "core/layout/ng/ng_writing_mode.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
12 #include "wtf/text/WTFString.h" | 12 #include "wtf/text/WTFString.h" |
13 #include "wtf/Vector.h" | 13 #include "wtf/Vector.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class LayoutBox; | 17 class LayoutBox; |
18 class NGFragment; | 18 class NGFragment; |
19 class NGLayoutOpportunityIterator; | 19 class NGLayoutOpportunityIterator; |
20 | 20 |
21 // The NGConstraintSpace represents a set of constraints and available space | 21 // The NGConstraintSpace represents a set of constraints and available space |
22 // which a layout algorithm may produce a NGFragment within. It is a view on | 22 // which a layout algorithm may produce a NGFragment within. It is a view on |
23 // top of a NGPhysicalConstraintSpace and provides accessor methods in the | 23 // top of a NGPhysicalConstraintSpace and provides accessor methods in the |
24 // logical coordinate system defined by the writing mode given. | 24 // logical coordinate system defined by the writing mode given. |
25 class CORE_EXPORT NGConstraintSpace final | 25 class CORE_EXPORT NGConstraintSpace final |
26 : public GarbageCollected<NGConstraintSpace> { | 26 : public GarbageCollected<NGConstraintSpace> { |
27 public: | 27 public: |
28 // Constructs a constraint space with a new backing NGPhysicalConstraintSpace. | |
29 // The size will be used for both for the physical constraint space's | |
30 // container size and this constraint space's Size(). | |
31 NGConstraintSpace(NGWritingMode, NGDirection, NGLogicalSize); | |
32 | |
33 // Constructs a constraint space based on an existing backing | 28 // Constructs a constraint space based on an existing backing |
34 // NGPhysicalConstraintSpace. Sets this constraint space's size to the | 29 // NGPhysicalConstraintSpace. Sets this constraint space's size to the |
35 // physical constraint space's container size, converted to logical | 30 // physical constraint space's container size, converted to logical |
36 // coordinates. | 31 // coordinates. |
37 // TODO(layout-ng): Do we need this constructor? | |
38 NGConstraintSpace(NGWritingMode, NGDirection, NGPhysicalConstraintSpace*); | 32 NGConstraintSpace(NGWritingMode, NGDirection, NGPhysicalConstraintSpace*); |
39 | 33 |
40 // Constructs a constraint space with a different NGWritingMode and | 34 // Constructs a constraint space with a new backing NGPhysicalConstraintSpace. |
41 // NGDirection that's otherwise identical. | 35 // The size will be used for both for the physical constraint space's |
42 NGConstraintSpace(NGWritingMode, NGDirection, const NGConstraintSpace*); | 36 // container size and this constraint space's Size(). |
| 37 // TODO(layout-dev): Remove once NGConstraintSpaceBuilder exists. |
| 38 NGConstraintSpace(NGWritingMode, NGDirection, NGLogicalSize); |
43 | 39 |
44 // Constructs a derived constraint space sharing the same backing | 40 // Constructs a derived constraint space sharing the same backing |
45 // NGPhysicalConstraintSpace, NGWritingMode and NGDirection. Primarily for use | 41 // NGPhysicalConstraintSpace, NGWritingMode and NGDirection. Primarily for use |
46 // by NGLayoutOpportunityIterator. | 42 // by NGLayoutOpportunityIterator. |
| 43 // TODO(layout-dev): Remove once NGConstraintSpaceBuilder exists. |
47 NGConstraintSpace(const NGConstraintSpace& other, | 44 NGConstraintSpace(const NGConstraintSpace& other, |
48 NGLogicalOffset, | 45 NGLogicalOffset, |
49 NGLogicalSize); | 46 NGLogicalSize); |
50 | 47 |
51 // Constructs a derived constraint space that shares the exclusions of the | 48 // Constructs a derived constraint space that shares the exclusions of the |
52 // input constraint space, but has a different container size, writing mode | 49 // input constraint space, but has a different container size, writing mode |
53 // and direction. Sets the offset to zero. For use by layout algorithms | 50 // and direction. Sets the offset to zero. For use by layout algorithms |
54 // to use as the basis to find layout opportunities for children. | 51 // to use as the basis to find layout opportunities for children. |
| 52 // TODO(layout-dev): Remove once NGConstraintSpaceBuilder exists. |
55 NGConstraintSpace(NGWritingMode, | 53 NGConstraintSpace(NGWritingMode, |
56 NGDirection, | 54 NGDirection, |
57 const NGConstraintSpace& other, | 55 const NGConstraintSpace& other, |
58 NGLogicalSize); | 56 NGLogicalSize); |
59 | 57 |
60 // This should live on NGBox or another layout bridge and probably take a root | 58 // This should live on NGBox or another layout bridge and probably take a root |
61 // NGConstraintSpace or a NGPhysicalConstraintSpace. | 59 // NGConstraintSpace or a NGPhysicalConstraintSpace. |
62 static NGConstraintSpace* CreateFromLayoutObject(const LayoutBox&); | 60 static NGConstraintSpace* CreateFromLayoutObject(const LayoutBox&); |
63 | 61 |
64 // Mutable Getters. | 62 // Mutable Getters. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 }; | 148 }; |
151 | 149 |
152 inline std::ostream& operator<<(std::ostream& stream, | 150 inline std::ostream& operator<<(std::ostream& stream, |
153 const NGConstraintSpace& value) { | 151 const NGConstraintSpace& value) { |
154 return stream << value.ToString(); | 152 return stream << value.ToString(); |
155 } | 153 } |
156 | 154 |
157 } // namespace blink | 155 } // namespace blink |
158 | 156 |
159 #endif // NGConstraintSpace_h | 157 #endif // NGConstraintSpace_h |
OLD | NEW |