Index: Source/core/dom/Document.cpp |
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
index 4b97db5687594905c5098d97a830f72460741aa7..702810d340c789d333b7750c6bd9e2f4425a2679 100644 |
--- a/Source/core/dom/Document.cpp |
+++ b/Source/core/dom/Document.cpp |
@@ -3737,12 +3737,20 @@ void Document::updateRangesAfterChildrenChanged(ContainerNode* container) |
void Document::updateRangesAfterNodeMovedToAnotherDocument(const Node& node) |
{ |
ASSERT(node.document() != this); |
- if (m_ranges.isEmpty()) |
- return; |
- AttachedRangeSet ranges = m_ranges; |
- AttachedRangeSet::const_iterator end = ranges.end(); |
- for (AttachedRangeSet::const_iterator it = ranges.begin(); it != end; ++it) |
- (*it)->updateOwnerDocumentIfNeeded(); |
+ if (!m_ranges.isEmpty()) { |
+ AttachedRangeSet ranges = m_ranges; |
+ AttachedRangeSet::const_iterator end = ranges.end(); |
+ for (AttachedRangeSet::const_iterator it = ranges.begin(); it != end; ++it) |
+ (*it)->updateOwnerDocumentIfNeeded(); |
+ } |
+ |
+ if (LocalFrame* frame = this->frame()) { |
+ if (!frame->selection().isNone()) { |
yosin_UTC9
2014/06/27 01:39:24
FrameSelection::firstRange() returns faked Range o
|
+ RefPtrWillBeRawPtr<Range> range = frame->selection().firstRange(); |
+ range->updateOwnerDocumentIfNeeded(); |
+ frame->selection().setSelection(VisibleSelection(range.get())); |
+ } |
+ } |
} |
void Document::nodeChildrenWillBeRemoved(ContainerNode& container) |