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/layout/ng/ng_constraint_space.h" | 8 #include "core/layout/ng/ng_constraint_space.h" |
9 #include "core/style/ComputedStyle.h" | 9 #include "core/style/ComputedStyle.h" |
10 #include "wtf/Optional.h" | 10 #include "wtf/Optional.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 // Whether an in-flow block-level child creates a new formatting context. | 14 // Whether an in-flow block-level child creates a new formatting context. |
15 // | 15 // |
16 // This will *NOT* check the following cases: | 16 // This will *NOT* check the following cases: |
17 // - The child is out-of-flow, e.g. floating or abs-pos. | |
18 // - The child is a inline-level, e.g. "display: inline-block". | 17 // - The child is a inline-level, e.g. "display: inline-block". |
19 // - The child establishes a new formatting context, but should be a child of | 18 // - The child establishes a new formatting context, but should be a child of |
20 // another layout algorithm, e.g. "display: table-caption" or flex-item. | 19 // another layout algorithm, e.g. "display: table-caption" or flex-item. |
21 CORE_EXPORT bool IsNewFormattingContextForInFlowBlockLevelChild( | 20 CORE_EXPORT bool IsNewFormattingContextForBlockLevelChild( |
22 const NGConstraintSpace& space, | 21 const NGConstraintSpace& space, |
23 const ComputedStyle& style); | 22 const ComputedStyle& style); |
24 | 23 |
25 // Gets the clearance offset based on the provided {@code style} and list of | 24 // Gets the clearance offset based on the provided {@code style} and list of |
26 // exclusions that represent left/right float. | 25 // exclusions that represent left/right float. |
27 CORE_EXPORT WTF::Optional<LayoutUnit> GetClearanceOffset( | 26 CORE_EXPORT WTF::Optional<LayoutUnit> GetClearanceOffset( |
28 const std::shared_ptr<NGExclusions>& exclusions, | 27 const std::shared_ptr<NGExclusions>& exclusions, |
29 const ComputedStyle& style); | 28 const ComputedStyle& style); |
30 | 29 |
31 // Whether child's constraint space should shrink to its intrinsic width. | 30 // Whether child's constraint space should shrink to its intrinsic width. |
32 // This is needed for buttons, select, input, floats and orthogonal children. | 31 // This is needed for buttons, select, input, floats and orthogonal children. |
33 // See LayoutBox::sizesLogicalWidthToFitContent for the rationale behind this. | 32 // See LayoutBox::sizesLogicalWidthToFitContent for the rationale behind this. |
34 bool ShouldShrinkToFit(const NGConstraintSpace& parent_space, | 33 bool ShouldShrinkToFit(const NGConstraintSpace& parent_space, |
35 const ComputedStyle& style); | 34 const ComputedStyle& style); |
36 | 35 |
37 } // namespace blink | 36 } // namespace blink |
38 | 37 |
39 #endif // NGSpaceUtils_h | 38 #endif // NGSpaceUtils_h |
OLD | NEW |