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 NGLayoutAlgorithm_h | 5 #ifndef NGLayoutAlgorithm_h |
6 #define NGLayoutAlgorithm_h | 6 #define NGLayoutAlgorithm_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/layout/ng/ng_units.h" | 9 #include "core/layout/ng/ng_min_max_content_size.h" |
10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
11 #include "wtf/Noncopyable.h" | 11 #include "wtf/Noncopyable.h" |
12 #include "wtf/Optional.h" | 12 #include "wtf/Optional.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 struct MinAndMaxContentSizes; | 16 struct MinMaxContentSize; |
17 class NGLayoutResult; | 17 class NGLayoutResult; |
18 | 18 |
19 // Base class for all LayoutNG algorithms. | 19 // Base class for all LayoutNG algorithms. |
20 class CORE_EXPORT NGLayoutAlgorithm { | 20 class CORE_EXPORT NGLayoutAlgorithm { |
21 STACK_ALLOCATED(); | 21 STACK_ALLOCATED(); |
22 | 22 |
23 public: | 23 public: |
24 virtual ~NGLayoutAlgorithm() {} | 24 virtual ~NGLayoutAlgorithm() {} |
25 | 25 |
26 // Actual layout function. Lays out the children and descendents within the | 26 // Actual layout function. Lays out the children and descendents within the |
27 // constraints given by the NGConstraintSpace. Returns a layout result with | 27 // constraints given by the NGConstraintSpace. Returns a layout result with |
28 // the resulting layout information. | 28 // the resulting layout information. |
29 // TODO(layout-dev): attempt to make this function const. | 29 // TODO(layout-dev): attempt to make this function const. |
30 virtual RefPtr<NGLayoutResult> Layout() = 0; | 30 virtual RefPtr<NGLayoutResult> Layout() = 0; |
31 | 31 |
32 // Computes the min-content and max-content intrinsic sizes for the given box. | 32 // Computes the min-content and max-content intrinsic sizes for the given box. |
33 // The result will not take any min-width, max-width or width properties into | 33 // The result will not take any min-width, max-width or width properties into |
34 // account. If the return value is empty, the caller is expected to synthesize | 34 // account. If the return value is empty, the caller is expected to synthesize |
35 // this value from the overflow rect returned from Layout called with an | 35 // this value from the overflow rect returned from Layout called with an |
36 // available width of 0 and LayoutUnit::max(), respectively. | 36 // available width of 0 and LayoutUnit::max(), respectively. |
37 virtual Optional<MinAndMaxContentSizes> ComputeMinAndMaxContentSizes() const { | 37 virtual Optional<MinMaxContentSize> ComputeMinMaxContentSize() const { |
38 return WTF::nullopt; | 38 return WTF::nullopt; |
39 } | 39 } |
40 }; | 40 }; |
41 | 41 |
42 } // namespace blink | 42 } // namespace blink |
43 | 43 |
44 #endif // NGLayoutAlgorithm_h | 44 #endif // NGLayoutAlgorithm_h |
OLD | NEW |