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

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_floating_object.h

Issue 2850893003: Add container_block_offset,top_offset to NGFloatingObject. (Closed)
Patch Set: add-inline-to-block-flow-with-block-children-that-do-not-need-anonymous-boxes.html is still broken Created 3 years, 7 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_floating_object.h
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_floating_object.h b/third_party/WebKit/Source/core/layout/ng/ng_floating_object.h
index c7b5a503ddb00af02e09d999d0edafb1558d8029..df00cbff998287622a0cc26df3a3a850ef84c2a9 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_floating_object.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_floating_object.h
@@ -39,7 +39,7 @@ struct CORE_EXPORT NGFloatingObject : public RefCounted<NGFloatingObject> {
// NGLayoutOpportunityIterator to position this floating object.
NGLogicalSize available_size;
- // To correctly position a float we need 2 offsets:
+ // To correctly **position** a float we need 2 offsets:
// - origin_offset which represents the layout point for this float.
// - from_offset which represents the point from where we need to calculate
// the relative logical offset for this float.
@@ -50,6 +50,32 @@ struct CORE_EXPORT NGFloatingObject : public RefCounted<NGFloatingObject> {
NGLogicalOffset origin_offset;
NGLogicalOffset from_offset;
+ // To correctly **paint** a float we need to know the BFC offset of the
+ // container to which we are attaching this float. It's used to calculate
+ // {@code paint_offset}.
+ // In most situations {@code paint_offset} equals to float's logical
+ // offset except the cases where a float needs to be re-attached to a non-zero
+ // height parent.
+ //
+ // Example:
+ // <body>
+ // <p style="height: 60px">Example</p>
+ // <div id="zero-height-div"><float></div>
+ //
+ // Here the float's logical offset is 0 relative to its #zero-height-div
+ // parent. Because of the "zero height" div this float is re-attached to the
+ // 1st non-empty parent => body. To paint this float correctly we provide the
+ // modified {@code paint_offset} which is relative to the float's new
+ // parent.
+ // I.e. for our example {@code paint_offset.top} ==
+ // #zero-height-div's BFC offset
+ // - body's BFC offset + float's logical offset
+ //
+ // For code safety reasons {@code parent_bfc_block_offset} is Optional here
+ // because the block's offset can be only determined before the actual float's
+ // placement event.
+ WTF::Optional<LayoutUnit> parent_bfc_block_offset;
+
// Writing mode of the float's constraint space.
NGWritingMode writing_mode;
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_block_node.cc ('k') | third_party/WebKit/Source/core/layout/ng/ng_floats_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698