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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // Runs layout on layout_box_ and creates a fragment for the resulting | 64 // Runs layout on layout_box_ and creates a fragment for the resulting |
65 // geometry. | 65 // geometry. |
66 RefPtr<NGPhysicalBoxFragment> RunOldLayout(const NGConstraintSpace&); | 66 RefPtr<NGPhysicalBoxFragment> RunOldLayout(const NGConstraintSpace&); |
67 | 67 |
68 // Called if this is an out-of-flow block which needs to be | 68 // Called if this is an out-of-flow block which needs to be |
69 // positioned with legacy layout. | 69 // positioned with legacy layout. |
70 void UseOldOutOfFlowPositioning(); | 70 void UseOldOutOfFlowPositioning(); |
71 | 71 |
72 // Save static position for legacy AbsPos layout. | 72 // Save static position for legacy AbsPos layout. |
73 void SaveStaticOffsetForLegacy(const NGLogicalOffset&); | 73 void SaveStaticOffsetForLegacy(const NGLogicalOffset&); |
| 74 |
74 private: | 75 private: |
75 | |
76 bool CanUseNewLayout(); | 76 bool CanUseNewLayout(); |
77 bool HasInlineChildren(); | 77 bool HasInlineChildren(); |
78 | 78 |
79 // After we run the layout algorithm, this function copies back the geometry | 79 // After we run the layout algorithm, this function copies back the geometry |
80 // data to the layout box. | 80 // data to the layout box. |
81 void CopyFragmentDataToLayoutBox(const NGConstraintSpace&); | 81 void CopyFragmentDataToLayoutBox(const NGConstraintSpace&); |
82 | 82 |
83 // We can either wrap a layout_box_ or a style_/next_sibling_/first_child_ | 83 // We can either wrap a layout_box_ or a style_/next_sibling_/first_child_ |
84 // combination. | 84 // combination. |
85 LayoutBox* layout_box_; | 85 LayoutBox* layout_box_; |
86 RefPtr<ComputedStyle> style_; | 86 RefPtr<ComputedStyle> style_; |
87 Member<NGBlockNode> next_sibling_; | 87 Member<NGBlockNode> next_sibling_; |
88 Member<NGLayoutInputNode> first_child_; | 88 Member<NGLayoutInputNode> first_child_; |
89 // TODO(mstensho): An input node may produce multiple fragments, so this | 89 // TODO(mstensho): An input node may produce multiple fragments, so this |
90 // should probably be renamed to last_fragment_ or something like that, since | 90 // should probably be renamed to last_fragment_ or something like that, since |
91 // the last fragment is all we care about when resuming layout. | 91 // the last fragment is all we care about when resuming layout. |
92 RefPtr<NGPhysicalBoxFragment> fragment_; | 92 RefPtr<NGPhysicalBoxFragment> fragment_; |
93 }; | 93 }; |
94 | 94 |
95 DEFINE_TYPE_CASTS(NGBlockNode, | 95 DEFINE_TYPE_CASTS(NGBlockNode, |
96 NGLayoutInputNode, | 96 NGLayoutInputNode, |
97 node, | 97 node, |
98 node->Type() == NGLayoutInputNode::kLegacyBlock, | 98 node->Type() == NGLayoutInputNode::kLegacyBlock, |
99 node.Type() == NGLayoutInputNode::kLegacyBlock); | 99 node.Type() == NGLayoutInputNode::kLegacyBlock); |
100 | 100 |
101 } // namespace blink | 101 } // namespace blink |
102 | 102 |
103 #endif // NGBlockNode | 103 #endif // NGBlockNode |
OLD | NEW |