| Index: Source/core/editing/FrameSelection.cpp
|
| diff --git a/Source/core/editing/FrameSelection.cpp b/Source/core/editing/FrameSelection.cpp
|
| index d0b791567ef11aceb89e683b02190abda475c313..289c51394d784a00f5015cf980733b94b3185136 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();
|
| }
|
|
|
| +void FrameSelection::selectWordAroundPosition(const VisiblePosition& position)
|
| +{
|
| + // If you have a "foo| ", Selection::expandUsingGranularity selects space
|
| + // after the caret. To select "foo", move |position| to previous.
|
| + if (isSeparator(position.characterAfter()) && !isSeparator(position.characterBefore())) {
|
| + selectWordAroundPosition(position.previous());
|
| + return;
|
| + }
|
| +
|
| + VisibleSelection selection(position);
|
| + selection.expandUsingGranularity(WordGranularity);
|
| + String text = plainText(selection.start(), selection.end());
|
| + if (text.isEmpty() || isSeparator(text.characterStartingAt(0)))
|
| + return;
|
| +
|
| + setSelection(selection, WordGranularity);
|
| +}
|
| +
|
| }
|
|
|
| #ifndef NDEBUG
|
|
|