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 65a26654392ee26e54d22e1f6ba6d8fcf159f80b..bc0b5531864cc13d986e3b20048918d4f3d49122 100644 |
--- a/third_party/WebKit/Source/core/layout/ng/ng_box.cc |
+++ b/third_party/WebKit/Source/core/layout/ng/ng_box.cc |
@@ -8,21 +8,28 @@ |
#include "core/layout/ng/layout_ng_block_flow.h" |
#include "core/layout/ng/ng_block_layout_algorithm.h" |
#include "core/layout/ng/ng_box_iterator.h" |
+#include "core/layout/ng/ng_constraint_space.h" |
#include "core/layout/ng/ng_fragment.h" |
#include "core/layout/ng/ng_fragment_builder.h" |
+#include "core/layout/ng/ng_writing_mode.h" |
#include "core/layout/LayoutBlockFlow.h" |
#include "core/layout/LayoutBox.h" |
namespace blink { |
-NGFragment* NGBox::layout(const NGConstraintSpace& constraintSpace) { |
+NGFragment* NGBox::layout(const NGConstraintSpace* constraintSpace) { |
// We can either use the new layout code to do the layout and then copy the |
// resulting size to the LayoutObject, or use the old layout code and |
// synthesize a fragment. |
NGFragment* fragment = nullptr; |
if (canUseNewLayout()) { |
NGBlockLayoutAlgorithm algorithm(style(), childIterator()); |
- fragment = algorithm.layout(constraintSpace); |
+ |
+ // Change the coordinate system of the constraint space. |
+ NGConstraintSpace* childConstraintSpace = new NGConstraintSpace( |
cbiesinger
2016/08/25 22:22:15
For new code, can we make sure to follow the Googl
ikilpatrick
2016/08/25 23:14:29
Yup done. Sorry, hopefully wont take that long to
|
+ fromPlatformWritingMode(style()->getWritingMode()), constraintSpace); |
+ |
+ fragment = algorithm.layout(childConstraintSpace); |
m_layoutBox->setLogicalWidth(fragment->InlineSize()); |
m_layoutBox->setLogicalHeight(fragment->BlockSize()); |
if (m_layoutBox->isLayoutBlock()) |
@@ -30,7 +37,7 @@ NGFragment* NGBox::layout(const NGConstraintSpace& constraintSpace) { |
m_layoutBox->clearNeedsLayout(); |
} else { |
// TODO(layout-ng): If fixedSize is true, set the override width/height too |
- NGLogicalSize containerSize = constraintSpace.ContainerSize(); |
+ NGLogicalSize containerSize = constraintSpace->ContainerSize(); |
m_layoutBox->setOverrideContainingBlockContentLogicalWidth( |
containerSize.inline_size); |
m_layoutBox->setOverrideContainingBlockContentLogicalHeight( |