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

Unified Diff: third_party/WebKit/Source/core/dom/RangeTest.cpp

Issue 2531483003: Make Range::createAdjustedToTreeScope() to handle the shadow root at end of document tree correctly. (Closed)
Patch Set: Created 4 years, 1 month 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/dom/Range.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/dom/RangeTest.cpp
diff --git a/third_party/WebKit/Source/core/dom/RangeTest.cpp b/third_party/WebKit/Source/core/dom/RangeTest.cpp
index e954b58e140a617cb3e505cd5fc351fc4f790385..a277916f01534f1fc26b71364550bbef2ab1fcaa 100644
--- a/third_party/WebKit/Source/core/dom/RangeTest.cpp
+++ b/third_party/WebKit/Source/core/dom/RangeTest.cpp
@@ -41,6 +41,18 @@ HTMLDocument& RangeTest::document() const {
return *m_document;
}
+TEST_F(RangeTest, createAdjustedToTreeScopeWithPositionInShadowTree) {
+ document().body()->setInnerHTML("<div><select><option>012</option></div>");
+ Element* const selectElement = document().querySelector("select");
+ const Position& position =
+ Position::afterNode(selectElement->userAgentShadowRoot());
+ Range* const range = Range::createAdjustedToTreeScope(document(), position);
+ EXPECT_EQ(range->startContainer(), selectElement->parentNode());
+ EXPECT_EQ(static_cast<unsigned>(range->startOffset()),
+ selectElement->nodeIndex());
+ EXPECT_TRUE(range->collapsed());
+}
+
TEST_F(RangeTest, SplitTextNodeRangeWithinText) {
document().body()->setInnerHTML("1234", ASSERT_NO_EXCEPTION);
Text* oldText = toText(document().body()->firstChild());
« no previous file with comments | « third_party/WebKit/Source/core/dom/Range.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698