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 "core/style/ComputedStyle.h" |
9 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 class ComputedStyle; | |
14 class LayoutObject; | 14 class LayoutObject; |
15 class NGBreakToken; | 15 class NGBreakToken; |
16 class NGConstraintSpace; | 16 class NGConstraintSpace; |
17 class NGLayoutResult; | 17 class NGLayoutResult; |
18 struct MinMaxContentSize; | 18 struct MinMaxContentSize; |
19 | 19 |
20 // Represents the input to a layout algorithm for a given node. The layout | 20 // Represents the input to a layout algorithm for a given node. The layout |
21 // engine should use the style, node type to determine which type of layout | 21 // engine should use the style, node type to determine which type of layout |
22 // algorithm to use to produce fragments for this node. | 22 // algorithm to use to produce fragments for this node. |
23 class CORE_EXPORT NGLayoutInputNode | 23 class CORE_EXPORT NGLayoutInputNode |
24 : public GarbageCollectedFinalized<NGLayoutInputNode> { | 24 : public GarbageCollectedFinalized<NGLayoutInputNode> { |
25 public: | 25 public: |
26 enum NGLayoutInputNodeType { kLegacyBlock = 0, kLegacyInline = 1 }; | 26 enum NGLayoutInputNodeType { kLegacyBlock = 0, kLegacyInline = 1 }; |
27 | 27 |
28 bool IsInline() const { return type_ == kLegacyInline; } | 28 bool IsInline() const { return type_ == kLegacyInline; } |
29 | 29 |
30 bool IsBlock() const { return type_ == kLegacyBlock; } | 30 bool IsBlock() const { return type_ == kLegacyBlock; } |
31 | 31 |
| 32 bool IsFloating() const { return IsBlock() && Style().IsFloating(); } |
| 33 |
32 virtual ~NGLayoutInputNode(){}; | 34 virtual ~NGLayoutInputNode(){}; |
33 | 35 |
34 // Performs layout on this input node, will return the layout result. | 36 // Performs layout on this input node, will return the layout result. |
35 virtual RefPtr<NGLayoutResult> Layout(NGConstraintSpace*, NGBreakToken*) = 0; | 37 virtual RefPtr<NGLayoutResult> Layout(NGConstraintSpace*, NGBreakToken*) = 0; |
36 | 38 |
37 // Returns the next sibling. | 39 // Returns the next sibling. |
38 virtual NGLayoutInputNode* NextSibling() = 0; | 40 virtual NGLayoutInputNode* NextSibling() = 0; |
39 | 41 |
40 // Returns the LayoutObject which is associated with this node. | 42 // Returns the LayoutObject which is associated with this node. |
41 virtual LayoutObject* GetLayoutObject() = 0; | 43 virtual LayoutObject* GetLayoutObject() = 0; |
(...skipping 11 matching lines...) Expand all Loading... |
53 protected: | 55 protected: |
54 explicit NGLayoutInputNode(NGLayoutInputNodeType type) : type_(type) {} | 56 explicit NGLayoutInputNode(NGLayoutInputNodeType type) : type_(type) {} |
55 | 57 |
56 private: | 58 private: |
57 unsigned type_ : 1; | 59 unsigned type_ : 1; |
58 }; | 60 }; |
59 | 61 |
60 } // namespace blink | 62 } // namespace blink |
61 | 63 |
62 #endif // NGLayoutInputNode_h | 64 #endif // NGLayoutInputNode_h |
OLD | NEW |