| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |