Chromium Code Reviews| 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_absolute_utils.h" | 5 #include "core/layout/ng/ng_absolute_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_length_utils.h" | 8 #include "core/layout/ng/ng_length_utils.h" |
| 9 #include "core/style/ComputedStyle.h" | 9 #include "core/style/ComputedStyle.h" |
| 10 #include "platform/LengthFunctions.h" | 10 #include "platform/LengthFunctions.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 bool AbsoluteHorizontalNeedsEstimate(const ComputedStyle& style) { | 16 bool AbsoluteHorizontalNeedsEstimate(const ComputedStyle& style) { |
| 17 Length width = style.Width(); | 17 Length width = style.Width(); |
| 18 return width.IsIntrinsic() || | 18 return style.MinWidth().IsIntrinsic() || style.MaxWidth().IsIntrinsic() || |
|
cbiesinger
2017/06/29 20:40:01
Why does that work? Don't we need to compute the m
ikilpatrick
2017/06/29 22:45:07
I've changed this so its a little more obvious...
| |
| 19 width.IsIntrinsic() || | |
| 19 (width.IsAuto() && (style.Left().IsAuto() || style.Right().IsAuto())); | 20 (width.IsAuto() && (style.Left().IsAuto() || style.Right().IsAuto())); |
| 20 } | 21 } |
| 21 | 22 |
| 22 bool AbsoluteVerticalNeedsEstimate(const ComputedStyle& style) { | 23 bool AbsoluteVerticalNeedsEstimate(const ComputedStyle& style) { |
| 23 Length height = style.Height(); | 24 Length height = style.Height(); |
| 24 return height.IsIntrinsic() || | 25 return style.MinHeight().IsIntrinsic() || style.MaxHeight().IsIntrinsic() || |
| 26 height.IsIntrinsic() || | |
| 25 (height.IsAuto() && (style.Top().IsAuto() || style.Bottom().IsAuto())); | 27 (height.IsAuto() && (style.Top().IsAuto() || style.Bottom().IsAuto())); |
| 26 } | 28 } |
| 27 | 29 |
| 28 LayoutUnit ResolveWidth(const Length& width, | 30 LayoutUnit ResolveWidth(const Length& width, |
| 29 const NGConstraintSpace& space, | 31 const NGConstraintSpace& space, |
| 30 const ComputedStyle& style, | 32 const ComputedStyle& style, |
| 31 const Optional<MinMaxContentSize>& child_minmax, | 33 const Optional<MinMaxContentSize>& child_minmax, |
| 32 LengthResolveType resolve_type) { | 34 LengthResolveType resolve_type) { |
| 33 if (space.WritingMode() == kHorizontalTopBottom) | 35 if (space.WritingMode() == kHorizontalTopBottom) |
| 34 return ResolveInlineLength(space, style, child_minmax, width, resolve_type); | 36 return ResolveInlineLength(space, style, child_minmax, width, resolve_type); |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 430 if (!style.Width().IsAuto()) { | 432 if (!style.Width().IsAuto()) { |
| 431 width = ResolveWidth(style.Width(), space, style, child_minmax, | 433 width = ResolveWidth(style.Width(), space, style, child_minmax, |
| 432 LengthResolveType::kContentSize); | 434 LengthResolveType::kContentSize); |
| 433 } | 435 } |
| 434 ComputeAbsoluteHorizontal(space, style, width, static_position, | 436 ComputeAbsoluteHorizontal(space, style, width, static_position, |
| 435 child_minmax, position); | 437 child_minmax, position); |
| 436 } | 438 } |
| 437 } | 439 } |
| 438 | 440 |
| 439 } // namespace blink | 441 } // namespace blink |
| OLD | NEW |