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" |
(...skipping 11 matching lines...) Expand all Loading... |
22 struct NGLogicalOffset; | 22 struct NGLogicalOffset; |
23 struct MinAndMaxContentSizes; | 23 struct MinAndMaxContentSizes; |
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 | |
33 explicit NGBlockNode(ComputedStyle*); | |
34 | |
35 ~NGBlockNode() override; | 32 ~NGBlockNode() override; |
36 | 33 |
37 RefPtr<NGLayoutResult> Layout(NGConstraintSpace* constraint_space, | 34 RefPtr<NGLayoutResult> Layout(NGConstraintSpace* constraint_space, |
38 NGBreakToken* break_token = nullptr) override; | 35 NGBreakToken* break_token = nullptr) override; |
39 NGLayoutInputNode* NextSibling() override; | 36 NGLayoutInputNode* NextSibling() override; |
40 LayoutObject* GetLayoutObject() override; | 37 LayoutObject* GetLayoutObject() override; |
41 | 38 |
42 // Computes the value of min-content and max-content for this box. | 39 // Computes the value of min-content and max-content for this box. |
43 // If the underlying layout algorithm's ComputeMinAndMaxContentSizes returns | 40 // If the underlying layout algorithm's ComputeMinAndMaxContentSizes returns |
44 // no value, this function will synthesize these sizes using Layout with | 41 // no value, this function will synthesize these sizes using Layout with |
45 // special constraint spaces -- infinite available size for max content, zero | 42 // special constraint spaces -- infinite available size for max content, zero |
46 // available size for min content, and percentage resolution size zero for | 43 // available size for min content, and percentage resolution size zero for |
47 // both. | 44 // both. |
48 MinAndMaxContentSizes ComputeMinAndMaxContentSizes(); | 45 MinAndMaxContentSizes ComputeMinAndMaxContentSizes(); |
49 | 46 |
50 const ComputedStyle& Style() const; | 47 const ComputedStyle& Style() const; |
51 | 48 |
52 NGLayoutInputNode* FirstChild(); | 49 NGLayoutInputNode* FirstChild(); |
53 | 50 |
54 void SetNextSibling(NGLayoutInputNode*); | |
55 void SetFirstChild(NGLayoutInputNode*); | |
56 | |
57 DECLARE_VIRTUAL_TRACE(); | 51 DECLARE_VIRTUAL_TRACE(); |
58 | 52 |
59 // Runs layout on layout_box_ and creates a fragment for the resulting | 53 // Runs layout on layout_box_ and creates a fragment for the resulting |
60 // geometry. | 54 // geometry. |
61 RefPtr<NGLayoutResult> RunOldLayout(const NGConstraintSpace&); | 55 RefPtr<NGLayoutResult> RunOldLayout(const NGConstraintSpace&); |
62 | 56 |
63 // Called if this is an out-of-flow block which needs to be | 57 // Called if this is an out-of-flow block which needs to be |
64 // positioned with legacy layout. | 58 // positioned with legacy layout. |
65 void UseOldOutOfFlowPositioning(); | 59 void UseOldOutOfFlowPositioning(); |
66 | 60 |
(...skipping 22 matching lines...) Expand all Loading... |
89 | 83 |
90 DEFINE_TYPE_CASTS(NGBlockNode, | 84 DEFINE_TYPE_CASTS(NGBlockNode, |
91 NGLayoutInputNode, | 85 NGLayoutInputNode, |
92 node, | 86 node, |
93 node->Type() == NGLayoutInputNode::kLegacyBlock, | 87 node->Type() == NGLayoutInputNode::kLegacyBlock, |
94 node.Type() == NGLayoutInputNode::kLegacyBlock); | 88 node.Type() == NGLayoutInputNode::kLegacyBlock); |
95 | 89 |
96 } // namespace blink | 90 } // namespace blink |
97 | 91 |
98 #endif // NGBlockNode | 92 #endif // NGBlockNode |
OLD | NEW |