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

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

Issue 2732483002: Change NGLayoutOpportunityIterator constructor to work with const CS. (Closed)
Patch Set: git rebase-update3 Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NGFloatingObject_h 5 #ifndef NGFloatingObject_h
6 #define NGFloatingObject_h 6 #define NGFloatingObject_h
7 7
8 #include "core/layout/ng/ng_block_node.h" 8 #include "core/layout/ng/ng_block_node.h"
9 #include "core/layout/ng/ng_constraint_space.h" 9 #include "core/layout/ng/ng_constraint_space.h"
10 #include "core/layout/ng/ng_units.h" 10 #include "core/layout/ng/ng_units.h"
11 #include "core/style/ComputedStyle.h" 11 #include "core/style/ComputedStyle.h"
12 #include "core/style/ComputedStyleConstants.h" 12 #include "core/style/ComputedStyleConstants.h"
13 #include "platform/heap/Handle.h" 13 #include "platform/heap/Handle.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 class NGPhysicalFragment; 17 class NGPhysicalFragment;
18 18
19 // Struct that keeps all information needed to position floats in LayoutNG. 19 // Struct that keeps all information needed to position floats in LayoutNG.
20 struct CORE_EXPORT NGFloatingObject 20 struct CORE_EXPORT NGFloatingObject
21 : public GarbageCollectedFinalized<NGFloatingObject> { 21 : public GarbageCollectedFinalized<NGFloatingObject> {
22 NGFloatingObject(NGPhysicalFragment* fragment, 22 NGFloatingObject(const NGConstraintSpace* space,
23 NGConstraintSpace* space,
24 const NGConstraintSpace* parent_space, 23 const NGConstraintSpace* parent_space,
25 NGBlockNode* node,
26 const ComputedStyle& style, 24 const ComputedStyle& style,
27 const NGBoxStrut& margins) 25 const NGBoxStrut& margins,
28 : fragment(fragment), 26 NGPhysicalFragment* fragment)
29 space(space), 27 : space(space),
30 original_parent_space(parent_space), 28 original_parent_space(parent_space),
31 node(node), 29 margins(margins),
32 margins(margins) { 30 fragment(fragment) {
33 exclusion_type = NGExclusion::kFloatLeft; 31 exclusion_type = NGExclusion::kFloatLeft;
34 if (style.floating() == EFloat::kRight) 32 if (style.floating() == EFloat::kRight)
35 exclusion_type = NGExclusion::kFloatRight; 33 exclusion_type = NGExclusion::kFloatRight;
36 clear_type = style.clear(); 34 clear_type = style.clear();
37 } 35 }
38 36
39 RefPtr<NGPhysicalFragment> fragment; 37 // Original constraint space of the float.
40 // TODO(glebl): Constraint space should be const here. 38 RefPtr<const NGConstraintSpace> space;
41 RefPtr<NGConstraintSpace> space;
42 39
43 // Parent space is used so we can calculate the inline offset relative to 40 // Parent space is used so we can calculate the inline offset relative to
44 // the original parent of this float. 41 // the original parent of this float.
45 RefPtr<const NGConstraintSpace> original_parent_space; 42 RefPtr<const NGConstraintSpace> original_parent_space;
46 Member<NGBlockNode> node; 43
47 NGExclusion::Type exclusion_type; 44 NGExclusion::Type exclusion_type;
48 EClear clear_type; 45 EClear clear_type;
49 NGBoxStrut margins; 46 NGBoxStrut margins;
50 47
48 RefPtr<NGPhysicalFragment> fragment;
49
51 // In the case where a legacy FloatingObject is attached to not its own 50 // In the case where a legacy FloatingObject is attached to not its own
52 // parent, e.g. a float surrounded by a bunch of nested empty divs, 51 // parent, e.g. a float surrounded by a bunch of nested empty divs,
53 // NG float fragment's LeftOffset() cannot be used as legacy FloatingObject's 52 // NG float fragment's LeftOffset() cannot be used as legacy FloatingObject's
54 // left offset because that offset should be relative to the original float 53 // left offset because that offset should be relative to the original float
55 // parent. 54 // parent.
56 // {@code left_offset} is calculated when we know to which parent this float 55 // {@code left_offset} is calculated when we know to which parent this float
57 // would be attached. 56 // would be attached.
58 LayoutUnit left_offset; 57 LayoutUnit left_offset;
59 58
60 DEFINE_INLINE_TRACE() { 59 DEFINE_INLINE_TRACE() {
61 visitor->trace(node);
62 } 60 }
63 }; 61 };
64 62
65 } // namespace blink 63 } // namespace blink
66 64
67 #endif // NGFloatingObject_h 65 #endif // NGFloatingObject_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698