| 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" |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 return AbsoluteHorizontalNeedsEstimate(style); | 372 return AbsoluteHorizontalNeedsEstimate(style); |
| 373 } | 373 } |
| 374 | 374 |
| 375 bool AbsoluteNeedsChildInlineSize(const ComputedStyle& style) { | 375 bool AbsoluteNeedsChildInlineSize(const ComputedStyle& style) { |
| 376 if (style.isHorizontalWritingMode()) | 376 if (style.isHorizontalWritingMode()) |
| 377 return AbsoluteHorizontalNeedsEstimate(style); | 377 return AbsoluteHorizontalNeedsEstimate(style); |
| 378 else | 378 else |
| 379 return AbsoluteVerticalNeedsEstimate(style); | 379 return AbsoluteVerticalNeedsEstimate(style); |
| 380 } | 380 } |
| 381 | 381 |
| 382 bool IsContainingBlockForAbsoluteChild(const ComputedStyle& container_style, | |
| 383 const ComputedStyle& child_style) { | |
| 384 EPosition position = child_style.position(); | |
| 385 bool contains_fixed = container_style.canContainFixedPositionObjects(); | |
| 386 bool contains_absolute = | |
| 387 container_style.canContainAbsolutePositionObjects() || contains_fixed; | |
| 388 | |
| 389 return (contains_absolute && position == AbsolutePosition) || | |
| 390 (contains_fixed && position == FixedPosition); | |
| 391 } | |
| 392 | |
| 393 NGAbsolutePhysicalPosition ComputePartialAbsoluteWithChildInlineSize( | 382 NGAbsolutePhysicalPosition ComputePartialAbsoluteWithChildInlineSize( |
| 394 const NGConstraintSpace& space, | 383 const NGConstraintSpace& space, |
| 395 const ComputedStyle& style, | 384 const ComputedStyle& style, |
| 396 const NGStaticPosition& static_position, | 385 const NGStaticPosition& static_position, |
| 397 const Optional<MinAndMaxContentSizes>& child_minmax) { | 386 const Optional<MinAndMaxContentSizes>& child_minmax) { |
| 398 NGAbsolutePhysicalPosition position; | 387 NGAbsolutePhysicalPosition position; |
| 399 if (style.isHorizontalWritingMode()) { | 388 if (style.isHorizontalWritingMode()) { |
| 400 Optional<LayoutUnit> width; | 389 Optional<LayoutUnit> width; |
| 401 if (!style.width().isAuto()) { | 390 if (!style.width().isAuto()) { |
| 402 width = ResolveWidth(style.width(), space, style, child_minmax, | 391 width = ResolveWidth(style.width(), space, style, child_minmax, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 if (!style.width().isAuto()) { | 432 if (!style.width().isAuto()) { |
| 444 width = ResolveWidth(style.width(), space, style, child_minmax, | 433 width = ResolveWidth(style.width(), space, style, child_minmax, |
| 445 LengthResolveType::kContentSize); | 434 LengthResolveType::kContentSize); |
| 446 } | 435 } |
| 447 ComputeAbsoluteHorizontal(space, style, width, static_position, | 436 ComputeAbsoluteHorizontal(space, style, width, static_position, |
| 448 child_minmax, position); | 437 child_minmax, position); |
| 449 } | 438 } |
| 450 } | 439 } |
| 451 | 440 |
| 452 } // namespace blink | 441 } // namespace blink |
| OLD | NEW |