Chromium Code Reviews| Index: Source/core/editing/SelectionController.cpp |
| diff --git a/Source/core/editing/SelectionController.cpp b/Source/core/editing/SelectionController.cpp |
| index 47c1c02bb5cf89ff4f6a032272c056b3d64063cb..1b69de73aac0b0504973ae966c47381491fa1740 100644 |
| --- a/Source/core/editing/SelectionController.cpp |
| +++ b/Source/core/editing/SelectionController.cpp |
| @@ -91,6 +91,11 @@ static VisibleSelection expandSelectionToRespectUserSelectAll(Node* targetNode, |
| return newSelection; |
| } |
| +bool expandSelectionUsingGranularity(VisibleSelection& selection, TextGranularity granularity) |
|
tkent
2015/06/19 02:17:09
should this be |static|?
yosin_UTC9
2015/06/19 03:41:44
Done.
|
| +{ |
| + return selection.expandUsingGranularity(granularity); |
| +} |
| + |
| bool SelectionController::updateSelectionForMouseDownDispatchingSelectStart(Node* targetNode, const VisibleSelection& selection, TextGranularity granularity) |
| { |
| if (Position::nodeIsUserSelectNone(targetNode)) |
| @@ -120,7 +125,7 @@ void SelectionController::selectClosestWordFromHitTestResult(const HitTestResult |
| VisiblePosition pos(innerNode->layoutObject()->positionForPoint(result.localPoint())); |
| if (pos.isNotNull()) { |
| newSelection = VisibleSelection(pos); |
| - newSelection.expandUsingGranularity(WordGranularity); |
| + expandSelectionUsingGranularity(newSelection, WordGranularity); |
| } |
| if (appendTrailingWhitespace == ShouldAppendTrailingWhitespace && newSelection.isRange()) |
| @@ -224,7 +229,7 @@ bool SelectionController::handleMousePressEventTripleClick(const MouseEventWithH |
| VisiblePosition pos(innerNode->layoutObject()->positionForPoint(event.localPoint())); |
| if (pos.isNotNull()) { |
| newSelection = VisibleSelection(pos); |
| - newSelection.expandUsingGranularity(ParagraphGranularity); |
| + expandSelectionUsingGranularity(newSelection, ParagraphGranularity); |
| } |
| return updateSelectionForMouseDownDispatchingSelectStart(innerNode, expandSelectionToRespectUserSelectAll(innerNode, newSelection), ParagraphGranularity); |
| @@ -294,7 +299,7 @@ bool SelectionController::handleMousePressEventSingleClick(const MouseEventWithH |
| if (m_frame->selection().granularity() != CharacterGranularity) { |
| granularity = m_frame->selection().granularity(); |
| - newSelection.expandUsingGranularity(m_frame->selection().granularity()); |
| + expandSelectionUsingGranularity(newSelection, m_frame->selection().granularity()); |
| } |
| } else { |
| newSelection = expandSelectionToRespectUserSelectAll(innerNode, VisibleSelection(visiblePos)); |
| @@ -412,7 +417,7 @@ void SelectionController::updateSelectionForMouseDrag(const HitTestResult& hitTe |
| } |
| if (m_frame->selection().granularity() != CharacterGranularity) |
| - newSelection.expandUsingGranularity(m_frame->selection().granularity()); |
| + expandSelectionUsingGranularity(newSelection, m_frame->selection().granularity()); |
| m_frame->selection().setNonDirectionalSelectionIfNeeded(newSelection, m_frame->selection().granularity(), |
| FrameSelection::AdjustEndpointsAtBidiBoundary); |