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/ng/ng_layout_input_node.h" | 9 #include "core/layout/ng/ng_layout_input_node.h" |
10 #include "core/layout/ng/ng_physical_box_fragment.h" | 10 #include "core/layout/ng/ng_physical_box_fragment.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 // Called if this is an out-of-flow block which needs to be | 74 // Called if this is an out-of-flow block which needs to be |
75 // positioned with legacy layout. | 75 // positioned with legacy layout. |
76 void UseOldOutOfFlowPositioning(); | 76 void UseOldOutOfFlowPositioning(); |
77 | 77 |
78 // Save static position for legacy AbsPos layout. | 78 // Save static position for legacy AbsPos layout. |
79 void SaveStaticOffsetForLegacy(const NGLogicalOffset&); | 79 void SaveStaticOffsetForLegacy(const NGLogicalOffset&); |
80 | 80 |
81 void UpdateLayoutBox(NGPhysicalBoxFragment* fragment, | 81 void UpdateLayoutBox(NGPhysicalBoxFragment* fragment, |
82 const NGConstraintSpace* constraint_space); | 82 const NGConstraintSpace* constraint_space); |
83 | |
84 private: | |
85 // This is necessary for interop between old and new trees -- after our parent | 83 // This is necessary for interop between old and new trees -- after our parent |
86 // positions us, it calls this function so we can store the position on the | 84 // positions us, it calls this function so we can store the position on the |
87 // underlying LayoutBox. | 85 // underlying LayoutBox. |
88 void PositionUpdated(); | 86 void PositionUpdated(); |
89 | 87 |
| 88 private: |
90 bool CanUseNewLayout(); | 89 bool CanUseNewLayout(); |
91 bool HasInlineChildren(); | 90 bool HasInlineChildren(); |
92 | 91 |
93 // After we run the layout algorithm, this function copies back the geometry | 92 // After we run the layout algorithm, this function copies back the geometry |
94 // data to the layout box. | 93 // data to the layout box. |
95 void CopyFragmentDataToLayoutBox(const NGConstraintSpace&); | 94 void CopyFragmentDataToLayoutBox(const NGConstraintSpace&); |
96 | 95 |
97 // We can either wrap a layout_box_ or a style_/next_sibling_/first_child_ | 96 // We can either wrap a layout_box_ or a style_/next_sibling_/first_child_ |
98 // combination. | 97 // combination. |
99 LayoutBox* layout_box_; | 98 LayoutBox* layout_box_; |
100 RefPtr<ComputedStyle> style_; | 99 RefPtr<ComputedStyle> style_; |
101 Member<NGBlockNode> next_sibling_; | 100 Member<NGBlockNode> next_sibling_; |
102 Member<NGLayoutInputNode> first_child_; | 101 Member<NGLayoutInputNode> first_child_; |
103 Member<NGLayoutCoordinator> layout_coordinator_; | 102 Member<NGLayoutCoordinator> layout_coordinator_; |
104 // TODO(mstensho): An input node may produce multiple fragments, so this | 103 // TODO(mstensho): An input node may produce multiple fragments, so this |
105 // should probably be renamed to last_fragment_ or something like that, since | 104 // should probably be renamed to last_fragment_ or something like that, since |
106 // the last fragment is all we care about when resuming layout. | 105 // the last fragment is all we care about when resuming layout. |
107 Member<NGPhysicalBoxFragment> fragment_; | 106 Member<NGPhysicalBoxFragment> fragment_; |
108 }; | 107 }; |
109 | 108 |
110 DEFINE_TYPE_CASTS(NGBlockNode, | 109 DEFINE_TYPE_CASTS(NGBlockNode, |
111 NGLayoutInputNode, | 110 NGLayoutInputNode, |
112 node, | 111 node, |
113 node->Type() == NGLayoutInputNode::kLegacyBlock, | 112 node->Type() == NGLayoutInputNode::kLegacyBlock, |
114 node.Type() == NGLayoutInputNode::kLegacyBlock); | 113 node.Type() == NGLayoutInputNode::kLegacyBlock); |
115 | 114 |
116 } // namespace blink | 115 } // namespace blink |
117 | 116 |
118 #endif // NGBlockNode | 117 #endif // NGBlockNode |
OLD | NEW |