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 #include "core/layout/ng/ng_block_node.h" | 5 #include "core/layout/ng/ng_block_node.h" |
6 | 6 |
7 #include "core/layout/LayoutTestHelper.h" | 7 #include "core/layout/LayoutTestHelper.h" |
8 #include "core/layout/ng/ng_box_fragment.h" | 8 #include "core/layout/ng/ng_box_fragment.h" |
9 #include "core/layout/ng/ng_min_max_content_size.h" | 9 #include "core/layout/ng/ng_min_max_content_size.h" |
10 #include "core/style/ComputedStyle.h" | 10 #include "core/style/ComputedStyle.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 SetBodyInnerHTML(R"HTML( | 102 SetBodyInnerHTML(R"HTML( |
103 <!DOCTYPE html> | 103 <!DOCTYPE html> |
104 <style> | 104 <style> |
105 float { float: left; } | 105 float { float: left; } |
106 </style> | 106 </style> |
107 <div id=container><float></float></div> | 107 <div id=container><float></float></div> |
108 )HTML"); | 108 )HTML"); |
109 NGBlockNode* container = | 109 NGBlockNode* container = |
110 new NGBlockNode(GetLayoutObjectByElementId("container")); | 110 new NGBlockNode(GetLayoutObjectByElementId("container")); |
111 NGLayoutInputNode* child1 = container->FirstChild(); | 111 NGLayoutInputNode* child1 = container->FirstChild(); |
112 EXPECT_TRUE(child1 && child1->IsBlock()); | 112 EXPECT_TRUE(child1 && child1->IsInline()); |
113 NGLayoutInputNode* child2 = child1->NextSibling(); | 113 NGLayoutInputNode* child2 = child1->NextSibling(); |
114 EXPECT_EQ(child2, nullptr); | 114 EXPECT_EQ(child2, nullptr); |
115 } | 115 } |
116 | 116 |
117 TEST_F(NGBlockNodeForTest, ChildFloatWithSpaces) { | 117 TEST_F(NGBlockNodeForTest, ChildFloatWithSpaces) { |
118 SetBodyInnerHTML(R"HTML( | 118 SetBodyInnerHTML(R"HTML( |
119 <!DOCTYPE html> | 119 <!DOCTYPE html> |
120 <style> | 120 <style> |
121 float { float: left; } | 121 float { float: left; } |
122 </style> | 122 </style> |
123 <div id=container> | 123 <div id=container> |
124 <float></float> | 124 <float></float> |
125 </div> | 125 </div> |
126 )HTML"); | 126 )HTML"); |
127 NGBlockNode* container = | 127 NGBlockNode* container = |
128 new NGBlockNode(GetLayoutObjectByElementId("container")); | 128 new NGBlockNode(GetLayoutObjectByElementId("container")); |
129 NGLayoutInputNode* child1 = container->FirstChild(); | 129 NGLayoutInputNode* child1 = container->FirstChild(); |
130 EXPECT_TRUE(child1 && child1->IsBlock()); | 130 EXPECT_TRUE(child1 && child1->IsInline()); |
131 NGLayoutInputNode* child2 = child1->NextSibling(); | 131 NGLayoutInputNode* child2 = child1->NextSibling(); |
132 EXPECT_EQ(child2, nullptr); | 132 EXPECT_EQ(child2, nullptr); |
133 } | 133 } |
134 | 134 |
135 TEST_F(NGBlockNodeForTest, ChildOofBeforeInline) { | 135 TEST_F(NGBlockNodeForTest, ChildOofBeforeInline) { |
136 SetBodyInnerHTML(R"HTML( | 136 SetBodyInnerHTML(R"HTML( |
137 <!DOCTYPE html> | 137 <!DOCTYPE html> |
138 <style> | 138 <style> |
139 oof { position: absolute; } | 139 oof { position: absolute; } |
140 </style> | 140 </style> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 )HTML"); | 173 )HTML"); |
174 const int kWidth = 30; | 174 const int kWidth = 30; |
175 | 175 |
176 NGBlockNode* box = new NGBlockNode(GetLayoutObjectByElementId("box")); | 176 NGBlockNode* box = new NGBlockNode(GetLayoutObjectByElementId("box")); |
177 MinMaxContentSize sizes = box->ComputeMinMaxContentSize(); | 177 MinMaxContentSize sizes = box->ComputeMinMaxContentSize(); |
178 EXPECT_EQ(LayoutUnit(kWidth), sizes.min_content); | 178 EXPECT_EQ(LayoutUnit(kWidth), sizes.min_content); |
179 EXPECT_EQ(LayoutUnit(kWidth), sizes.max_content); | 179 EXPECT_EQ(LayoutUnit(kWidth), sizes.max_content); |
180 } | 180 } |
181 } // namespace | 181 } // namespace |
182 } // namespace blink | 182 } // namespace blink |
OLD | NEW |