| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 if (options & FrameSelection::DoNotAdjustInFlatTree) { | 90 if (options & FrameSelection::DoNotAdjustInFlatTree) { |
| 91 m_selectionInFlatTree.setWithoutValidation(toPositionInFlatTree(m_select
ion.base()), toPositionInFlatTree(m_selection.extent())); | 91 m_selectionInFlatTree.setWithoutValidation(toPositionInFlatTree(m_select
ion.base()), toPositionInFlatTree(m_selection.extent())); |
| 92 return; | 92 return; |
| 93 } | 93 } |
| 94 | 94 |
| 95 SelectionAdjuster::adjustSelectionInFlatTree(&m_selectionInFlatTree, m_selec
tion); | 95 SelectionAdjuster::adjustSelectionInFlatTree(&m_selectionInFlatTree, m_selec
tion); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void SelectionEditor::setVisibleSelection(const VisibleSelectionInFlatTree& newS
election, FrameSelection::SetSelectionOptions options) | 98 void SelectionEditor::setVisibleSelection(const VisibleSelectionInFlatTree& newS
election, FrameSelection::SetSelectionOptions options) |
| 99 { | 99 { |
| 100 ASSERT(!(options & FrameSelection::DoNotAdjustInFlatTree)); | 100 DCHECK(!(options & FrameSelection::DoNotAdjustInFlatTree)); |
| 101 m_selectionInFlatTree = newSelection; | 101 m_selectionInFlatTree = newSelection; |
| 102 SelectionAdjuster::adjustSelectionInDOMTree(&m_selection, m_selectionInFlatT
ree); | 102 SelectionAdjuster::adjustSelectionInDOMTree(&m_selection, m_selectionInFlatT
ree); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void SelectionEditor::resetXPosForVerticalArrowNavigation() | 105 void SelectionEditor::resetXPosForVerticalArrowNavigation() |
| 106 { | 106 { |
| 107 m_xPosForVerticalArrowNavigation = NoXPosForVerticalArrowNavigation(); | 107 m_xPosForVerticalArrowNavigation = NoXPosForVerticalArrowNavigation(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void SelectionEditor::setIsDirectional(bool isDirectional) | 110 void SelectionEditor::setIsDirectional(bool isDirectional) |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 { | 856 { |
| 857 Node* selectStartTarget = m_selection.extent().computeContainerNode(); | 857 Node* selectStartTarget = m_selection.extent().computeContainerNode(); |
| 858 if (!selectStartTarget) | 858 if (!selectStartTarget) |
| 859 return DispatchEventResult::NotCanceled; | 859 return DispatchEventResult::NotCanceled; |
| 860 | 860 |
| 861 return selectStartTarget->dispatchEvent(Event::createCancelableBubble(EventT
ypeNames::selectstart)); | 861 return selectStartTarget->dispatchEvent(Event::createCancelableBubble(EventT
ypeNames::selectstart)); |
| 862 } | 862 } |
| 863 | 863 |
| 864 void SelectionEditor::didChangeVisibleSelection() | 864 void SelectionEditor::didChangeVisibleSelection() |
| 865 { | 865 { |
| 866 ASSERT(m_observingVisibleSelection); | 866 DCHECK(m_observingVisibleSelection); |
| 867 // Invalidate the logical range when the underlying VisibleSelection has cha
nged. | 867 // Invalidate the logical range when the underlying VisibleSelection has cha
nged. |
| 868 if (m_logicalRange) { | 868 if (m_logicalRange) { |
| 869 m_logicalRange->dispose(); | 869 m_logicalRange->dispose(); |
| 870 m_logicalRange = nullptr; | 870 m_logicalRange = nullptr; |
| 871 } | 871 } |
| 872 m_selection.clearChangeObserver(); | 872 m_selection.clearChangeObserver(); |
| 873 m_observingVisibleSelection = false; | 873 m_observingVisibleSelection = false; |
| 874 } | 874 } |
| 875 | 875 |
| 876 void SelectionEditor::startObservingVisibleSelectionChange() | 876 void SelectionEditor::startObservingVisibleSelectionChange() |
| 877 { | 877 { |
| 878 ASSERT(!m_observingVisibleSelection); | 878 DCHECK(!m_observingVisibleSelection); |
| 879 m_selection.setChangeObserver(*this); | 879 m_selection.setChangeObserver(*this); |
| 880 m_observingVisibleSelection = true; | 880 m_observingVisibleSelection = true; |
| 881 } | 881 } |
| 882 | 882 |
| 883 void SelectionEditor::stopObservingVisibleSelectionChangeIfNecessary() | 883 void SelectionEditor::stopObservingVisibleSelectionChangeIfNecessary() |
| 884 { | 884 { |
| 885 if (!m_observingVisibleSelection) | 885 if (!m_observingVisibleSelection) |
| 886 return; | 886 return; |
| 887 m_selection.clearChangeObserver(); | 887 m_selection.clearChangeObserver(); |
| 888 m_observingVisibleSelection = false; | 888 m_observingVisibleSelection = false; |
| 889 } | 889 } |
| 890 | 890 |
| 891 void SelectionEditor::updateIfNeeded() | 891 void SelectionEditor::updateIfNeeded() |
| 892 { | 892 { |
| 893 m_selection.updateIfNeeded(); | 893 m_selection.updateIfNeeded(); |
| 894 m_selectionInFlatTree.updateIfNeeded(); | 894 m_selectionInFlatTree.updateIfNeeded(); |
| 895 } | 895 } |
| 896 | 896 |
| 897 DEFINE_TRACE(SelectionEditor) | 897 DEFINE_TRACE(SelectionEditor) |
| 898 { | 898 { |
| 899 visitor->trace(m_frameSelection); | 899 visitor->trace(m_frameSelection); |
| 900 visitor->trace(m_selection); | 900 visitor->trace(m_selection); |
| 901 visitor->trace(m_selectionInFlatTree); | 901 visitor->trace(m_selectionInFlatTree); |
| 902 visitor->trace(m_logicalRange); | 902 visitor->trace(m_logicalRange); |
| 903 VisibleSelectionChangeObserver::trace(visitor); | 903 VisibleSelectionChangeObserver::trace(visitor); |
| 904 } | 904 } |
| 905 | 905 |
| 906 } // namespace blink | 906 } // namespace blink |
| OLD | NEW |