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

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

Issue 2194393004: Move Range objects new owner after moving tree rather than during moving tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-08-02T18:35:29 Created 4 years, 4 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
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 6a90f82f2a7c715f731931489c7bd48b2e093ba7..7ae205521ee296e463e1b17d26021359b859acb5 100644
--- a/third_party/WebKit/Source/core/dom/RangeTest.cpp
+++ b/third_party/WebKit/Source/core/dom/RangeTest.cpp
@@ -138,4 +138,21 @@ TEST_F(RangeTest, SplitTextNodeRangeOutsideText)
EXPECT_EQ(4, rangeFromTextToMiddleOfElement->endOffset());
}
+TEST_F(RangeTest, updateOwnerDocumentIfNeeded)
+{
+ Element* foo = document().createElement("foo", ASSERT_NO_EXCEPTION);
+ Element* bar = document().createElement("bar", ASSERT_NO_EXCEPTION);
+ foo->appendChild(bar);
+
+ Range* range = Range::create(document(), Position(bar, 0), Position(foo, 1));
+
+ Document* anotherDocument = Document::create();
+ anotherDocument->appendChild(foo);
+
+ EXPECT_EQ(bar, range->startContainer());
+ EXPECT_EQ(0, range->startOffset());
+ EXPECT_EQ(foo, range->endContainer());
+ EXPECT_EQ(1, range->endOffset());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.cpp ('k') | third_party/WebKit/Source/core/dom/TreeScopeAdopter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698