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

Unified Diff: Source/web/WebLocalFrameImpl.cpp

Issue 675413003: WebLocalFrameImpl::selectWordAroundPosition should select a word before space. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Adapt to selectWordAroundPosition too Created 6 years, 1 month 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 | « Source/core/editing/FrameSelectionTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebLocalFrameImpl.cpp
diff --git a/Source/web/WebLocalFrameImpl.cpp b/Source/web/WebLocalFrameImpl.cpp
index 0ec32fb473ab8575c5086aab1f3a71f55ff2f6d6..37ee598b97a53cf8911640497d568019a8934e53 100644
--- a/Source/web/WebLocalFrameImpl.cpp
+++ b/Source/web/WebLocalFrameImpl.cpp
@@ -1156,11 +1156,7 @@ WebString WebLocalFrameImpl::selectionAsMarkup() const
void WebLocalFrameImpl::selectWordAroundPosition(LocalFrame* frame, VisiblePosition position)
{
- VisibleSelection selection(position);
- selection.expandUsingGranularity(WordGranularity);
-
- TextGranularity granularity = selection.isRange() ? WordGranularity : CharacterGranularity;
- frame->selection().setSelection(selection, granularity);
+ frame->selection().selectWordAroundPosition(position);
}
bool WebLocalFrameImpl::selectWordAroundCaret()
@@ -1168,8 +1164,7 @@ bool WebLocalFrameImpl::selectWordAroundCaret()
FrameSelection& selection = frame()->selection();
if (selection.isNone() || selection.isRange())
return false;
- selectWordAroundPosition(frame(), selection.selection().visibleStart());
- return true;
+ return frame()->selection().selectWordAroundPosition(selection.selection().visibleStart());
}
void WebLocalFrameImpl::selectRange(const WebPoint& base, const WebPoint& extent)
« no previous file with comments | « Source/core/editing/FrameSelectionTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698