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