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" |
(...skipping 13 matching lines...) Expand all Loading... |
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 based on an existing backing | 28 // Constructs a constraint space based on an existing backing |
29 // NGPhysicalConstraintSpace. Sets this constraint space's size to the | 29 // NGPhysicalConstraintSpace. Sets this constraint space's size to the |
30 // physical constraint space's container size, converted to logical | 30 // physical constraint space's container size, converted to logical |
31 // coordinates. | 31 // coordinates. |
32 NGConstraintSpace(NGWritingMode, NGDirection, NGPhysicalConstraintSpace*); | 32 NGConstraintSpace(NGWritingMode, NGDirection, NGPhysicalConstraintSpace*); |
33 | 33 |
34 // Constructs a derived constraint space that shares the exclusions of the | |
35 // input constraint space, but has a different container size, writing mode | |
36 // and direction. Sets the offset to zero. For use by layout algorithms | |
37 // to use as the basis to find layout opportunities for children. | |
38 // TODO(layout-dev): Remove once NGConstraintSpaceBuilder exists. | |
39 NGConstraintSpace(NGWritingMode, | |
40 NGDirection, | |
41 const NGConstraintSpace& other, | |
42 NGLogicalSize); | |
43 | |
44 // This should live on NGBox or another layout bridge and probably take a root | 34 // This should live on NGBox or another layout bridge and probably take a root |
45 // NGConstraintSpace or a NGPhysicalConstraintSpace. | 35 // NGConstraintSpace or a NGPhysicalConstraintSpace. |
46 static NGConstraintSpace* CreateFromLayoutObject(const LayoutBox&); | 36 static NGConstraintSpace* CreateFromLayoutObject(const LayoutBox&); |
47 | 37 |
48 // Mutable Getters. | 38 // Mutable Getters. |
49 // TODO(layout-dev): remove const constraint from MutablePhysicalSpace method | 39 // TODO(layout-dev): remove const constraint from MutablePhysicalSpace method |
50 NGPhysicalConstraintSpace* MutablePhysicalSpace() const { | 40 NGPhysicalConstraintSpace* MutablePhysicalSpace() const { |
51 return physical_space_; | 41 return physical_space_; |
52 } | 42 } |
53 | 43 |
(...skipping 22 matching lines...) Expand all Loading... |
76 NGLogicalSize ContainerSize() const; | 66 NGLogicalSize ContainerSize() const; |
77 | 67 |
78 // Offset relative to the root constraint space. | 68 // Offset relative to the root constraint space. |
79 NGLogicalOffset Offset() const { return offset_; } | 69 NGLogicalOffset Offset() const { return offset_; } |
80 | 70 |
81 // Returns the effective size of the constraint space. Equal to the | 71 // Returns the effective size of the constraint space. Equal to the |
82 // ContainerSize() for the root constraint space but derived constraint spaces | 72 // ContainerSize() for the root constraint space but derived constraint spaces |
83 // return the size of the layout opportunity. | 73 // return the size of the layout opportunity. |
84 virtual NGLogicalSize Size() const { return size_; } | 74 virtual NGLogicalSize Size() const { return size_; } |
85 | 75 |
| 76 // Sets the effective size of the constraint space. |
| 77 void SetSize(NGLogicalSize); |
| 78 |
86 // Whether the current constraint space is for the newly established | 79 // Whether the current constraint space is for the newly established |
87 // Formatting Context. | 80 // Formatting Context. |
88 bool IsNewFormattingContext() const; | 81 bool IsNewFormattingContext() const; |
89 | 82 |
90 // Whether exceeding the containerSize triggers the presence of a scrollbar | 83 // Whether exceeding the containerSize triggers the presence of a scrollbar |
91 // for the indicated direction. | 84 // for the indicated direction. |
92 // If exceeded the current layout should be aborted and invoked again with a | 85 // If exceeded the current layout should be aborted and invoked again with a |
93 // constraint space modified to reserve space for a scrollbar. | 86 // constraint space modified to reserve space for a scrollbar. |
94 bool InlineTriggersScrollbar() const; | 87 bool InlineTriggersScrollbar() const; |
95 bool BlockTriggersScrollbar() const; | 88 bool BlockTriggersScrollbar() const; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 }; | 127 }; |
135 | 128 |
136 inline std::ostream& operator<<(std::ostream& stream, | 129 inline std::ostream& operator<<(std::ostream& stream, |
137 const NGConstraintSpace& value) { | 130 const NGConstraintSpace& value) { |
138 return stream << value.ToString(); | 131 return stream << value.ToString(); |
139 } | 132 } |
140 | 133 |
141 } // namespace blink | 134 } // namespace blink |
142 | 135 |
143 #endif // NGConstraintSpace_h | 136 #endif // NGConstraintSpace_h |
OLD | NEW |