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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 // Save static position for legacy AbsPos layout. | 76 // Save static position for legacy AbsPos layout. |
77 void SaveStaticOffsetForLegacy(const NGLogicalOffset&); | 77 void SaveStaticOffsetForLegacy(const NGLogicalOffset&); |
78 | 78 |
79 // This is necessary for interop between old and new trees -- after our parent | 79 // This is necessary for interop between old and new trees -- after our parent |
80 // positions us, it calls this function so we can store the position on the | 80 // positions us, it calls this function so we can store the position on the |
81 // underlying LayoutBox. | 81 // underlying LayoutBox. |
82 void PositionUpdated(); | 82 void PositionUpdated(); |
83 | 83 |
84 private: | 84 private: |
| 85 // Similar to PositionUpdated but for floats. |
| 86 // - Updates layout object's geometric information. |
| 87 // - Creates legacy FloatingObject and attached it to the provided parent. |
| 88 void FloatPositionUpdated(LayoutObject* parent); |
| 89 |
85 bool CanUseNewLayout(); | 90 bool CanUseNewLayout(); |
86 bool HasInlineChildren(); | 91 bool HasInlineChildren(); |
87 | 92 |
88 // After we run the layout algorithm, this function copies back the geometry | 93 // After we run the layout algorithm, this function copies back the geometry |
89 // data to the layout box. | 94 // data to the layout box. |
90 void CopyFragmentDataToLayoutBox(const NGConstraintSpace&); | 95 void CopyFragmentDataToLayoutBox(const NGConstraintSpace&); |
91 | 96 |
92 // We can either wrap a layout_box_ or a style_/next_sibling_/first_child_ | 97 // We can either wrap a layout_box_ or a style_/next_sibling_/first_child_ |
93 // combination. | 98 // combination. |
94 LayoutBox* layout_box_; | 99 LayoutBox* layout_box_; |
95 RefPtr<ComputedStyle> style_; | 100 RefPtr<ComputedStyle> style_; |
96 Member<NGBlockNode> next_sibling_; | 101 Member<NGBlockNode> next_sibling_; |
97 Member<NGLayoutInputNode> first_child_; | 102 Member<NGLayoutInputNode> first_child_; |
98 // TODO(mstensho): An input node may produce multiple fragments, so this | 103 // TODO(mstensho): An input node may produce multiple fragments, so this |
99 // 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 |
100 // the last fragment is all we care about when resuming layout. | 105 // the last fragment is all we care about when resuming layout. |
101 Member<NGPhysicalBoxFragment> fragment_; | 106 Member<NGPhysicalBoxFragment> fragment_; |
102 }; | 107 }; |
103 | 108 |
104 DEFINE_TYPE_CASTS(NGBlockNode, | 109 DEFINE_TYPE_CASTS(NGBlockNode, |
105 NGLayoutInputNode, | 110 NGLayoutInputNode, |
106 node, | 111 node, |
107 node->Type() == NGLayoutInputNode::kLegacyBlock, | 112 node->Type() == NGLayoutInputNode::kLegacyBlock, |
108 node.Type() == NGLayoutInputNode::kLegacyBlock); | 113 node.Type() == NGLayoutInputNode::kLegacyBlock); |
109 | 114 |
110 } // namespace blink | 115 } // namespace blink |
111 | 116 |
112 #endif // NGBlockNode | 117 #endif // NGBlockNode |
OLD | NEW |