Chromium Code Reviews| Index: Source/core/editing/FrameSelection.cpp |
| diff --git a/Source/core/editing/FrameSelection.cpp b/Source/core/editing/FrameSelection.cpp |
| index 969308a48948c4f1c0b89325b2afe979700cab12..5acc9f8689c2d8c7b685503c576446c61d220175 100644 |
| --- a/Source/core/editing/FrameSelection.cpp |
| +++ b/Source/core/editing/FrameSelection.cpp |
| @@ -72,6 +72,7 @@ |
| #include "platform/SecureTextInput.h" |
| #include "platform/geometry/FloatQuad.h" |
| #include "platform/graphics/GraphicsContext.h" |
| +#include "platform/text/UnicodeUtilities.h" |
| #include "wtf/text/CString.h" |
| #include <stdio.h> |
| @@ -1930,6 +1931,24 @@ void FrameSelection::scheduleVisualUpdate() const |
| page->animator().scheduleVisualUpdate(); |
| } |
| +bool FrameSelection::selectWordAroundPosition(const VisiblePosition& position) |
| +{ |
| + EWordSide wordSideList[2] = { RightWordIfOnBoundary, LeftWordIfOnBoundary }; |
| + for (auto& wordSide : wordSideList) { |
|
yosin_UTC9
2014/11/14 04:19:51
Q: Do we need |&|?
yoichio
2014/11/14 04:50:21
Used EWordSide instead.
http://chromium-cpp.appspo
|
| + VisiblePosition start = startOfWord(position, wordSide); |
| + VisiblePosition end = endOfWord(position, wordSide); |
| + |
|
yosin_UTC9
2014/11/14 04:19:51
nit: We don't need to have a blank line.
yoichio
2014/11/14 04:50:22
Done.
|
| + String text = plainText(start.deepEquivalent(), end.deepEquivalent()); |
| + |
|
yosin_UTC9
2014/11/14 04:19:51
nit: We don't need to have a blank line.
yoichio
2014/11/14 04:50:21
Done.
|
| + if (!text.isEmpty() && !isSeparator(text.characterStartingAt(0))) { |
| + setSelection(VisibleSelection(start, end), WordGranularity); |
| + return true; |
| + } |
| + } |
| + |
| + return false; |
| +} |
| + |
| } |
| #ifndef NDEBUG |