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

Side by Side 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: Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 return frame() && frame()->selection().isAvailable(); 75 return frame() && frame()->selection().isAvailable();
76 } 76 }
77 77
78 void DOMSelection::updateFrameSelection(const SelectionInDOMTree& selection, 78 void DOMSelection::updateFrameSelection(const SelectionInDOMTree& selection,
79 Range* newCachedRange) const { 79 Range* newCachedRange) const {
80 DCHECK(frame()); 80 DCHECK(frame());
81 FrameSelection& frameSelection = frame()->selection(); 81 FrameSelection& frameSelection = frame()->selection();
82 // TODO(tkent): Specify FrameSelection::DoNotSetFocus. crbug.com/690272 82 // TODO(tkent): Specify FrameSelection::DoNotSetFocus. crbug.com/690272
83 bool didSet = frameSelection.setSelectionDeprecated(selection); 83 bool didSet = frameSelection.setSelectionDeprecated(selection);
84 cacheRangeIfSelectionOfDocument(newCachedRange); 84 cacheRangeIfSelectionOfDocument(newCachedRange);
85 if (didSet) 85 if (!didSet)
86 frameSelection.didSetSelectionDeprecated(); 86 return;
87 Element* focusedElement = frame()->document()->focusedElement();
88 frameSelection.didSetSelectionDeprecated();
89 if (focusedElement != frame()->document()->focusedElement())
tkent 2017/02/28 07:14:42 This line crashed because frame() or frame()->docu
90 UseCounter::count(frame(), UseCounter::SelectionFuncionsChangeFocus);
87 } 91 }
88 92
89 const VisibleSelection& DOMSelection::visibleSelection() const { 93 const VisibleSelection& DOMSelection::visibleSelection() const {
90 DCHECK(frame()); 94 DCHECK(frame());
91 return frame()->selection().computeVisibleSelectionInDOMTreeDeprecated(); 95 return frame()->selection().computeVisibleSelectionInDOMTreeDeprecated();
92 } 96 }
93 97
94 bool DOMSelection::isBaseFirstInSelection() const { 98 bool DOMSelection::isBaseFirstInSelection() const {
95 DCHECK(frame()); 99 DCHECK(frame());
96 const SelectionInDOMTree& selection = 100 const SelectionInDOMTree& selection =
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 m_treeScope->document().addConsoleMessage( 829 m_treeScope->document().addConsoleMessage(
826 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message)); 830 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message));
827 } 831 }
828 832
829 DEFINE_TRACE(DOMSelection) { 833 DEFINE_TRACE(DOMSelection) {
830 visitor->trace(m_treeScope); 834 visitor->trace(m_treeScope);
831 ContextClient::trace(visitor); 835 ContextClient::trace(visitor);
832 } 836 }
833 837
834 } // namespace blink 838 } // namespace blink
OLDNEW
« 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