| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 return granularity == LineBoundary || granularity == ParagraphBoundary || gr
anularity == DocumentBoundary; | 626 return granularity == LineBoundary || granularity == ParagraphBoundary || gr
anularity == DocumentBoundary; |
| 627 } | 627 } |
| 628 | 628 |
| 629 bool SelectionEditor::modify(EAlteration alter, SelectionDirection direction, Te
xtGranularity granularity, EUserTriggered userTriggered) | 629 bool SelectionEditor::modify(EAlteration alter, SelectionDirection direction, Te
xtGranularity granularity, EUserTriggered userTriggered) |
| 630 { | 630 { |
| 631 if (userTriggered == UserTriggered) { | 631 if (userTriggered == UserTriggered) { |
| 632 OwnPtrWillBeRawPtr<FrameSelection> trialFrameSelection = FrameSelection:
:create(); | 632 OwnPtrWillBeRawPtr<FrameSelection> trialFrameSelection = FrameSelection:
:create(); |
| 633 trialFrameSelection->setSelection(m_selection); | 633 trialFrameSelection->setSelection(m_selection); |
| 634 trialFrameSelection->modify(alter, direction, granularity, NotUserTrigge
red); | 634 trialFrameSelection->modify(alter, direction, granularity, NotUserTrigge
red); |
| 635 | 635 |
| 636 if (trialFrameSelection->selection().isRange() && m_selection.isCaret()
&& !dispatchSelectStart()) | 636 if (trialFrameSelection->selection().isRange() && m_selection.isCaret()
&& dispatchSelectStart() != WebInputEventResult::NotHandled) |
| 637 return false; | 637 return false; |
| 638 } | 638 } |
| 639 | 639 |
| 640 willBeModified(alter, direction); | 640 willBeModified(alter, direction); |
| 641 | 641 |
| 642 bool wasRange = m_selection.isRange(); | 642 bool wasRange = m_selection.isRange(); |
| 643 VisiblePosition originalStartPosition = m_selection.visibleStart(); | 643 VisiblePosition originalStartPosition = m_selection.visibleStart(); |
| 644 VisiblePosition position; | 644 VisiblePosition position; |
| 645 switch (direction) { | 645 switch (direction) { |
| 646 case DirectionRight: | 646 case DirectionRight: |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 return true; | 894 return true; |
| 895 } | 895 } |
| 896 | 896 |
| 897 PassRefPtrWillBeRawPtr<Range> SelectionEditor::firstRange() const | 897 PassRefPtrWillBeRawPtr<Range> SelectionEditor::firstRange() const |
| 898 { | 898 { |
| 899 if (m_logicalRange) | 899 if (m_logicalRange) |
| 900 return m_logicalRange->cloneRange(); | 900 return m_logicalRange->cloneRange(); |
| 901 return firstRangeOf(m_selection); | 901 return firstRangeOf(m_selection); |
| 902 } | 902 } |
| 903 | 903 |
| 904 bool SelectionEditor::dispatchSelectStart() | 904 WebInputEventResult SelectionEditor::dispatchSelectStart() |
| 905 { | 905 { |
| 906 Node* selectStartTarget = m_selection.extent().computeContainerNode(); | 906 Node* selectStartTarget = m_selection.extent().computeContainerNode(); |
| 907 if (!selectStartTarget) | 907 if (!selectStartTarget) |
| 908 return true; | 908 return WebInputEventResult::NotHandled; |
| 909 | 909 |
| 910 return selectStartTarget->dispatchEvent(Event::createCancelableBubble(EventT
ypeNames::selectstart)); | 910 return selectStartTarget->dispatchEvent(Event::createCancelableBubble(EventT
ypeNames::selectstart)); |
| 911 } | 911 } |
| 912 | 912 |
| 913 void SelectionEditor::didChangeVisibleSelection() | 913 void SelectionEditor::didChangeVisibleSelection() |
| 914 { | 914 { |
| 915 ASSERT(m_observingVisibleSelection); | 915 ASSERT(m_observingVisibleSelection); |
| 916 // Invalidate the logical range when the underlying VisibleSelection has cha
nged. | 916 // Invalidate the logical range when the underlying VisibleSelection has cha
nged. |
| 917 m_logicalRange = nullptr; | 917 m_logicalRange = nullptr; |
| 918 m_selection.clearChangeObserver(); | 918 m_selection.clearChangeObserver(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 937 DEFINE_TRACE(SelectionEditor) | 937 DEFINE_TRACE(SelectionEditor) |
| 938 { | 938 { |
| 939 visitor->trace(m_frameSelection); | 939 visitor->trace(m_frameSelection); |
| 940 visitor->trace(m_selection); | 940 visitor->trace(m_selection); |
| 941 visitor->trace(m_selectionInComposedTree); | 941 visitor->trace(m_selectionInComposedTree); |
| 942 visitor->trace(m_logicalRange); | 942 visitor->trace(m_logicalRange); |
| 943 VisibleSelectionChangeObserver::trace(visitor); | 943 VisibleSelectionChangeObserver::trace(visitor); |
| 944 } | 944 } |
| 945 | 945 |
| 946 } // namespace blink | 946 } // namespace blink |
| OLD | NEW |