Index: third_party/WebKit/Source/core/layout/ng/ng_box.cc |
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_box.cc b/third_party/WebKit/Source/core/layout/ng/ng_box.cc |
index 13f790844a421e87d8c086081e50bbb862332853..40062d95e97e529b9d4adec139b79c4ada13e61d 100644 |
--- a/third_party/WebKit/Source/core/layout/ng/ng_box.cc |
+++ b/third_party/WebKit/Source/core/layout/ng/ng_box.cc |
@@ -33,16 +33,18 @@ bool NGBox::Layout(const NGConstraintSpace* constraint_space, |
// resulting size to the LayoutObject, or use the old layout code and |
// synthesize a fragment. |
if (CanUseNewLayout()) { |
- if (!algorithm_) |
- algorithm_ = new NGBlockLayoutAlgorithm(Style(), FirstChild()); |
// Change the coordinate system of the constraint space. |
NGConstraintSpace* child_constraint_space = new NGConstraintSpace( |
FromPlatformWritingMode(Style()->getWritingMode()), |
FromPlatformDirection(Style()->direction()), |
constraint_space->MutablePhysicalSpace()); |
+ if (!algorithm_) |
+ algorithm_ = new NGBlockLayoutAlgorithm(Style(), FirstChild(), |
+ child_constraint_space); |
+ |
NGPhysicalFragment* fragment = nullptr; |
- if (!algorithm_->Layout(child_constraint_space, &fragment)) |
+ if (!algorithm_->Layout(&fragment)) |
return false; |
fragment_ = fragment; |