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 NGLayoutInputNode_h | 5 #ifndef NGLayoutInputNode_h |
6 #define NGLayoutInputNode_h | 6 #define NGLayoutInputNode_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class LayoutObject; | 13 class LayoutObject; |
14 class NGConstraintSpace; | 14 class NGConstraintSpace; |
15 class NGPhysicalFragment; | 15 class NGPhysicalFragment; |
16 class NGLayoutAlgorithm; | |
17 | 16 |
18 // Represents the input to a layout algorithm for a given node. The layout | 17 // Represents the input to a layout algorithm for a given node. The layout |
19 // engine should use the style, node type to determine which type of layout | 18 // engine should use the style, node type to determine which type of layout |
20 // algorithm to use to produce fragments for this node. | 19 // algorithm to use to produce fragments for this node. |
21 class CORE_EXPORT NGLayoutInputNode | 20 class CORE_EXPORT NGLayoutInputNode |
22 : public GarbageCollectedFinalized<NGLayoutInputNode> { | 21 : public GarbageCollectedFinalized<NGLayoutInputNode> { |
23 public: | 22 public: |
24 enum NGLayoutInputNodeType { kLegacyBlock = 0, kLegacyInline = 1 }; | 23 enum NGLayoutInputNodeType { kLegacyBlock = 0, kLegacyInline = 1 }; |
25 | 24 |
26 virtual ~NGLayoutInputNode(){}; | 25 virtual ~NGLayoutInputNode(){}; |
27 | 26 |
28 // Performs layout on this input node, will return a new fragment. | 27 // Performs layout on this input node, will return a new fragment. |
29 virtual NGPhysicalFragment* Layout(NGConstraintSpace*) = 0; | 28 virtual NGPhysicalFragment* Layout(NGConstraintSpace*) = 0; |
30 | 29 |
31 // Returns the next sibling. | 30 // Returns the next sibling. |
32 virtual NGLayoutInputNode* NextSibling() = 0; | 31 virtual NGLayoutInputNode* NextSibling() = 0; |
33 | 32 |
34 // Returns the LayoutObject which is associated with this node. | 33 // Returns the LayoutObject which is associated with this node. |
35 virtual LayoutObject* GetLayoutObject() = 0; | 34 virtual LayoutObject* GetLayoutObject() = 0; |
36 | 35 |
37 NGLayoutInputNodeType Type() const { | 36 NGLayoutInputNodeType Type() const { |
38 return static_cast<NGLayoutInputNodeType>(type_); | 37 return static_cast<NGLayoutInputNodeType>(type_); |
39 } | 38 } |
40 | 39 |
41 static NGLayoutAlgorithm* AlgorithmForInputNode(NGLayoutInputNode*, | |
42 NGConstraintSpace*); | |
43 | |
44 DEFINE_INLINE_VIRTUAL_TRACE() {} | 40 DEFINE_INLINE_VIRTUAL_TRACE() {} |
45 | 41 |
46 protected: | 42 protected: |
47 explicit NGLayoutInputNode(NGLayoutInputNodeType type) : type_(type) {} | 43 explicit NGLayoutInputNode(NGLayoutInputNodeType type) : type_(type) {} |
48 | 44 |
49 private: | 45 private: |
50 unsigned type_ : 1; | 46 unsigned type_ : 1; |
51 }; | 47 }; |
52 | 48 |
53 } // namespace blink | 49 } // namespace blink |
54 | 50 |
55 #endif // NGLayoutInputNode_h | 51 #endif // NGLayoutInputNode_h |
OLD | NEW |