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

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

Issue 2710593009: Selection API: add removeRange(). (Closed)
Patch Set: . Created 3 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/Source/core/editing/DOMSelection.cpp
diff --git a/third_party/WebKit/Source/core/editing/DOMSelection.cpp b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
index 4540f0f6369de4b28cfb82f37fc318da948c1a68..770df423472bc6e5fff13ae5489d9649fb7f89ba 100644
--- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
@@ -581,6 +581,14 @@ void DOMSelection::clearCachedRangeIfSelectionOfDocument() {
frame()->selection().clearDocumentCachedRange();
}
+void DOMSelection::removeRange(Range* range) {
+ DCHECK(range);
+ if (!isAvailable())
+ return;
+ if (range == primaryRangeOrNull())
yosin_UTC9 2017/02/24 14:47:55 nit: I prefer early-return style: if (range != pr
tkent 2017/02/24 17:44:12 I prefer early-return in general. However, not-ea
+ frame()->selection().clear();
+}
+
void DOMSelection::removeAllRanges() {
if (!isAvailable())
return;
« no previous file with comments | « third_party/WebKit/Source/core/editing/DOMSelection.h ('k') | third_party/WebKit/Source/core/editing/Selection.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698