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

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

Issue 2679343004: Add left_offset to NGFloatingObject and set it on legacy FloatingObject (Closed)
Patch Set: fix comments Created 3 years, 10 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 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);
}
};

Powered by Google App Engine
This is Rietveld 408576698