Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Unified Diff: Source/core/editing/SelectionController.cpp

Issue 1189243002: Introduce expandSelectionUsingGranularity() in SelectionController (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-06-19T13:30:25 Rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/SelectionController.cpp
diff --git a/Source/core/editing/SelectionController.cpp b/Source/core/editing/SelectionController.cpp
index 2c31da36b6a9d78cd7c935ac67269609d39bb44a..0b79ab76a0deafc57b803eac0e6e615344d3f684 100644
--- a/Source/core/editing/SelectionController.cpp
+++ b/Source/core/editing/SelectionController.cpp
@@ -99,6 +99,11 @@ static VisibleSelection expandSelectionToRespectUserSelectAll(Node* targetNode,
return expandSelectionToRespectUserSelectAllAlgorithm<VisibleSelection::InDOMTree>(targetNode, selection);
}
+static bool expandSelectionUsingGranularity(VisibleSelection& selection, TextGranularity granularity)
+{
+ return selection.expandUsingGranularity(granularity);
+}
+
bool SelectionController::updateSelectionForMouseDownDispatchingSelectStart(Node* targetNode, const VisibleSelection& selection, TextGranularity granularity)
{
if (Position::nodeIsUserSelectNone(targetNode))
@@ -128,7 +133,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())
@@ -232,7 +237,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);
@@ -302,7 +307,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));
@@ -420,7 +425,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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698