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 "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
10 #include "wtf/Noncopyable.h" | 10 #include "wtf/Noncopyable.h" |
(...skipping 15 matching lines...) Expand all Loading... |
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 fragment with the | 27 // constraints given by the NGConstraintSpace. Returns a fragment with the |
28 // resulting layout information. | 28 // resulting layout information. |
29 // This function can not be const because for interruptible layout, we have | 29 // This function can not be const because for interruptible layout, we have |
30 // to be able to store state information. | 30 // to be able to store state information. |
31 // Returns true when done; when this function returns false, it has to be | 31 // Returns true when done; when this function returns false, it has to be |
32 // called again. The out parameter will only be set when this function | 32 // called again. The out parameter will only be set when this function |
33 // returns true. | 33 // returns true. |
34 virtual bool Layout(NGPhysicalFragment**) = 0; | 34 virtual bool Layout(NGPhysicalFragment**) = 0; |
35 | 35 |
| 36 enum MinAndMaxState { Success, Pending, NotImplemented }; |
| 37 |
| 38 // Computes the min-content and max-content intrinsic sizes for the given box. |
| 39 // The result will not take any min-width. max-width or width properties into |
| 40 // account. Implementations can return NotImpplemented in which case the |
| 41 // caller is expected ot synthesize this value from the overflow rect returned |
| 42 // from Layout called with a container width of 0 and LayoutUnit::max(), |
| 43 // respectively. |
| 44 // A Pending return value has the same meaning as a false return from layout, |
| 45 // i.e. it is a request to call this function again. |
| 46 virtual MinAndMaxState ComputeMinAndMaxContentSizes(MinAndMaxContentSizes*) { |
| 47 return NotImplemented; |
| 48 } |
| 49 |
36 DEFINE_INLINE_VIRTUAL_TRACE() {} | 50 DEFINE_INLINE_VIRTUAL_TRACE() {} |
37 }; | 51 }; |
38 | 52 |
39 } // namespace blink | 53 } // namespace blink |
40 | 54 |
41 #endif // NGLayoutAlgorithm_h | 55 #endif // NGLayoutAlgorithm_h |
OLD | NEW |