Chromium Code Reviews| 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..5cdd96d7748e0c438cb93c0d45e7e734672d6311 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> { |
|
ikilpatrick
2017/02/10 01:53:41
Also I assume we are performing copies of this obj
Gleb Lanbin
2017/02/10 20:11:12
yes, we're copying heap pointers
|
| 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 genuine parent of this float. |
| + Member<const NGConstraintSpace> parent_space; |
|
ikilpatrick
2017/02/10 01:53:41
This doesn't need to be stored here right?
Gleb Lanbin
2017/02/10 20:11:12
we use the original parent's inline BFC offset in
|
| 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 genuine 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); |
| } |
| }; |