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 16 matching lines...) Expand all Loading... |
27 bool contains_absolute = | 27 bool contains_absolute = |
28 container_style.canContainAbsolutePositionObjects() || contains_fixed; | 28 container_style.canContainAbsolutePositionObjects() || contains_fixed; |
29 | 29 |
30 return (contains_absolute && position == EPosition::kAbsolute) || | 30 return (contains_absolute && position == EPosition::kAbsolute) || |
31 (contains_fixed && position == EPosition::kFixed); | 31 (contains_fixed && position == EPosition::kFixed); |
32 } | 32 } |
33 | 33 |
34 } // namespace | 34 } // namespace |
35 | 35 |
36 NGOutOfFlowLayoutPart::NGOutOfFlowLayoutPart( | 36 NGOutOfFlowLayoutPart::NGOutOfFlowLayoutPart( |
| 37 const NGConstraintSpace& container_space, |
37 const ComputedStyle& container_style, | 38 const ComputedStyle& container_style, |
38 NGFragmentBuilder* container_builder) | 39 NGFragmentBuilder* container_builder) |
39 : container_style_(container_style), container_builder_(container_builder) { | 40 : container_style_(container_style), container_builder_(container_builder) { |
40 NGWritingMode writing_mode( | 41 NGWritingMode writing_mode( |
41 FromPlatformWritingMode(container_style_.getWritingMode())); | 42 FromPlatformWritingMode(container_style_.getWritingMode())); |
42 | 43 |
43 NGBoxStrut borders = ComputeBorders(container_style_); | 44 NGBoxStrut borders = ComputeBorders(container_space, container_style_); |
44 container_border_offset_ = | 45 container_border_offset_ = |
45 NGLogicalOffset{borders.inline_start, borders.block_start}; | 46 NGLogicalOffset{borders.inline_start, borders.block_start}; |
46 container_border_physical_offset_ = | 47 container_border_physical_offset_ = |
47 container_border_offset_.ConvertToPhysical( | 48 container_border_offset_.ConvertToPhysical( |
48 writing_mode, container_style_.direction(), | 49 writing_mode, container_style_.direction(), |
49 container_builder_->Size().ConvertToPhysical(writing_mode), | 50 container_builder_->Size().ConvertToPhysical(writing_mode), |
50 NGPhysicalSize()); | 51 NGPhysicalSize()); |
51 | 52 |
52 NGLogicalSize space_size = container_builder_->Size(); | 53 NGLogicalSize space_size = container_builder_->Size(); |
53 space_size.block_size -= borders.BlockSum(); | 54 space_size.block_size -= borders.BlockSum(); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 builder.SetIsFixedSizeBlock(true); | 178 builder.SetIsFixedSizeBlock(true); |
178 builder.SetIsFixedSizeInline(true); | 179 builder.SetIsFixedSizeInline(true); |
179 builder.SetIsNewFormattingContext(true); | 180 builder.SetIsNewFormattingContext(true); |
180 NGConstraintSpace* space = | 181 NGConstraintSpace* space = |
181 builder.ToConstraintSpace(container_space_->WritingMode()); | 182 builder.ToConstraintSpace(container_space_->WritingMode()); |
182 | 183 |
183 return descendant.Layout(space); | 184 return descendant.Layout(space); |
184 } | 185 } |
185 | 186 |
186 } // namespace blink | 187 } // namespace blink |
OLD | NEW |