| 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_constraint_space_builder.h" | 9 #include "core/layout/ng/ng_constraint_space_builder.h" |
| 10 #include "core/layout/ng/ng_fragment_base.h" | |
| 11 #include "core/layout/ng/ng_length_utils.h" | 10 #include "core/layout/ng/ng_length_utils.h" |
| 12 #include "core/style/ComputedStyle.h" | 11 #include "core/style/ComputedStyle.h" |
| 12 #include "core/layout/ng/ng_fragment.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 NGOutOfFlowLayoutPart::NGOutOfFlowLayoutPart( | 16 NGOutOfFlowLayoutPart::NGOutOfFlowLayoutPart( |
| 17 PassRefPtr<const ComputedStyle> container_style, | 17 PassRefPtr<const ComputedStyle> container_style, |
| 18 NGLogicalSize container_size) { | 18 NGLogicalSize container_size) { |
| 19 contains_fixed_ = container_style->canContainFixedPositionObjects(); | 19 contains_fixed_ = container_style->canContainFixedPositionObjects(); |
| 20 contains_absolute_ = | 20 contains_absolute_ = |
| 21 container_style->canContainAbsolutePositionObjects() || contains_fixed_; | 21 container_style->canContainAbsolutePositionObjects() || contains_fixed_; |
| 22 // Initialize ConstraintSpace | 22 // Initialize ConstraintSpace |
| (...skipping 30 matching lines...) Expand all Loading... |
| 53 node_fragment_ = nullptr; | 53 node_fragment_ = nullptr; |
| 54 node_position_ = NGAbsolutePhysicalPosition(); | 54 node_position_ = NGAbsolutePhysicalPosition(); |
| 55 inline_estimate_.reset(); | 55 inline_estimate_.reset(); |
| 56 block_estimate_.reset(); | 56 block_estimate_.reset(); |
| 57 state_ = kComputeInlineEstimate; | 57 state_ = kComputeInlineEstimate; |
| 58 return true; | 58 return true; |
| 59 } | 59 } |
| 60 return false; | 60 return false; |
| 61 } | 61 } |
| 62 | 62 |
| 63 NGLayoutStatus NGOutOfFlowLayoutPart::Layout(NGFragmentBase** fragment, | 63 NGLayoutStatus NGOutOfFlowLayoutPart::Layout(NGFragment** fragment, |
| 64 NGLogicalOffset* offset) { | 64 NGLogicalOffset* offset) { |
| 65 DCHECK(node_); | 65 DCHECK(node_); |
| 66 switch (state_) { | 66 switch (state_) { |
| 67 case kComputeInlineEstimate: | 67 case kComputeInlineEstimate: |
| 68 if (ComputeInlineSizeEstimate()) | 68 if (ComputeInlineSizeEstimate()) |
| 69 state_ = kPartialPosition; | 69 state_ = kPartialPosition; |
| 70 break; | 70 break; |
| 71 case kPartialPosition: | 71 case kPartialPosition: |
| 72 node_position_ = ComputePartialAbsoluteWithChildInlineSize( | 72 node_position_ = ComputePartialAbsoluteWithChildInlineSize( |
| 73 *parent_space_, *node_->Style(), static_position_, inline_estimate_); | 73 *parent_space_, *node_->Style(), static_position_, inline_estimate_); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 if (block_estimate_) | 145 if (block_estimate_) |
| 146 available_size.block_size = *block_estimate_; | 146 available_size.block_size = *block_estimate_; |
| 147 builder.SetAvailableSize(available_size); | 147 builder.SetAvailableSize(available_size); |
| 148 builder.SetPercentageResolutionSize(available_size); | 148 builder.SetPercentageResolutionSize(available_size); |
| 149 if (block_estimate_) | 149 if (block_estimate_) |
| 150 builder.SetIsFixedSizeBlock(true); | 150 builder.SetIsFixedSizeBlock(true); |
| 151 builder.SetIsFixedSizeInline(true); | 151 builder.SetIsFixedSizeInline(true); |
| 152 builder.SetIsNewFormattingContext(true); | 152 builder.SetIsNewFormattingContext(true); |
| 153 node_space_ = builder.ToConstraintSpace(); | 153 node_space_ = builder.ToConstraintSpace(); |
| 154 } | 154 } |
| 155 NGFragmentBase* fragment; | 155 NGFragment* fragment; |
| 156 if (node_->Layout(node_space_, &fragment)) { | 156 if (node_->Layout(node_space_, &fragment)) { |
| 157 node_fragment_ = fragment; | 157 node_fragment_ = fragment; |
| 158 return true; | 158 return true; |
| 159 } | 159 } |
| 160 return false; | 160 return false; |
| 161 } | 161 } |
| 162 | 162 |
| 163 DEFINE_TRACE(NGOutOfFlowLayoutPart) { | 163 DEFINE_TRACE(NGOutOfFlowLayoutPart) { |
| 164 visitor->trace(node_); | 164 visitor->trace(node_); |
| 165 visitor->trace(parent_space_); | 165 visitor->trace(parent_space_); |
| 166 visitor->trace(node_fragment_); | 166 visitor->trace(node_fragment_); |
| 167 visitor->trace(node_space_); | 167 visitor->trace(node_space_); |
| 168 } | 168 } |
| 169 } | 169 } |
| OLD | NEW |