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; |