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_box.h" | 5 #include "core/layout/ng/ng_box.h" |
6 | 6 |
7 #include "core/layout/LayoutBlockFlow.h" | 7 #include "core/layout/LayoutBlockFlow.h" |
8 #include "core/layout/ng/layout_ng_block_flow.h" | 8 #include "core/layout/ng/layout_ng_block_flow.h" |
9 #include "core/layout/ng/ng_block_layout_algorithm.h" | 9 #include "core/layout/ng/ng_block_layout_algorithm.h" |
10 #include "core/layout/ng/ng_constraint_space.h" | 10 #include "core/layout/ng/ng_constraint_space.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 layout_box_->containingBlock()->insertPositionedObject(layout_box_); | 31 layout_box_->containingBlock()->insertPositionedObject(layout_box_); |
32 // We can either use the new layout code to do the layout and then copy the | 32 // We can either use the new layout code to do the layout and then copy the |
33 // resulting size to the LayoutObject, or use the old layout code and | 33 // resulting size to the LayoutObject, or use the old layout code and |
34 // synthesize a fragment. | 34 // synthesize a fragment. |
35 if (CanUseNewLayout()) { | 35 if (CanUseNewLayout()) { |
36 if (!algorithm_) | 36 if (!algorithm_) |
37 algorithm_ = new NGBlockLayoutAlgorithm(Style(), FirstChild()); | 37 algorithm_ = new NGBlockLayoutAlgorithm(Style(), FirstChild()); |
38 // Change the coordinate system of the constraint space. | 38 // Change the coordinate system of the constraint space. |
39 NGConstraintSpace* child_constraint_space = new NGConstraintSpace( | 39 NGConstraintSpace* child_constraint_space = new NGConstraintSpace( |
40 FromPlatformWritingMode(Style()->getWritingMode()), | 40 FromPlatformWritingMode(Style()->getWritingMode()), |
41 FromPlatformDirection(Style()->direction()), constraint_space); | 41 FromPlatformDirection(Style()->direction()), |
| 42 constraint_space->MutablePhysicalSpace()); |
42 | 43 |
43 NGPhysicalFragment* fragment = nullptr; | 44 NGPhysicalFragment* fragment = nullptr; |
44 if (!algorithm_->Layout(child_constraint_space, &fragment)) | 45 if (!algorithm_->Layout(child_constraint_space, &fragment)) |
45 return false; | 46 return false; |
46 fragment_ = fragment; | 47 fragment_ = fragment; |
47 | 48 |
48 if (layout_box_) { | 49 if (layout_box_) { |
49 CopyFragmentDataToLayoutBox(*constraint_space); | 50 CopyFragmentDataToLayoutBox(*constraint_space); |
50 } | 51 } |
51 } else { | 52 } else { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 .SetBlockSize(layout_box_->logicalHeight()) | 171 .SetBlockSize(layout_box_->logicalHeight()) |
171 .SetDirection(FromPlatformDirection(layout_box_->styleRef().direction())) | 172 .SetDirection(FromPlatformDirection(layout_box_->styleRef().direction())) |
172 .SetWritingMode( | 173 .SetWritingMode( |
173 FromPlatformWritingMode(layout_box_->styleRef().getWritingMode())) | 174 FromPlatformWritingMode(layout_box_->styleRef().getWritingMode())) |
174 .SetInlineOverflow(overflow.width()) | 175 .SetInlineOverflow(overflow.width()) |
175 .SetBlockOverflow(overflow.height()); | 176 .SetBlockOverflow(overflow.height()); |
176 return builder.ToFragment(); | 177 return builder.ToFragment(); |
177 } | 178 } |
178 | 179 |
179 } // namespace blink | 180 } // namespace blink |
OLD | NEW |