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

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

Issue 1509353004: Add UseCounters for Selection methods that take null (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years 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 d1d378ff0f4071771e4965932dcb043b64f536bd..cad8eb8070a17426922713cc286c5a08dd1d14e9 100644
--- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
@@ -43,6 +43,7 @@
#include "core/editing/FrameSelection.h"
#include "core/editing/iterators/TextIterator.h"
#include "core/frame/LocalFrame.h"
+#include "core/frame/UseCounter.h"
#include "core/inspector/ConsoleMessage.h"
#include "wtf/text/WTFString.h"
@@ -208,6 +209,7 @@ void DOMSelection::collapse(Node* node, int offset, ExceptionState& exceptionSta
return;
if (!node) {
+ UseCounter::count(m_frame, UseCounter::SelectionCollapseNull);
m_frame->selection().clear();
return;
}
@@ -281,6 +283,9 @@ void DOMSelection::setBaseAndExtent(Node* baseNode, int baseOffset, Node* extent
return;
}
+ if (!baseNode || !extentNode)
+ UseCounter::count(m_frame, UseCounter::SelectionSetBaseAndExtentNull);
+
if (!isValidForPosition(baseNode) || !isValidForPosition(extentNode))
return;

Powered by Google App Engine
This is Rietveld 408576698