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 b8052bfcd9580d413fe9c45c290bd04d3cdbea52..d55ea63a5c39cc3752c48407d4914b470623cdc5 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 |
@@ -21,10 +21,15 @@ struct CORE_EXPORT NGFloatingObject |
: public GarbageCollectedFinalized<NGFloatingObject> { |
NGFloatingObject(NGPhysicalFragment* fragment, |
NGConstraintSpace* space, |
+ const NGConstraintSpace* parent_space, |
NGBlockNode* node, |
const ComputedStyle& style, |
const NGBoxStrut& margins) |
- : fragment(fragment), space(space), node(node), margins(margins) { |
+ : fragment(fragment), |
+ space(space), |
+ parent_space(parent_space), |
+ node(node), |
+ margins(margins) { |
exclusion_type = NGExclusion::kFloatLeft; |
if (style.floating() == EFloat::kRight) |
exclusion_type = NGExclusion::kFloatRight; |
@@ -34,13 +39,27 @@ struct CORE_EXPORT NGFloatingObject |
RefPtr<NGPhysicalFragment> fragment; |
// TODO(glebl): Constraint space should be const here. |
Member<NGConstraintSpace> space; |
+ |
+ // Parent space is used so we can calculate the inline offset relative to |
+ // the original parent of this float. |
+ Member<const NGConstraintSpace> parent_space; |
Member<NGBlockNode> node; |
NGExclusion::Type exclusion_type; |
EClear clear_type; |
NGBoxStrut margins; |
+ // In the case where a legacy FloatingObject is attached to not its own |
+ // parent, e.g. a float surrounded by a bunch of nested empty divs, |
+ // NG float fragment's LeftOffset() cannot be used as legacy FloatingObject's |
+ // left offset because that offset should be relative to the original float |
+ // parent. |
+ // {@code left_offset} is calculated when we know to which parent this float |
+ // would be attached. |
+ LayoutUnit left_offset; |
+ |
DEFINE_INLINE_TRACE() { |
visitor->trace(space); |
+ visitor->trace(parent_space); |
visitor->trace(node); |
} |
}; |