| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights |
| 4 * reserved. | 4 * reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 PositionMoveType::CodeUnit) | 75 PositionMoveType::CodeUnit) |
| 76 : end; | 76 : end; |
| 77 selection.setWithoutValidation(start, endPosition); | 77 selection.setWithoutValidation(start, endPosition); |
| 78 return selection; | 78 return selection; |
| 79 } | 79 } |
| 80 | 80 |
| 81 const VisiblePositionInFlatTree& visibleStart = createVisiblePosition( | 81 const VisiblePositionInFlatTree& visibleStart = createVisiblePosition( |
| 82 start, selectionType == SelectionType::RangeSelection | 82 start, selectionType == SelectionType::RangeSelection |
| 83 ? TextAffinity::Downstream | 83 ? TextAffinity::Downstream |
| 84 : affinity); | 84 : affinity); |
| 85 if (visibleStart.isNull()) |
| 86 return VisibleSelectionInFlatTree(); |
| 85 if (paintBlockCursor) { | 87 if (paintBlockCursor) { |
| 86 VisiblePositionInFlatTree visibleExtent = | 88 const VisiblePositionInFlatTree visibleExtent = nextPositionOf( |
| 87 createVisiblePosition(end, affinity); | 89 createVisiblePosition(end, affinity), CanSkipOverEditingBoundary); |
| 88 visibleExtent = nextPositionOf(visibleExtent, CanSkipOverEditingBoundary); | 90 if (visibleExtent.isNull()) |
| 89 return createVisibleSelection(visibleStart, visibleExtent); | 91 return VisibleSelectionInFlatTree(); |
| 92 SelectionInFlatTree::Builder builder; |
| 93 builder.collapse(visibleStart.toPositionWithAffinity()); |
| 94 builder.extend(visibleExtent.deepEquivalent()); |
| 95 return createVisibleSelection(builder.build()); |
| 90 } | 96 } |
| 91 const VisiblePositionInFlatTree visibleEnd = | 97 const VisiblePositionInFlatTree visibleEnd = |
| 92 createVisiblePosition(end, selectionType == SelectionType::RangeSelection | 98 createVisiblePosition(end, selectionType == SelectionType::RangeSelection |
| 93 ? TextAffinity::Upstream | 99 ? TextAffinity::Upstream |
| 94 : affinity); | 100 : affinity); |
| 95 return createVisibleSelection(visibleStart, visibleEnd); | 101 if (visibleEnd.isNull()) |
| 102 return VisibleSelectionInFlatTree(); |
| 103 SelectionInFlatTree::Builder builder; |
| 104 builder.collapse(visibleStart.toPositionWithAffinity()); |
| 105 builder.extend(visibleEnd.deepEquivalent()); |
| 106 return createVisibleSelection(builder.build()); |
| 96 } | 107 } |
| 97 | 108 |
| 98 void PendingSelection::commit(LayoutView& layoutView) { | 109 void PendingSelection::commit(LayoutView& layoutView) { |
| 99 if (!hasPendingSelection()) | 110 if (!hasPendingSelection()) |
| 100 return; | 111 return; |
| 101 DCHECK(!layoutView.needsLayout()); | 112 DCHECK(!layoutView.needsLayout()); |
| 102 m_hasPendingSelection = false; | 113 m_hasPendingSelection = false; |
| 103 | 114 |
| 104 const VisibleSelectionInFlatTree& originalSelection = | 115 const VisibleSelectionInFlatTree& originalSelection = |
| 105 m_frameSelection->visibleSelection<EditingInFlatTreeStrategy>(); | 116 m_frameSelection->visibleSelection<EditingInFlatTreeStrategy>(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 DCHECK(layoutView == endLayoutObject->view()); | 161 DCHECK(layoutView == endLayoutObject->view()); |
| 151 layoutView.setSelection(startLayoutObject, startPos.computeEditingOffset(), | 162 layoutView.setSelection(startLayoutObject, startPos.computeEditingOffset(), |
| 152 endLayoutObject, endPos.computeEditingOffset()); | 163 endLayoutObject, endPos.computeEditingOffset()); |
| 153 } | 164 } |
| 154 | 165 |
| 155 DEFINE_TRACE(PendingSelection) { | 166 DEFINE_TRACE(PendingSelection) { |
| 156 visitor->trace(m_frameSelection); | 167 visitor->trace(m_frameSelection); |
| 157 } | 168 } |
| 158 | 169 |
| 159 } // namespace blink | 170 } // namespace blink |
| OLD | NEW |