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

Unified Diff: third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp

Issue 2131103002: Ensure that TextIterator::m_pastEndNode is not skipped in advance() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revise unit test Created 4 years, 5 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/editing/iterators/TextIterator.cpp ('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/editing/iterators/TextIteratorTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp
index 49b45d75b8f31fde205bd305fd3aede4ca7eddc5..9e6a5bdf22a990d3b502b0878e3894f16a2807e8 100644
--- a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp
@@ -497,4 +497,31 @@ TEST_F(TextIteratorTest, CopyWholeCodePoints)
EXPECT_EQ(expected[i], buffer[i]);
}
+// Regression test for crbug.com/630921
+TEST_F(TextIteratorTest, EndingConditionWithDisplayNone)
+{
+ setBodyContent("<div style='display: none'><span>hello</span>world</div>Lorem ipsum dolor sit amet.");
+ Position start(&document(), 0);
+ Position end(document().querySelector("span"), 0);
+ TextIterator iter(start, end);
+ EXPECT_TRUE(iter.atEnd());
+}
+
+// Trickier regression test for crbug.com/630921
+TEST_F(TextIteratorTest, EndingConditionWithDisplayNoneInShadowTree)
+{
+ const char* bodyContent = "<div style='display: none'><span id=host><a></a></span>world</div>Lorem ipsum dolor sit amet.";
+ const char* shadowContent = "<i><b id=end>he</b></i>llo";
+ setBodyContent(bodyContent);
+ setShadowContent(shadowContent, "host");
+
+ ShadowRoot* shadowRoot = document().getElementById("host")->openShadowRoot();
+ Node* bInShadowTree = shadowRoot->getElementById("end");
+
+ Position start(&document(), 0);
+ Position end(bInShadowTree, 0);
+ TextIterator iter(start, end);
+ EXPECT_TRUE(iter.atEnd());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698