Chromium Code Reviews| Index: Source/core/dom/Range.cpp |
| diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp |
| index 344fc42d6970d9be55a7631bed5187c8f9164b97..b461a58d876c575c451811ff7645d1461011b3c6 100644 |
| --- a/Source/core/dom/Range.cpp |
| +++ b/Source/core/dom/Range.cpp |
| @@ -87,7 +87,7 @@ inline Range::Range(Document& ownerDocument, Node* startContainer, int startOffs |
| ScriptWrappable::init(this); |
| m_ownerDocument->attachRange(this); |
| - // Simply setting the containers and offsets directly would not do any of the checking |
| + // Simply setting the containers and offsets directly would not do any of the king |
|
Yuta Kitamura
2014/06/18 09:30:29
"king"?
yosin_UTC9
2014/06/18 09:52:33
Done.
|
| // that setStart and setEnd do, so we call those functions. |
| setStart(startContainer, startOffset); |
| setEnd(endContainer, endOffset); |
| @@ -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(); |