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

Unified Diff: Source/core/dom/Range.cpp

Issue 332173003: Update owner document of Range objects if start/end boundary points in different document (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2014-06-18T06:46:10 Created 6 years, 6 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 | « Source/core/dom/Range.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Range.cpp
diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp
index 344fc42d6970d9be55a7631bed5187c8f9164b97..10e4029cd0d6d752462117ea2f51264371c24b63 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -1544,6 +1544,19 @@ void Range::didMergeTextNodes(const NodeWithIndex& oldNode, unsigned offset)
boundaryTextNodesMerged(m_end, oldNode, offset);
}
+void Range::updateOwnerDocumentIfNeeded()
+{
+ ASSERT(m_start.container());
+ ASSERT(m_end.container());
+ Document& newDocument = m_start.container()->document();
+ ASSERT(newDocument == m_end.container()->document());
+ if (newDocument == m_ownerDocument)
+ return;
+ m_ownerDocument->detachRange(this);
+ m_ownerDocument = &newDocument;
+ m_ownerDocument->attachRange(this);
+}
+
static inline void boundaryTextNodeSplit(RangeBoundaryPoint& boundary, Text& oldNode)
{
Node* boundaryContainer = boundary.container();
« no previous file with comments | « Source/core/dom/Range.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698