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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 return AbsoluteHorizontalNeedsEstimate(style); | 328 return AbsoluteHorizontalNeedsEstimate(style); |
329 } | 329 } |
330 | 330 |
331 bool AbsoluteNeedsChildInlineSize(const ComputedStyle& style) { | 331 bool AbsoluteNeedsChildInlineSize(const ComputedStyle& style) { |
332 if (style.isHorizontalWritingMode()) | 332 if (style.isHorizontalWritingMode()) |
333 return AbsoluteHorizontalNeedsEstimate(style); | 333 return AbsoluteHorizontalNeedsEstimate(style); |
334 else | 334 else |
335 return AbsoluteVerticalNeedsEstimate(style); | 335 return AbsoluteVerticalNeedsEstimate(style); |
336 } | 336 } |
337 | 337 |
| 338 bool IsContainingBlockForAbsoluteChild(const ComputedStyle& container_style, |
| 339 const ComputedStyle& child_style) { |
| 340 EPosition position = child_style.position(); |
| 341 bool contains_fixed = container_style.canContainFixedPositionObjects(); |
| 342 bool contains_absolute = |
| 343 container_style.canContainAbsolutePositionObjects() || contains_fixed; |
| 344 |
| 345 return (contains_absolute && position == AbsolutePosition) || |
| 346 (contains_fixed && position == FixedPosition); |
| 347 } |
| 348 |
338 NGAbsolutePhysicalPosition ComputePartialAbsoluteWithChildInlineSize( | 349 NGAbsolutePhysicalPosition ComputePartialAbsoluteWithChildInlineSize( |
339 const NGConstraintSpace& space, | 350 const NGConstraintSpace& space, |
340 const ComputedStyle& style, | 351 const ComputedStyle& style, |
341 const NGStaticPosition& static_position, | 352 const NGStaticPosition& static_position, |
342 const Optional<MinAndMaxContentSizes>& child_minmax) { | 353 const Optional<MinAndMaxContentSizes>& child_minmax) { |
343 NGAbsolutePhysicalPosition position; | 354 NGAbsolutePhysicalPosition position; |
344 if (style.isHorizontalWritingMode()) | 355 if (style.isHorizontalWritingMode()) |
345 ComputeAbsoluteHorizontal(space, style, static_position, child_minmax, | 356 ComputeAbsoluteHorizontal(space, style, static_position, child_minmax, |
346 &position); | 357 &position); |
347 else { | 358 else { |
(...skipping 20 matching lines...) Expand all Loading... |
368 if (style.isHorizontalWritingMode()) | 379 if (style.isHorizontalWritingMode()) |
369 ComputeAbsoluteVertical(space, style, static_position, child_minmax, | 380 ComputeAbsoluteVertical(space, style, static_position, child_minmax, |
370 position); | 381 position); |
371 else { | 382 else { |
372 ComputeAbsoluteHorizontal(space, style, static_position, child_minmax, | 383 ComputeAbsoluteHorizontal(space, style, static_position, child_minmax, |
373 position); | 384 position); |
374 } | 385 } |
375 } | 386 } |
376 | 387 |
377 } // namespace blink | 388 } // namespace blink |
OLD | NEW |