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

Unified Diff: Source/core/editing/DOMSelection.cpp

Issue 546703003: Editing: Let Selection.collapse with null clears selection. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add tests Created 6 years, 3 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 | « LayoutTests/editing/selection/collapse-null-expected.txt ('k') | Source/core/editing/Selection.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/DOMSelection.cpp
diff --git a/Source/core/editing/DOMSelection.cpp b/Source/core/editing/DOMSelection.cpp
index 6012b131dbfb49621d2f7980ef49dffd783e7777..3d06123b7bb1051bf21c53579f7351469100cadc 100644
--- a/Source/core/editing/DOMSelection.cpp
+++ b/Source/core/editing/DOMSelection.cpp
@@ -197,10 +197,14 @@ int DOMSelection::rangeCount() const
void DOMSelection::collapse(Node* node, int offset, ExceptionState& exceptionState)
{
- ASSERT(node);
if (!m_frame)
return;
+ if (!node) {
+ m_frame->selection().clear();
+ return;
+ }
+
if (offset < 0) {
exceptionState.throwDOMException(IndexSizeError, String::number(offset) + " is not a valid offset.");
return;
« no previous file with comments | « LayoutTests/editing/selection/collapse-null-expected.txt ('k') | Source/core/editing/Selection.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698