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

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

Issue 2718293002: Selection API: Add a UseCounter for focus change by selection change. (Closed)
Patch Set: fix crashes in some tests 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b19285ebdf988df34cb5022b386dccb7f546b0a4..0be1a2ae870efbbf18f15e289beedfc639afae6e 100644
--- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
@@ -82,8 +82,13 @@ void DOMSelection::updateFrameSelection(const SelectionInDOMTree& selection,
// TODO(tkent): Specify FrameSelection::DoNotSetFocus. crbug.com/690272
bool didSet = frameSelection.setSelectionDeprecated(selection);
cacheRangeIfSelectionOfDocument(newCachedRange);
- if (didSet)
- frameSelection.didSetSelectionDeprecated();
+ if (!didSet)
+ return;
+ Element* focusedElement = frame()->document()->focusedElement();
+ frameSelection.didSetSelectionDeprecated();
+ if (frame() && frame()->document() &&
+ focusedElement != frame()->document()->focusedElement())
+ UseCounter::count(frame(), UseCounter::SelectionFuncionsChangeFocus);
}
const VisibleSelection& DOMSelection::visibleSelection() const {
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698