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

Side by Side Diff: third_party/WebKit/Source/core/editing/DOMSelection.cpp

Issue 2727553002: Selection API: Add a UseCounter for focus change by Selection.modify(). (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 | no next file » | 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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 granularity = LineBoundary; 429 granularity = LineBoundary;
430 else if (equalIgnoringCase(granularityString, "sentenceboundary")) 430 else if (equalIgnoringCase(granularityString, "sentenceboundary"))
431 granularity = SentenceBoundary; 431 granularity = SentenceBoundary;
432 else if (equalIgnoringCase(granularityString, "paragraphboundary")) 432 else if (equalIgnoringCase(granularityString, "paragraphboundary"))
433 granularity = ParagraphBoundary; 433 granularity = ParagraphBoundary;
434 else if (equalIgnoringCase(granularityString, "documentboundary")) 434 else if (equalIgnoringCase(granularityString, "documentboundary"))
435 granularity = DocumentBoundary; 435 granularity = DocumentBoundary;
436 else 436 else
437 return; 437 return;
438 438
439 Element* focusedElement = frame()->document()->focusedElement();
439 frame()->selection().modify(alter, direction, granularity); 440 frame()->selection().modify(alter, direction, granularity);
441 if (frame() && frame()->document() &&
442 focusedElement != frame()->document()->focusedElement())
443 UseCounter::count(frame(), UseCounter::SelectionFuncionsChangeFocus);
440 } 444 }
441 445
442 // https://www.w3.org/TR/selection-api/#dom-selection-extend 446 // https://www.w3.org/TR/selection-api/#dom-selection-extend
443 void DOMSelection::extend(Node* node, 447 void DOMSelection::extend(Node* node,
444 unsigned offset, 448 unsigned offset,
445 ExceptionState& exceptionState) { 449 ExceptionState& exceptionState) {
446 DCHECK(node); 450 DCHECK(node);
447 if (!isAvailable()) 451 if (!isAvailable())
448 return; 452 return;
449 453
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 m_treeScope->document().addConsoleMessage( 814 m_treeScope->document().addConsoleMessage(
811 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message)); 815 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message));
812 } 816 }
813 817
814 DEFINE_TRACE(DOMSelection) { 818 DEFINE_TRACE(DOMSelection) {
815 visitor->trace(m_treeScope); 819 visitor->trace(m_treeScope);
816 ContextClient::trace(visitor); 820 ContextClient::trace(visitor);
817 } 821 }
818 822
819 } // namespace blink 823 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698