| 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 template <> | 77 template <> |
| 78 const VisibleSelectionInComposedTree& SelectionEditor::visibleSelection<EditingI
nComposedTreeStrategy>() const | 78 const VisibleSelectionInComposedTree& SelectionEditor::visibleSelection<EditingI
nComposedTreeStrategy>() const |
| 79 { | 79 { |
| 80 return m_selectionInComposedTree; | 80 return m_selectionInComposedTree; |
| 81 } | 81 } |
| 82 | 82 |
| 83 void SelectionEditor::setVisibleSelection(const VisibleSelection& newSelection,
FrameSelection::SetSelectionOptions options) | 83 void SelectionEditor::setVisibleSelection(const VisibleSelection& newSelection,
FrameSelection::SetSelectionOptions options) |
| 84 { | 84 { |
| 85 m_selection = newSelection; | 85 m_selection = newSelection; |
| 86 if (options & FrameSelection::DoNotAdjustInComposedTree) { | 86 if (options & FrameSelection::DoNotAdjustInComposedTree) { |
| 87 const auto& base = toPositionInComposedTree(m_selection.base()); | 87 m_selectionInComposedTree.setWithoutValidation(toPositionInComposedTree(
m_selection.base()), toPositionInComposedTree(m_selection.extent())); |
| 88 const auto& extent = toPositionInComposedTree(m_selection.extent()); | |
| 89 base.anchorNode()->updateDistribution(); | |
| 90 extent.anchorNode()->updateDistribution(); | |
| 91 m_selectionInComposedTree.setWithoutValidation(base, extent); | |
| 92 return; | 88 return; |
| 93 } | 89 } |
| 94 | 90 |
| 95 adjustVisibleSelectionInComposedTree(); | 91 adjustVisibleSelectionInComposedTree(); |
| 96 } | 92 } |
| 97 | 93 |
| 98 void SelectionEditor::setVisibleSelection(const VisibleSelectionInComposedTree&
newSelection, FrameSelection::SetSelectionOptions options) | 94 void SelectionEditor::setVisibleSelection(const VisibleSelectionInComposedTree&
newSelection, FrameSelection::SetSelectionOptions options) |
| 99 { | 95 { |
| 100 ASSERT(!(options & FrameSelection::DoNotAdjustInComposedTree)); | 96 ASSERT(!(options & FrameSelection::DoNotAdjustInComposedTree)); |
| 101 m_selectionInComposedTree = newSelection; | 97 m_selectionInComposedTree = newSelection; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 { | 159 { |
| 164 m_xPosForVerticalArrowNavigation = NoXPosForVerticalArrowNavigation(); | 160 m_xPosForVerticalArrowNavigation = NoXPosForVerticalArrowNavigation(); |
| 165 } | 161 } |
| 166 | 162 |
| 167 void SelectionEditor::setIsDirectional(bool isDirectional) | 163 void SelectionEditor::setIsDirectional(bool isDirectional) |
| 168 { | 164 { |
| 169 m_selection.setIsDirectional(isDirectional); | 165 m_selection.setIsDirectional(isDirectional); |
| 170 m_selectionInComposedTree.setIsDirectional(isDirectional); | 166 m_selectionInComposedTree.setIsDirectional(isDirectional); |
| 171 } | 167 } |
| 172 | 168 |
| 173 void SelectionEditor::setWithoutValidation(const Position& start, const Position
& end) | 169 void SelectionEditor::setWithoutValidation(const Position& base, const Position&
extent) |
| 174 { | 170 { |
| 175 m_selection.setWithoutValidation(start, end); | 171 m_selection.setWithoutValidation(base, extent); |
| 176 adjustVisibleSelectionInComposedTree(); | 172 m_selectionInComposedTree.setWithoutValidation(toPositionInComposedTree(base
), toPositionInComposedTree(extent)); |
| 177 } | 173 } |
| 178 | 174 |
| 179 TextDirection SelectionEditor::directionOfEnclosingBlock() | 175 TextDirection SelectionEditor::directionOfEnclosingBlock() |
| 180 { | 176 { |
| 181 return blink::directionOfEnclosingBlock(m_selection.extent()); | 177 return blink::directionOfEnclosingBlock(m_selection.extent()); |
| 182 } | 178 } |
| 183 | 179 |
| 184 TextDirection SelectionEditor::directionOfSelection() | 180 TextDirection SelectionEditor::directionOfSelection() |
| 185 { | 181 { |
| 186 InlineBox* startBox = nullptr; | 182 InlineBox* startBox = nullptr; |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 DEFINE_TRACE(SelectionEditor) | 937 DEFINE_TRACE(SelectionEditor) |
| 942 { | 938 { |
| 943 visitor->trace(m_frameSelection); | 939 visitor->trace(m_frameSelection); |
| 944 visitor->trace(m_selection); | 940 visitor->trace(m_selection); |
| 945 visitor->trace(m_selectionInComposedTree); | 941 visitor->trace(m_selectionInComposedTree); |
| 946 visitor->trace(m_logicalRange); | 942 visitor->trace(m_logicalRange); |
| 947 VisibleSelectionChangeObserver::trace(visitor); | 943 VisibleSelectionChangeObserver::trace(visitor); |
| 948 } | 944 } |
| 949 | 945 |
| 950 } // namespace blink | 946 } // namespace blink |
| OLD | NEW |