Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(425)

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_block_node_test.cc

Issue 2815003006: [LayoutNG] Handle floats/OOF at the beginning of inline in inline context (Closed)
Patch Set: Resolve merge conflict Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_block_node.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/ng/ng_block_node_test.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_node_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_node_test.cc
index 7c70718761740f7e83ead688052f1d0f21c7de38..d3becbc086b9845c4ec174e69290d1588d4a7e2e 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_block_node_test.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_block_node_test.cc
@@ -18,6 +18,152 @@ class NGBlockNodeForTest : public RenderingTest {
~NGBlockNodeForTest() { RuntimeEnabledFeatures::setLayoutNGEnabled(false); };
};
+TEST_F(NGBlockNodeForTest, ChildInlineAndBlock) {
+ SetBodyInnerHTML(R"HTML(
+ <!DOCTYPE html>
+ <div id=container>Hello!<div></div></div>
+ )HTML");
+ NGBlockNode* container =
+ new NGBlockNode(GetLayoutObjectByElementId("container"));
+ NGLayoutInputNode* child1 = container->FirstChild();
+ EXPECT_TRUE(child1 && child1->IsBlock());
+ NGLayoutInputNode* child2 = child1->NextSibling();
+ EXPECT_TRUE(child2 && child2->IsBlock());
+ NGLayoutInputNode* child3 = child2->NextSibling();
+ EXPECT_EQ(child3, nullptr);
+}
+
+TEST_F(NGBlockNodeForTest, ChildBlockAndInline) {
+ SetBodyInnerHTML(R"HTML(
+ <!DOCTYPE html>
+ <div id=container><div></div>Hello!</div>
+ )HTML");
+ NGBlockNode* container =
+ new NGBlockNode(GetLayoutObjectByElementId("container"));
+ NGLayoutInputNode* child1 = container->FirstChild();
+ EXPECT_TRUE(child1 && child1->IsBlock());
+ NGLayoutInputNode* child2 = child1->NextSibling();
+ EXPECT_TRUE(child2 && child2->IsBlock());
+ NGLayoutInputNode* child3 = child2->NextSibling();
+ EXPECT_EQ(child3, nullptr);
+}
+
+TEST_F(NGBlockNodeForTest, ChildFloatBeforeBlock) {
+ SetBodyInnerHTML(R"HTML(
+ <!DOCTYPE html>
+ <style>
+ float { float: left; }
+ </style>
+ <div id=container><float></float><div></div></div>
+ )HTML");
+ NGBlockNode* container =
+ new NGBlockNode(GetLayoutObjectByElementId("container"));
+ NGLayoutInputNode* child1 = container->FirstChild();
+ EXPECT_TRUE(child1 && child1->IsBlock());
+ NGLayoutInputNode* child2 = child1->NextSibling();
+ EXPECT_TRUE(child2 && child2->IsBlock());
+ NGLayoutInputNode* child3 = child2->NextSibling();
+ EXPECT_EQ(child3, nullptr);
+}
+
+TEST_F(NGBlockNodeForTest, ChildFloatBeforeInline) {
+ SetBodyInnerHTML(R"HTML(
+ <!DOCTYPE html>
+ <style>
+ float { float: left; }
+ </style>
+ <div id=container><float></float>Hello!</div>
+ )HTML");
+ NGBlockNode* container =
+ new NGBlockNode(GetLayoutObjectByElementId("container"));
+ NGLayoutInputNode* child1 = container->FirstChild();
+ EXPECT_TRUE(child1 && child1->IsInline());
+ NGLayoutInputNode* child2 = child1->NextSibling();
+ EXPECT_EQ(child2, nullptr);
+}
+
+TEST_F(NGBlockNodeForTest, ChildFloatAfterInline) {
+ SetBodyInnerHTML(R"HTML(
+ <!DOCTYPE html>
+ <style>
+ float { float: left; }
+ </style>
+ <div id=container>Hello<float></float></div>
+ )HTML");
+ NGBlockNode* container =
+ new NGBlockNode(GetLayoutObjectByElementId("container"));
+ NGLayoutInputNode* child1 = container->FirstChild();
+ EXPECT_TRUE(child1 && child1->IsInline());
+ NGLayoutInputNode* child2 = child1->NextSibling();
+ EXPECT_EQ(child2, nullptr);
+}
+
+TEST_F(NGBlockNodeForTest, ChildFloatOnly) {
+ SetBodyInnerHTML(R"HTML(
+ <!DOCTYPE html>
+ <style>
+ float { float: left; }
+ </style>
+ <div id=container><float></float></div>
+ )HTML");
+ NGBlockNode* container =
+ new NGBlockNode(GetLayoutObjectByElementId("container"));
+ NGLayoutInputNode* child1 = container->FirstChild();
+ EXPECT_TRUE(child1 && child1->IsBlock());
+ NGLayoutInputNode* child2 = child1->NextSibling();
+ EXPECT_EQ(child2, nullptr);
+}
+
+TEST_F(NGBlockNodeForTest, ChildFloatWithSpaces) {
+ SetBodyInnerHTML(R"HTML(
+ <!DOCTYPE html>
+ <style>
+ float { float: left; }
+ </style>
+ <div id=container>
+ <float></float>
+ </div>
+ )HTML");
+ NGBlockNode* container =
+ new NGBlockNode(GetLayoutObjectByElementId("container"));
+ NGLayoutInputNode* child1 = container->FirstChild();
+ EXPECT_TRUE(child1 && child1->IsBlock());
+ NGLayoutInputNode* child2 = child1->NextSibling();
+ EXPECT_EQ(child2, nullptr);
+}
+
+TEST_F(NGBlockNodeForTest, ChildOofBeforeInline) {
+ SetBodyInnerHTML(R"HTML(
+ <!DOCTYPE html>
+ <style>
+ oof { position: absolute; }
+ </style>
+ <div id=container><oof></oof>Hello!</div>
+ )HTML");
+ NGBlockNode* container =
+ new NGBlockNode(GetLayoutObjectByElementId("container"));
+ NGLayoutInputNode* child1 = container->FirstChild();
+ EXPECT_TRUE(child1 && child1->IsInline());
+ NGLayoutInputNode* child2 = child1->NextSibling();
+ EXPECT_EQ(child2, nullptr);
+}
+
+TEST_F(NGBlockNodeForTest, ChildOofAfterInline) {
+ SetBodyInnerHTML(R"HTML(
+ <!DOCTYPE html>
+ <style>
+ oof { position: absolute; }
+ </style>
+ <div id=container>Hello!<oof></oof></div>
+ )HTML");
+ NGBlockNode* container =
+ new NGBlockNode(GetLayoutObjectByElementId("container"));
+ NGLayoutInputNode* child1 = container->FirstChild();
+ EXPECT_TRUE(child1 && child1->IsInline());
+ NGLayoutInputNode* child2 = child1->NextSibling();
+ EXPECT_EQ(child2, nullptr);
+}
+
TEST_F(NGBlockNodeForTest, MinAndMaxContent) {
SetBodyInnerHTML(R"HTML(
<div id="box" >
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_block_node.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698