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

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

Issue 2642823008: Introduce NGFloatingObject (Closed)
Patch Set: fix comments 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 63861fd8f01e5fce42ae467055b38d8107989d0a..b0ea6b7d4f1e2b5b1a2ca5f9ee55ba9bab2518be 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
@@ -221,10 +221,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);
@@ -287,8 +293,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