| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 SetBodyInnerHTML(R"HTML( | 70 SetBodyInnerHTML(R"HTML( |
| 71 <!DOCTYPE html> | 71 <!DOCTYPE html> |
| 72 <style> | 72 <style> |
| 73 float { float: left; } | 73 float { float: left; } |
| 74 </style> | 74 </style> |
| 75 <div id=container><float></float>Hello!</div> | 75 <div id=container><float></float>Hello!</div> |
| 76 )HTML"); | 76 )HTML"); |
| 77 NGBlockNode* container = | 77 NGBlockNode* container = |
| 78 new NGBlockNode(GetLayoutObjectByElementId("container")); | 78 new NGBlockNode(GetLayoutObjectByElementId("container")); |
| 79 NGLayoutInputNode* child1 = container->FirstChild(); | 79 NGLayoutInputNode* child1 = container->FirstChild(); |
| 80 EXPECT_TRUE(child1 && child1->IsInline()); | 80 EXPECT_TRUE(child1 && child1->IsBlock()); |
| 81 NGLayoutInputNode* child2 = child1->NextSibling(); | 81 NGLayoutInputNode* child2 = child1->NextSibling(); |
| 82 EXPECT_EQ(child2, nullptr); | 82 EXPECT_TRUE(child2 && child2->IsBlock()); |
| 83 } | 83 } |
| 84 | 84 |
| 85 TEST_F(NGBlockNodeForTest, ChildFloatAfterInline) { | 85 TEST_F(NGBlockNodeForTest, ChildFloatAfterInline) { |
| 86 SetBodyInnerHTML(R"HTML( | 86 SetBodyInnerHTML(R"HTML( |
| 87 <!DOCTYPE html> | 87 <!DOCTYPE html> |
| 88 <style> | 88 <style> |
| 89 float { float: left; } | 89 float { float: left; } |
| 90 </style> | 90 </style> |
| 91 <div id=container>Hello<float></float></div> | 91 <div id=container>Hello<float></float></div> |
| 92 )HTML"); | 92 )HTML"); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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> |
| 141 <div id=container><oof></oof>Hello!</div> | 141 <div id=container><oof></oof>Hello!</div> |
| 142 )HTML"); | 142 )HTML"); |
| 143 NGBlockNode* container = | 143 NGBlockNode* container = |
| 144 new NGBlockNode(GetLayoutObjectByElementId("container")); | 144 new NGBlockNode(GetLayoutObjectByElementId("container")); |
| 145 NGLayoutInputNode* child1 = container->FirstChild(); | 145 NGLayoutInputNode* child1 = container->FirstChild(); |
| 146 EXPECT_TRUE(child1 && child1->IsInline()); | 146 EXPECT_TRUE(child1 && child1->IsBlock()); |
| 147 NGLayoutInputNode* child2 = child1->NextSibling(); | 147 NGLayoutInputNode* child2 = child1->NextSibling(); |
| 148 EXPECT_EQ(child2, nullptr); | 148 EXPECT_TRUE(child2 && child2->IsBlock()); |
| 149 } | 149 } |
| 150 | 150 |
| 151 TEST_F(NGBlockNodeForTest, ChildOofAfterInline) { | 151 TEST_F(NGBlockNodeForTest, ChildOofAfterInline) { |
| 152 SetBodyInnerHTML(R"HTML( | 152 SetBodyInnerHTML(R"HTML( |
| 153 <!DOCTYPE html> | 153 <!DOCTYPE html> |
| 154 <style> | 154 <style> |
| 155 oof { position: absolute; } | 155 oof { position: absolute; } |
| 156 </style> | 156 </style> |
| 157 <div id=container>Hello!<oof></oof></div> | 157 <div id=container>Hello!<oof></oof></div> |
| 158 )HTML"); | 158 )HTML"); |
| (...skipping 14 matching lines...) Expand all 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 |