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

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

Issue 2850893003: Add container_block_offset,top_offset to NGFloatingObject. (Closed)
Patch Set: Created 3 years, 8 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_floats_utils.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_floats_utils.cc b/third_party/WebKit/Source/core/layout/ng/ng_floats_utils.cc
index 762b170aff419efd686b51fa05d7aaa9f704bd7c..921c704e8e8058a920542d464381b1d3c1dec97b 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_floats_utils.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_floats_utils.cc
@@ -78,16 +78,21 @@ NGExclusion CreateExclusion(const NGFragment& fragment,
return exclusion;
}
-// Updates the Floating Object's left offset from the provided parent_space
-// and {@code floating_object}'s space and margins.
-void UpdateFloatingObjectLeftOffset(const NGConstraintSpace& new_parent_space,
- const NGLogicalOffset& float_logical_offset,
- NGFloatingObject* floating_object) {
+// Updates the Floating Object's left and top offsets.
+void UpdateFloatingObjectPaintOffset(
+ const NGConstraintSpace& new_parent_space,
+ const NGLogicalOffset& float_logical_offset,
+ NGFloatingObject* floating_object) {
DCHECK(floating_object);
// TODO(glebl): We should use physical offset here.
floating_object->left_offset = floating_object->from_offset.inline_offset -
new_parent_space.BfcOffset().inline_offset +
float_logical_offset.inline_offset;
+ DCHECK(floating_object->container_block_offset);
+ floating_object->top_offset =
+ floating_object->from_offset.block_offset -
+ floating_object->container_block_offset.value() +
+ float_logical_offset.block_offset;
}
} // namespace
@@ -132,18 +137,20 @@ NGLogicalOffset PositionFloat(NGFloatingObject* floating_object,
NGLogicalOffset logical_offset = CalculateLogicalOffsetForOpportunity(
opportunity, float_offset, floating_object);
- UpdateFloatingObjectLeftOffset(*new_parent_space, logical_offset,
- floating_object);
+ UpdateFloatingObjectPaintOffset(*new_parent_space, logical_offset,
+ floating_object);
return logical_offset;
}
void PositionFloats(LayoutUnit origin_block_offset,
LayoutUnit from_block_offset,
+ LayoutUnit container_block_offset,
const Vector<RefPtr<NGFloatingObject>>& floating_objects,
NGConstraintSpace* space) {
for (auto& floating_object : floating_objects) {
floating_object->origin_offset.block_offset = origin_block_offset;
floating_object->from_offset.block_offset = from_block_offset;
+ floating_object->container_block_offset = container_block_offset;
floating_object->logical_offset =
PositionFloat(floating_object.Get(), space);
}

Powered by Google App Engine
This is Rietveld 408576698