OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 NGSpaceUtils_h | 5 #ifndef NGSpaceUtils_h |
6 #define NGSpaceUtils_h | 6 #define NGSpaceUtils_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/style/ComputedStyleConstants.h" |
9 #include "platform/LayoutUnit.h" | 10 #include "platform/LayoutUnit.h" |
10 #include "platform/wtf/Optional.h" | 11 #include "platform/wtf/Optional.h" |
11 | 12 |
12 namespace blink { | 13 namespace blink { |
13 | 14 |
14 class ComputedStyle; | 15 class ComputedStyle; |
15 struct NGExclusions; | 16 struct NGExclusions; |
16 class NGLayoutInputNode; | 17 class NGLayoutInputNode; |
| 18 struct NGLogicalOffset; |
17 | 19 |
18 // Whether an in-flow child creates a new formatting context. | 20 // Whether an in-flow child creates a new formatting context. |
19 // | 21 // |
20 // This will *NOT* check the following cases: | 22 // This will *NOT* check the following cases: |
21 // - The child is a inline-level, e.g. "display: inline-block". | 23 // - The child is a inline-level, e.g. "display: inline-block". |
22 // - The child establishes a new formatting context, but should be a child of | 24 // - The child establishes a new formatting context, but should be a child of |
23 // another layout algorithm, e.g. "display: table-caption" or flex-item. | 25 // another layout algorithm, e.g. "display: table-caption" or flex-item. |
24 CORE_EXPORT bool IsNewFormattingContextForBlockLevelChild( | 26 CORE_EXPORT bool IsNewFormattingContextForBlockLevelChild( |
25 const ComputedStyle& parent_style, | 27 const ComputedStyle& parent_style, |
26 const NGLayoutInputNode& node); | 28 const NGLayoutInputNode& node); |
27 | 29 |
28 // Gets the clearance offset based on the provided {@code style} and list of | 30 // Gets the clearance offset based on the provided {@code clear_type} and list |
29 // exclusions that represent left/right float. | 31 // of exclusions that represent left/right float. |
30 CORE_EXPORT WTF::Optional<LayoutUnit> GetClearanceOffset( | 32 CORE_EXPORT WTF::Optional<LayoutUnit> GetClearanceOffset( |
31 const std::shared_ptr<NGExclusions>& exclusions, | 33 const std::shared_ptr<NGExclusions>& exclusions, |
32 const ComputedStyle& style); | 34 EClear clear_type); |
33 | 35 |
34 // Whether child's constraint space should shrink to its intrinsic width. | 36 // Whether child's constraint space should shrink to its intrinsic width. |
35 // This is needed for buttons, select, input, floats and orthogonal children. | 37 // This is needed for buttons, select, input, floats and orthogonal children. |
36 // See LayoutBox::sizesLogicalWidthToFitContent for the rationale behind this. | 38 // See LayoutBox::sizesLogicalWidthToFitContent for the rationale behind this. |
37 bool ShouldShrinkToFit(const ComputedStyle& parent_style, | 39 bool ShouldShrinkToFit(const ComputedStyle& parent_style, |
38 const ComputedStyle& style); | 40 const ComputedStyle& style); |
39 | 41 |
| 42 // Adjusts {@code offset} to the clearance line. |
| 43 CORE_EXPORT void AdjustToClearance( |
| 44 const WTF::Optional<LayoutUnit>& clearance_offset, |
| 45 NGLogicalOffset* offset); |
| 46 |
40 } // namespace blink | 47 } // namespace blink |
41 | 48 |
42 #endif // NGSpaceUtils_h | 49 #endif // NGSpaceUtils_h |
OLD | NEW |