Index: third_party/WebKit/Source/core/layout/LayoutTextTest.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutTextTest.cpp b/third_party/WebKit/Source/core/layout/LayoutTextTest.cpp |
index 9c551bbcf4df3a69b7405733b165cb34ab898c3b..99f195be7e03c2e96e15148b828bf08d23d52c52 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutTextTest.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutTextTest.cpp |
@@ -85,4 +85,70 @@ TEST_F(LayoutTextTest, WidthLengthBeyondLength) |
ASSERT_LE(width, 20.f); |
} |
+TEST_F(LayoutTextTest, ConsecutiveWhitespaceRenderers) |
+{ |
+ setBodyInnerHTML("<span></span> <span id='span'></span>"); |
+ |
+ Element* span = document().getElementById("span"); |
+ Node* whitespace1 = span->previousSibling(); |
+ Node* whitespace2 = Text::create(document(), " "); |
+ document().body()->insertBefore(whitespace2, span, ASSERT_NO_EXCEPTION); |
+ document().view()->updateAllLifecyclePhases(); |
+ |
+ EXPECT_TRUE(whitespace1->layoutObject()); |
+ EXPECT_FALSE(whitespace2->layoutObject()); |
+} |
mstensho (USE GERRIT)
2016/09/28 11:19:09
How about a test similar to this one, except that
|
+ |
+TEST_F(LayoutTextTest, ConsecutiveWhitespaceRenderersDisplayNone) |
+{ |
+ setBodyInnerHTML("<span></span> <span style='display:none'></span> <span></span>"); |
+ |
+ // First <span> |
+ Node* child = document().body()->firstChild(); |
+ ASSERT_TRUE(child); |
+ |
+ // First whitespace node |
+ child = child->nextSibling(); |
+ ASSERT_TRUE(child); |
+ EXPECT_TRUE(child->isTextNode()); |
+ EXPECT_TRUE(child->layoutObject()); |
+ |
+ // <span display:none> |
+ child = child->nextSibling(); |
+ ASSERT_TRUE(child); |
+ EXPECT_FALSE(child->layoutObject()); |
+ |
+ // Second whitespace node |
+ child = child->nextSibling(); |
+ ASSERT_TRUE(child); |
+ EXPECT_TRUE(child->isTextNode()); |
+ EXPECT_FALSE(child->layoutObject()); |
+} |
+ |
+TEST_F(LayoutTextTest, ConsecutiveWhitespaceRenderersComment) |
+{ |
+ setBodyInnerHTML("<span></span> <!-- --> <span></span>"); |
+ |
+ // First <span> |
+ Node* child = document().body()->firstChild(); |
+ ASSERT_TRUE(child); |
+ |
+ // First whitespace node |
+ child = child->nextSibling(); |
+ ASSERT_TRUE(child); |
+ EXPECT_TRUE(child->isTextNode()); |
+ EXPECT_TRUE(child->layoutObject()); |
+ |
+ // <span display:none> |
rune
2016/09/27 13:54:14
This should be the comment <!-- -->
rune
2016/09/28 12:13:10
Fixed.
|
+ child = child->nextSibling(); |
+ ASSERT_TRUE(child); |
+ EXPECT_FALSE(child->layoutObject()); |
+ |
+ // Second whitespace node |
+ child = child->nextSibling(); |
+ ASSERT_TRUE(child); |
+ EXPECT_TRUE(child->isTextNode()); |
+ EXPECT_FALSE(child->layoutObject()); |
+} |
+ |
} // namespace blink |