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

Unified Diff: third_party/WebKit/WebCore/page/DOMSelection.cpp

Issue 21184: WebKit merge 40722:40785 (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 10 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/WebCore/page/DOMSelection.cpp
===================================================================
--- third_party/WebKit/WebCore/page/DOMSelection.cpp (revision 9391)
+++ third_party/WebKit/WebCore/page/DOMSelection.cpp (working copy)
@@ -298,8 +298,11 @@
return 0;
}
+ // If you're hitting this, you've added broken multi-range selection support
+ ASSERT(rangeCount() == 1);
+
const Selection& selection = m_frame->selection()->selection();
- return selection.toRange();
+ return selection.firstRange();
}
void DOMSelection::removeAllRanges()
@@ -323,7 +326,7 @@
return;
}
- RefPtr<Range> range = selection->selection().toRange();
+ RefPtr<Range> range = selection->selection().toNormalizedRange();
ExceptionCode ec = 0;
if (r->compareBoundaryPoints(Range::START_TO_START, range.get(), ec) == -1) {
// We don't support discontiguous selection. We don't do anything if r and range don't intersect.
@@ -361,7 +364,7 @@
if (isCollapsed())
selection->modify(SelectionController::EXTEND, SelectionController::BACKWARD, CharacterGranularity);
- RefPtr<Range> selectedRange = selection->selection().toRange();
+ RefPtr<Range> selectedRange = selection->selection().toNormalizedRange();
ExceptionCode ec = 0;
selectedRange->deleteContents(ec);
@@ -383,7 +386,7 @@
Node* parentNode = n->parentNode();
unsigned nodeIndex = n->nodeIndex();
- RefPtr<Range> selectedRange = selection->selection().toRange();
+ RefPtr<Range> selectedRange = selection->selection().toNormalizedRange();
if (!parentNode)
return false;
@@ -418,7 +421,7 @@
if (!m_frame)
return String();
- return plainText(m_frame->selection()->selection().toRange().get());
+ return plainText(m_frame->selection()->selection().toNormalizedRange().get());
}
} // namespace WebCore
« no previous file with comments | « third_party/WebKit/WebCore/page/ContextMenuController.cpp ('k') | third_party/WebKit/WebCore/page/DOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698