| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/editing/GranularityStrategy.h" | 6 #include "core/editing/GranularityStrategy.h" |
| 7 | 7 |
| 8 #include "core/editing/EditingUtilities.h" | 8 #include "core/editing/EditingUtilities.h" |
| 9 #include "core/editing/FrameSelection.h" | 9 #include "core/editing/FrameSelection.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 enum class BoundAdjust {CurrentPosIfOnBound, NextBoundIfOnBound}; | 13 enum class BoundAdjust {CurrentPosIfOnBound, NextBoundIfOnBound}; |
| 14 enum class SearchDirection {SearchBackwards, SearchForward}; | 14 enum class SearchDirection {SearchBackwards, SearchForward}; |
| 15 | 15 |
| 16 // We use the bottom-left corner of the caret rect to represent the | 16 // We use the bottom-left corner of the caret rect to represent the |
| 17 // location of a VisiblePosition. This way locations corresponding to | 17 // location of a VisiblePosition. This way locations corresponding to |
| 18 // VisiblePositions on the same line will all have the same y coordinate | 18 // VisiblePositions on the same line will all have the same y coordinate |
| 19 // unless the text is transformed. | 19 // unless the text is transformed. |
| 20 static IntPoint positionLocation(const VisiblePosition& vp) | 20 static IntPoint positionLocation(const VisiblePosition& vp) |
| 21 { | 21 { |
| 22 return vp.absoluteCaretBounds().minXMaxYCorner(); | 22 return absoluteCaretBoundsOf(vp).minXMaxYCorner(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 // Order is specified using the same contract as comparePositions. | 25 // Order is specified using the same contract as comparePositions. |
| 26 static bool arePositionsInSpecifiedOrder( | 26 static bool arePositionsInSpecifiedOrder( |
| 27 const VisiblePosition& vp1, | 27 const VisiblePosition& vp1, |
| 28 const VisiblePosition& vp2, | 28 const VisiblePosition& vp2, |
| 29 int specifiedOrder) | 29 int specifiedOrder) |
| 30 { | 30 { |
| 31 int positionOrder = comparePositions(vp1, vp2); | 31 int positionOrder = comparePositions(vp1, vp2); |
| 32 if (specifiedOrder == 0) | 32 if (specifiedOrder == 0) |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 if (newSelectionExtent.deepEquivalent() != selection.visibleExtent().deepEqu
ivalent()) | 230 if (newSelectionExtent.deepEquivalent() != selection.visibleExtent().deepEqu
ivalent()) |
| 231 m_state = thisMoveShrunkSelection ? StrategyState::Shrinking : StrategyS
tate::Expanding; | 231 m_state = thisMoveShrunkSelection ? StrategyState::Shrinking : StrategyS
tate::Expanding; |
| 232 | 232 |
| 233 m_diffExtentPointFromExtentPosition = extentPoint + IntSize(m_offset, 0) - p
ositionLocation(newSelectionExtent); | 233 m_diffExtentPointFromExtentPosition = extentPoint + IntSize(m_offset, 0) - p
ositionLocation(newSelectionExtent); |
| 234 VisibleSelection newSelection = selection; | 234 VisibleSelection newSelection = selection; |
| 235 newSelection.setExtent(newSelectionExtent); | 235 newSelection.setExtent(newSelectionExtent); |
| 236 return newSelection; | 236 return newSelection; |
| 237 } | 237 } |
| 238 | 238 |
| 239 } // namespace blink | 239 } // namespace blink |
| OLD | NEW |