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

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

Issue 359593002: Selection should be updated after node is moved to another document (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: WIP 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698