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" |
11 #include "platform/LayoutUnit.h" | 11 #include "platform/LayoutUnit.h" |
12 #include "platform/Length.h" | 12 #include "platform/Length.h" |
13 #include "platform/wtf/Optional.h" | 13 #include "platform/wtf/Optional.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 // TODO(layout-ng): | 16 // TODO(layout-ng): |
17 // - replaced calculations | 17 // - replaced calculations |
18 // - Take scrollbars into account | 18 // - Take scrollbars into account |
19 | 19 |
20 bool NeedMinMaxContentSize(const NGConstraintSpace& constraint_space, | 20 bool NeedMinMaxContentSize(const NGConstraintSpace& constraint_space, |
21 const ComputedStyle& style) { | 21 const ComputedStyle& style) { |
22 // This check is technically too broad (fill-available does not need intrinsic | 22 // This check is technically too broad (fill-available does not need intrinsic |
23 // size computation) but that's a rare case and only affects performance, not | 23 // size computation) but that's a rare case and only affects performance, not |
24 // correctness. | 24 // correctness. |
25 return constraint_space.IsShrinkToFit() || | 25 return constraint_space.IsShrinkToFit() || NeedMinMaxContentSize(style); |
26 style.LogicalWidth().IsIntrinsic() || | 26 } |
| 27 |
| 28 bool NeedMinMaxContentSize(const ComputedStyle& style) { |
| 29 return style.LogicalWidth().IsIntrinsic() || |
27 style.LogicalMinWidth().IsIntrinsic() || | 30 style.LogicalMinWidth().IsIntrinsic() || |
28 style.LogicalMaxWidth().IsIntrinsic(); | 31 style.LogicalMaxWidth().IsIntrinsic(); |
29 } | 32 } |
30 | 33 |
31 bool NeedMinMaxContentSizeForContentContribution(const ComputedStyle& style) { | 34 bool NeedMinMaxContentSizeForContentContribution(const ComputedStyle& style) { |
32 return style.LogicalWidth().IsIntrinsicOrAuto() || | 35 return style.LogicalWidth().IsIntrinsicOrAuto() || |
33 style.LogicalMinWidth().IsIntrinsic() || | 36 style.LogicalMinWidth().IsIntrinsic() || |
34 style.LogicalMaxWidth().IsIntrinsic(); | 37 style.LogicalMaxWidth().IsIntrinsic(); |
35 } | 38 } |
36 | 39 |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 if (style->ShouldPlaceBlockDirectionScrollbarOnLogicalLeft()) | 440 if (style->ShouldPlaceBlockDirectionScrollbarOnLogicalLeft()) |
438 sizes.left = vertical; | 441 sizes.left = vertical; |
439 else | 442 else |
440 sizes.right = vertical; | 443 sizes.right = vertical; |
441 } | 444 } |
442 return sizes.ConvertToLogical( | 445 return sizes.ConvertToLogical( |
443 FromPlatformWritingMode(style->GetWritingMode()), style->Direction()); | 446 FromPlatformWritingMode(style->GetWritingMode()), style->Direction()); |
444 } | 447 } |
445 | 448 |
446 } // namespace blink | 449 } // namespace blink |
OLD | NEW |