OLD | NEW |
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 GarbageCollected<NGFloatingObject> { | 21 : public GarbageCollected<NGFloatingObject> { |
22 NGFloatingObject(NGPhysicalFragment* fragment, | 22 NGFloatingObject(NGPhysicalFragment* fragment, |
23 const NGConstraintSpace* space, | 23 NGConstraintSpace* space, |
24 NGBlockNode* node, | 24 NGBlockNode* node, |
25 const ComputedStyle& style, | 25 const ComputedStyle& style, |
26 const NGBoxStrut& margins) | 26 const NGBoxStrut& margins) |
27 : fragment(fragment), space(space), node(node), margins(margins) { | 27 : fragment(fragment), space(space), node(node), margins(margins) { |
28 exclusion_type = NGExclusion::kFloatLeft; | 28 exclusion_type = NGExclusion::kFloatLeft; |
29 if (style.floating() == EFloat::kRight) | 29 if (style.floating() == EFloat::kRight) |
30 exclusion_type = NGExclusion::kFloatRight; | 30 exclusion_type = NGExclusion::kFloatRight; |
31 clear_type = style.clear(); | 31 clear_type = style.clear(); |
32 } | 32 } |
33 | 33 |
34 Member<NGPhysicalFragment> fragment; | 34 Member<NGPhysicalFragment> fragment; |
35 Member<const NGConstraintSpace> space; | 35 // TODO(glebl): Constraint space should be const here. |
| 36 Member<NGConstraintSpace> space; |
36 Member<NGBlockNode> node; | 37 Member<NGBlockNode> node; |
37 NGExclusion::Type exclusion_type; | 38 NGExclusion::Type exclusion_type; |
38 EClear clear_type; | 39 EClear clear_type; |
39 NGBoxStrut margins; | 40 NGBoxStrut margins; |
40 | 41 |
41 DEFINE_INLINE_TRACE() { | 42 DEFINE_INLINE_TRACE() { |
42 visitor->trace(fragment); | 43 visitor->trace(fragment); |
43 visitor->trace(space); | 44 visitor->trace(space); |
44 visitor->trace(node); | 45 visitor->trace(node); |
45 } | 46 } |
46 }; | 47 }; |
47 | 48 |
48 } // namespace blink | 49 } // namespace blink |
49 | 50 |
50 #endif // NGFloatingObject_h | 51 #endif // NGFloatingObject_h |
OLD | NEW |