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 #include "core/layout/ng/ng_length_utils.h" | 5 #include "core/layout/ng/ng_length_utils.h" |
6 | 6 |
7 #include "core/layout/ng/ng_constraint_space.h" | 7 #include "core/layout/ng/ng_constraint_space.h" |
8 #include "core/layout/ng/ng_constraint_space_builder.h" | 8 #include "core/layout/ng/ng_constraint_space_builder.h" |
9 #include "core/layout/ng/ng_fragment.h" | 9 #include "core/layout/ng/ng_fragment.h" |
10 #include "core/style/ComputedStyle.h" | 10 #include "core/style/ComputedStyle.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 } | 36 } |
37 | 37 |
38 LayoutUnit ResolveInlineLength( | 38 LayoutUnit ResolveInlineLength( |
39 const NGConstraintSpace& constraint_space, | 39 const NGConstraintSpace& constraint_space, |
40 const ComputedStyle& style, | 40 const ComputedStyle& style, |
41 const WTF::Optional<MinAndMaxContentSizes>& min_and_max, | 41 const WTF::Optional<MinAndMaxContentSizes>& min_and_max, |
42 const Length& length, | 42 const Length& length, |
43 LengthResolveType type) { | 43 LengthResolveType type) { |
44 DCHECK(!length.isMaxSizeNone()); | 44 DCHECK(!length.isMaxSizeNone()); |
45 DCHECK_GE(constraint_space.AvailableSize().inline_size, LayoutUnit()); | 45 DCHECK_GE(constraint_space.AvailableSize().inline_size, LayoutUnit()); |
| 46 DCHECK_GE(constraint_space.PercentageResolutionSize().inline_size, |
| 47 LayoutUnit()); |
46 | 48 |
47 if (type == LengthResolveType::kMinSize && length.isAuto()) | 49 if (type == LengthResolveType::kMinSize && length.isAuto()) |
48 return LayoutUnit(); | 50 return LayoutUnit(); |
49 | 51 |
50 if (type == LengthResolveType::kMarginBorderPaddingSize && length.isAuto()) | 52 if (type == LengthResolveType::kMarginBorderPaddingSize && length.isAuto()) |
51 return LayoutUnit(); | 53 return LayoutUnit(); |
52 | 54 |
53 // We don't need this when we're resolving margin/border/padding; skip | 55 // We don't need this when we're resolving margin/border/padding; skip |
54 // computing it as an optimization and to simplify the code below. | 56 // computing it as an optimization and to simplify the code below. |
55 NGBoxStrut border_and_padding; | 57 NGBoxStrut border_and_padding; |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 Optional<LayoutUnit> min, | 407 Optional<LayoutUnit> min, |
406 Optional<LayoutUnit> max) { | 408 Optional<LayoutUnit> max) { |
407 if (max && length > max.value()) | 409 if (max && length > max.value()) |
408 length = max.value(); | 410 length = max.value(); |
409 if (min && length < min.value()) | 411 if (min && length < min.value()) |
410 length = min.value(); | 412 length = min.value(); |
411 return length; | 413 return length; |
412 } | 414 } |
413 | 415 |
414 } // namespace blink | 416 } // namespace blink |
OLD | NEW |