| 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_out_of_flow_layout_part.h" | 5 #include "core/layout/ng/ng_out_of_flow_layout_part.h" |
| 6 | 6 |
| 7 #include "core/layout/ng/ng_absolute_utils.h" | 7 #include "core/layout/ng/ng_absolute_utils.h" |
| 8 #include "core/layout/ng/ng_block_node.h" | 8 #include "core/layout/ng/ng_block_node.h" |
| 9 #include "core/layout/ng/ng_box_fragment.h" | 9 #include "core/layout/ng/ng_box_fragment.h" |
| 10 #include "core/layout/ng/ng_constraint_space_builder.h" | 10 #include "core/layout/ng/ng_constraint_space_builder.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 NGBlockNode descendant, | 94 NGBlockNode descendant, |
| 95 NGStaticPosition static_position, | 95 NGStaticPosition static_position, |
| 96 NGLogicalOffset* offset) { | 96 NGLogicalOffset* offset) { |
| 97 DCHECK(descendant); | 97 DCHECK(descendant); |
| 98 | 98 |
| 99 // Adjust the static_position origin. The static_position coordinate origin is | 99 // Adjust the static_position origin. The static_position coordinate origin is |
| 100 // relative to the container's border box, ng_absolute_utils expects it to be | 100 // relative to the container's border box, ng_absolute_utils expects it to be |
| 101 // relative to the container's padding box. | 101 // relative to the container's padding box. |
| 102 static_position.offset -= container_border_physical_offset_; | 102 static_position.offset -= container_border_physical_offset_; |
| 103 | 103 |
| 104 // The inline and block estimates are in the descendant's writing mode. | 104 // The block estimate is in the descendant's writing mode. |
| 105 Optional<MinMaxContentSize> inline_estimate; | 105 Optional<MinMaxContentSize> min_max_size; |
| 106 Optional<LayoutUnit> block_estimate; | 106 Optional<LayoutUnit> block_estimate; |
| 107 | 107 |
| 108 RefPtr<NGLayoutResult> layout_result = nullptr; | 108 RefPtr<NGLayoutResult> layout_result = nullptr; |
| 109 NGWritingMode descendant_writing_mode( | 109 NGWritingMode descendant_writing_mode( |
| 110 FromPlatformWritingMode(descendant.Style().GetWritingMode())); | 110 FromPlatformWritingMode(descendant.Style().GetWritingMode())); |
| 111 | 111 |
| 112 if (AbsoluteNeedsChildInlineSize(descendant.Style())) { | 112 if (AbsoluteNeedsChildInlineSize(descendant.Style()) || |
| 113 inline_estimate = descendant.ComputeMinMaxContentSize(); | 113 NeedMinMaxContentSize(descendant.Style())) { |
| 114 min_max_size = descendant.ComputeMinMaxContentSize(); |
| 114 } | 115 } |
| 115 | 116 |
| 116 NGAbsolutePhysicalPosition node_position = | 117 NGAbsolutePhysicalPosition node_position = |
| 117 ComputePartialAbsoluteWithChildInlineSize( | 118 ComputePartialAbsoluteWithChildInlineSize( |
| 118 *container_space_, descendant.Style(), static_position, | 119 *container_space_, descendant.Style(), static_position, min_max_size); |
| 119 inline_estimate); | |
| 120 | 120 |
| 121 if (AbsoluteNeedsChildBlockSize(descendant.Style())) { | 121 if (AbsoluteNeedsChildBlockSize(descendant.Style())) { |
| 122 layout_result = GenerateFragment(descendant, block_estimate, node_position); | 122 layout_result = GenerateFragment(descendant, block_estimate, node_position); |
| 123 | 123 |
| 124 NGBoxFragment fragment( | 124 NGBoxFragment fragment( |
| 125 descendant_writing_mode, | 125 descendant_writing_mode, |
| 126 ToNGPhysicalBoxFragment(layout_result->PhysicalFragment().Get())); | 126 ToNGPhysicalBoxFragment(layout_result->PhysicalFragment().Get())); |
| 127 | 127 |
| 128 block_estimate = fragment.BlockSize(); | 128 block_estimate = fragment.BlockSize(); |
| 129 } | 129 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 if (block_estimate) | 183 if (block_estimate) |
| 184 builder.SetIsFixedSizeBlock(true); | 184 builder.SetIsFixedSizeBlock(true); |
| 185 builder.SetIsFixedSizeInline(true); | 185 builder.SetIsFixedSizeInline(true); |
| 186 builder.SetIsNewFormattingContext(true); | 186 builder.SetIsNewFormattingContext(true); |
| 187 RefPtr<NGConstraintSpace> space = builder.ToConstraintSpace(writing_mode); | 187 RefPtr<NGConstraintSpace> space = builder.ToConstraintSpace(writing_mode); |
| 188 | 188 |
| 189 return descendant.Layout(space.Get()); | 189 return descendant.Layout(space.Get()); |
| 190 } | 190 } |
| 191 | 191 |
| 192 } // namespace blink | 192 } // namespace blink |
| OLD | NEW |