| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 return m_frameSelection->frame(); | 77 return m_frameSelection->frame(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 template <> | 80 template <> |
| 81 const VisibleSelection& SelectionEditor::visibleSelection<EditingStrategy>() con
st | 81 const VisibleSelection& SelectionEditor::visibleSelection<EditingStrategy>() con
st |
| 82 { | 82 { |
| 83 return m_selection; | 83 return m_selection; |
| 84 } | 84 } |
| 85 | 85 |
| 86 template <> | 86 template <> |
| 87 const VisibleSelectionInComposedTree& SelectionEditor::visibleSelection<EditingI
nComposedTreeStrategy>() const | 87 const VisibleSelectionInFlatTree& SelectionEditor::visibleSelection<EditingInFla
tTreeStrategy>() const |
| 88 { | 88 { |
| 89 return m_selectionInComposedTree; | 89 return m_selectionInFlatTree; |
| 90 } | 90 } |
| 91 | 91 |
| 92 void SelectionEditor::setVisibleSelection(const VisibleSelection& newSelection,
FrameSelection::SetSelectionOptions options) | 92 void SelectionEditor::setVisibleSelection(const VisibleSelection& newSelection,
FrameSelection::SetSelectionOptions options) |
| 93 { | 93 { |
| 94 m_selection = newSelection; | 94 m_selection = newSelection; |
| 95 if (options & FrameSelection::DoNotAdjustInComposedTree) { | 95 if (options & FrameSelection::DoNotAdjustInFlatTree) { |
| 96 m_selectionInComposedTree.setWithoutValidation(toPositionInComposedTree(
m_selection.base()), toPositionInComposedTree(m_selection.extent())); | 96 m_selectionInFlatTree.setWithoutValidation(toPositionInFlatTree(m_select
ion.base()), toPositionInFlatTree(m_selection.extent())); |
| 97 return; | 97 return; |
| 98 } | 98 } |
| 99 | 99 |
| 100 SelectionAdjuster::adjustSelectionInComposedTree(&m_selectionInComposedTree,
m_selection); | 100 SelectionAdjuster::adjustSelectionInFlatTree(&m_selectionInFlatTree, m_selec
tion); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void SelectionEditor::setVisibleSelection(const VisibleSelectionInComposedTree&
newSelection, FrameSelection::SetSelectionOptions options) | 103 void SelectionEditor::setVisibleSelection(const VisibleSelectionInFlatTree& newS
election, FrameSelection::SetSelectionOptions options) |
| 104 { | 104 { |
| 105 ASSERT(!(options & FrameSelection::DoNotAdjustInComposedTree)); | 105 ASSERT(!(options & FrameSelection::DoNotAdjustInFlatTree)); |
| 106 m_selectionInComposedTree = newSelection; | 106 m_selectionInFlatTree = newSelection; |
| 107 SelectionAdjuster::adjustSelectionInDOMTree(&m_selection, m_selectionInCompo
sedTree); | 107 SelectionAdjuster::adjustSelectionInDOMTree(&m_selection, m_selectionInFlatT
ree); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void SelectionEditor::resetXPosForVerticalArrowNavigation() | 110 void SelectionEditor::resetXPosForVerticalArrowNavigation() |
| 111 { | 111 { |
| 112 m_xPosForVerticalArrowNavigation = NoXPosForVerticalArrowNavigation(); | 112 m_xPosForVerticalArrowNavigation = NoXPosForVerticalArrowNavigation(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void SelectionEditor::setIsDirectional(bool isDirectional) | 115 void SelectionEditor::setIsDirectional(bool isDirectional) |
| 116 { | 116 { |
| 117 m_selection.setIsDirectional(isDirectional); | 117 m_selection.setIsDirectional(isDirectional); |
| 118 m_selectionInComposedTree.setIsDirectional(isDirectional); | 118 m_selectionInFlatTree.setIsDirectional(isDirectional); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void SelectionEditor::setWithoutValidation(const Position& base, const Position&
extent) | 121 void SelectionEditor::setWithoutValidation(const Position& base, const Position&
extent) |
| 122 { | 122 { |
| 123 m_selection.setWithoutValidation(base, extent); | 123 m_selection.setWithoutValidation(base, extent); |
| 124 m_selectionInComposedTree.setWithoutValidation(toPositionInComposedTree(base
), toPositionInComposedTree(extent)); | 124 m_selectionInFlatTree.setWithoutValidation(toPositionInFlatTree(base), toPos
itionInFlatTree(extent)); |
| 125 } | 125 } |
| 126 | 126 |
| 127 TextDirection SelectionEditor::directionOfEnclosingBlock() | 127 TextDirection SelectionEditor::directionOfEnclosingBlock() |
| 128 { | 128 { |
| 129 return blink::directionOfEnclosingBlock(m_selection.extent()); | 129 return blink::directionOfEnclosingBlock(m_selection.extent()); |
| 130 } | 130 } |
| 131 | 131 |
| 132 TextDirection SelectionEditor::directionOfSelection() | 132 TextDirection SelectionEditor::directionOfSelection() |
| 133 { | 133 { |
| 134 InlineBox* startBox = nullptr; | 134 InlineBox* startBox = nullptr; |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 { | 888 { |
| 889 if (!m_observingVisibleSelection) | 889 if (!m_observingVisibleSelection) |
| 890 return; | 890 return; |
| 891 m_selection.clearChangeObserver(); | 891 m_selection.clearChangeObserver(); |
| 892 m_observingVisibleSelection = false; | 892 m_observingVisibleSelection = false; |
| 893 } | 893 } |
| 894 | 894 |
| 895 void SelectionEditor::updateIfNeeded() | 895 void SelectionEditor::updateIfNeeded() |
| 896 { | 896 { |
| 897 m_selection.updateIfNeeded(); | 897 m_selection.updateIfNeeded(); |
| 898 m_selectionInComposedTree.updateIfNeeded(); | 898 m_selectionInFlatTree.updateIfNeeded(); |
| 899 } | 899 } |
| 900 | 900 |
| 901 DEFINE_TRACE(SelectionEditor) | 901 DEFINE_TRACE(SelectionEditor) |
| 902 { | 902 { |
| 903 visitor->trace(m_frameSelection); | 903 visitor->trace(m_frameSelection); |
| 904 visitor->trace(m_selection); | 904 visitor->trace(m_selection); |
| 905 visitor->trace(m_selectionInComposedTree); | 905 visitor->trace(m_selectionInFlatTree); |
| 906 visitor->trace(m_logicalRange); | 906 visitor->trace(m_logicalRange); |
| 907 VisibleSelectionChangeObserver::trace(visitor); | 907 VisibleSelectionChangeObserver::trace(visitor); |
| 908 } | 908 } |
| 909 | 909 |
| 910 } // namespace blink | 910 } // namespace blink |
| OLD | NEW |