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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // 2. To compute final fragment, when block size is known from the absolute | 161 // 2. To compute final fragment, when block size is known from the absolute |
162 // position calculation. | 162 // position calculation. |
163 RefPtr<NGLayoutResult> NGOutOfFlowLayoutPart::GenerateFragment( | 163 RefPtr<NGLayoutResult> NGOutOfFlowLayoutPart::GenerateFragment( |
164 NGBlockNode& descendant, | 164 NGBlockNode& descendant, |
165 const Optional<LayoutUnit>& block_estimate, | 165 const Optional<LayoutUnit>& block_estimate, |
166 const NGAbsolutePhysicalPosition node_position) { | 166 const NGAbsolutePhysicalPosition node_position) { |
167 // As the block_estimate is always in the descendant's writing mode, we build | 167 // As the block_estimate is always in the descendant's writing mode, we build |
168 // the constraint space in the descendant's writing mode. | 168 // the constraint space in the descendant's writing mode. |
169 NGWritingMode writing_mode( | 169 NGWritingMode writing_mode( |
170 FromPlatformWritingMode(descendant.Style().getWritingMode())); | 170 FromPlatformWritingMode(descendant.Style().getWritingMode())); |
171 NGLogicalSize logical_available_size( | 171 NGLogicalSize container_size( |
172 container_space_->AvailableSize() | 172 container_space_->AvailableSize() |
173 .ConvertToPhysical(container_space_->WritingMode()) | 173 .ConvertToPhysical(container_space_->WritingMode()) |
174 .ConvertToLogical(writing_mode)); | 174 .ConvertToLogical(writing_mode)); |
175 | 175 |
176 LayoutUnit inline_size = | 176 LayoutUnit inline_size = |
177 node_position.size.ConvertToLogical(writing_mode).inline_size; | 177 node_position.size.ConvertToLogical(writing_mode).inline_size; |
178 LayoutUnit block_size = | 178 LayoutUnit block_size = |
179 block_estimate ? *block_estimate : logical_available_size.block_size; | 179 block_estimate ? *block_estimate : container_size.block_size; |
180 | 180 |
181 NGLogicalSize available_size{inline_size, block_size}; | 181 NGLogicalSize available_size{inline_size, block_size}; |
182 | 182 |
183 NGConstraintSpaceBuilder builder(writing_mode); | 183 NGConstraintSpaceBuilder builder(writing_mode); |
184 builder.SetAvailableSize(available_size); | 184 builder.SetAvailableSize(available_size); |
185 builder.SetPercentageResolutionSize(logical_available_size); | 185 builder.SetPercentageResolutionSize(container_size); |
186 if (block_estimate) | 186 if (block_estimate) |
187 builder.SetIsFixedSizeBlock(true); | 187 builder.SetIsFixedSizeBlock(true); |
188 builder.SetIsFixedSizeInline(true); | 188 builder.SetIsFixedSizeInline(true); |
189 builder.SetIsNewFormattingContext(true); | 189 builder.SetIsNewFormattingContext(true); |
190 RefPtr<NGConstraintSpace> space = builder.ToConstraintSpace(writing_mode); | 190 RefPtr<NGConstraintSpace> space = builder.ToConstraintSpace(writing_mode); |
191 | 191 |
192 return descendant.Layout(space.get()); | 192 return descendant.Layout(space.get()); |
193 } | 193 } |
194 | 194 |
195 } // namespace blink | 195 } // namespace blink |
OLD | NEW |