Index: third_party/WebKit/Source/core/layout/ng/ng_block_node.cc |
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc |
index 064a88c4db019bf7cd14854220e86b9c83b8b9a8..09a93eb88665e987d92f258afa9606c9103044d8 100644 |
--- a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc |
+++ b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc |
@@ -182,10 +182,16 @@ void NGBlockNode::PositionUpdated() { |
layout_box_->setX(fragment_->LeftOffset()); |
layout_box_->setY(fragment_->TopOffset()); |
+} |
+ |
+void NGBlockNode::FloatPositionUpdated(LayoutObject* parent) { |
+ PositionUpdated(); |
- if (layout_box_->isFloating() && layout_box_->parent()->isLayoutBlockFlow()) { |
- FloatingObject* floating_object = toLayoutBlockFlow(layout_box_->parent()) |
- ->insertFloatingObject(*layout_box_); |
+ if (layout_box_->isFloating() && parent && parent->isLayoutBlockFlow()) { |
+ FloatingObject* floating_object = |
+ toLayoutBlockFlow(parent)->insertFloatingObject(*layout_box_); |
+ // TODO(glebl): Fix floating_object's inline offset if it's attached to |
+ // parent != layout_box_->parent |
floating_object->setX(fragment_->LeftOffset()); |
floating_object->setY(fragment_->TopOffset()); |
floating_object->setIsPlaced(true); |
@@ -251,8 +257,12 @@ void NGBlockNode::CopyFragmentDataToLayoutBox( |
} else { |
for (NGBlockNode* box = toNGBlockNode(FirstChild()); box; |
box = box->NextSibling()) { |
- if (box->fragment_) |
+ if (box->fragment_ && box->fragment_->IsPlaced()) |
box->PositionUpdated(); |
+ |
+ for (const auto& floating_object : box->fragment_->PositionedFloats()) { |
+ floating_object->node->FloatPositionUpdated(box->layout_box_); |
+ } |
} |
} |