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 NGBlockNode_h | 5 #ifndef NGBlockNode_h |
6 #define NGBlockNode_h | 6 #define NGBlockNode_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/layout/LayoutBox.h" | 9 #include "core/layout/LayoutBox.h" |
10 #include "core/layout/ng/ng_layout_input_node.h" | 10 #include "core/layout/ng/ng_layout_input_node.h" |
11 #include "core/layout/ng/ng_layout_result.h" | 11 #include "core/layout/ng/ng_layout_result.h" |
12 #include "core/layout/ng/ng_physical_box_fragment.h" | 12 #include "core/layout/ng/ng_physical_box_fragment.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 ComputedStyle; | 17 class ComputedStyle; |
18 class LayoutObject; | 18 class LayoutObject; |
19 class NGBreakToken; | 19 class NGBreakToken; |
20 class NGConstraintSpace; | 20 class NGConstraintSpace; |
21 class NGLayoutResult; | 21 class NGLayoutResult; |
22 struct NGLogicalOffset; | 22 struct NGLogicalOffset; |
23 struct MinAndMaxContentSizes; | 23 struct MinMaxContentSize; |
24 | 24 |
25 // Represents a node to be laid out. | 25 // Represents a node to be laid out. |
26 class CORE_EXPORT NGBlockNode final : public NGLayoutInputNode { | 26 class CORE_EXPORT NGBlockNode final : public NGLayoutInputNode { |
27 friend NGLayoutInputNode; | 27 friend NGLayoutInputNode; |
28 | 28 |
29 public: | 29 public: |
30 explicit NGBlockNode(LayoutObject*); | 30 explicit NGBlockNode(LayoutObject*); |
31 | 31 |
32 // TODO(layout-ng): make it private and declare a friend class to use in tests | 32 // TODO(layout-ng): make it private and declare a friend class to use in tests |
33 explicit NGBlockNode(ComputedStyle*); | 33 explicit NGBlockNode(ComputedStyle*); |
34 | 34 |
35 ~NGBlockNode() override; | 35 ~NGBlockNode() override; |
36 | 36 |
37 RefPtr<NGLayoutResult> Layout(NGConstraintSpace* constraint_space, | 37 RefPtr<NGLayoutResult> Layout(NGConstraintSpace* constraint_space, |
38 NGBreakToken* break_token = nullptr) override; | 38 NGBreakToken* break_token = nullptr) override; |
39 NGLayoutInputNode* NextSibling() override; | 39 NGLayoutInputNode* NextSibling() override; |
40 LayoutObject* GetLayoutObject() override; | 40 LayoutObject* GetLayoutObject() override; |
41 | 41 |
42 // Computes the value of min-content and max-content for this box. | 42 // Computes the value of min-content and max-content for this box. |
43 // If the underlying layout algorithm's ComputeMinAndMaxContentSizes returns | 43 // If the underlying layout algorithm's ComputeMinMaxContentSize returns |
44 // no value, this function will synthesize these sizes using Layout with | 44 // no value, this function will synthesize these sizes using Layout with |
45 // special constraint spaces -- infinite available size for max content, zero | 45 // special constraint spaces -- infinite available size for max content, zero |
46 // available size for min content, and percentage resolution size zero for | 46 // available size for min content, and percentage resolution size zero for |
47 // both. | 47 // both. |
48 MinAndMaxContentSizes ComputeMinAndMaxContentSizes(); | 48 MinMaxContentSize ComputeMinMaxContentSize(); |
49 | 49 |
50 const ComputedStyle& Style() const; | 50 const ComputedStyle& Style() const; |
51 | 51 |
52 NGLayoutInputNode* FirstChild(); | 52 NGLayoutInputNode* FirstChild(); |
53 | 53 |
54 void SetNextSibling(NGLayoutInputNode*); | 54 void SetNextSibling(NGLayoutInputNode*); |
55 void SetFirstChild(NGLayoutInputNode*); | 55 void SetFirstChild(NGLayoutInputNode*); |
56 | 56 |
57 DECLARE_VIRTUAL_TRACE(); | 57 DECLARE_VIRTUAL_TRACE(); |
58 | 58 |
(...skipping 30 matching lines...) Expand all Loading... |
89 | 89 |
90 DEFINE_TYPE_CASTS(NGBlockNode, | 90 DEFINE_TYPE_CASTS(NGBlockNode, |
91 NGLayoutInputNode, | 91 NGLayoutInputNode, |
92 node, | 92 node, |
93 node->Type() == NGLayoutInputNode::kLegacyBlock, | 93 node->Type() == NGLayoutInputNode::kLegacyBlock, |
94 node.Type() == NGLayoutInputNode::kLegacyBlock); | 94 node.Type() == NGLayoutInputNode::kLegacyBlock); |
95 | 95 |
96 } // namespace blink | 96 } // namespace blink |
97 | 97 |
98 #endif // NGBlockNode | 98 #endif // NGBlockNode |
OLD | NEW |