Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_block_node.cc

Issue 2642823008: Introduce NGFloatingObject (Closed)
Patch Set: Update TestExpectations Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_);
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698