summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/editing/visible_units_word.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/core/editing/visible_units_word.cc')
-rw-r--r--chromium/third_party/blink/renderer/core/editing/visible_units_word.cc27
1 files changed, 12 insertions, 15 deletions
diff --git a/chromium/third_party/blink/renderer/core/editing/visible_units_word.cc b/chromium/third_party/blink/renderer/core/editing/visible_units_word.cc
index 8358c13e096..bd082c7cc02 100644
--- a/chromium/third_party/blink/renderer/core/editing/visible_units_word.cc
+++ b/chromium/third_party/blink/renderer/core/editing/visible_units_word.cc
@@ -134,11 +134,21 @@ PositionInFlatTree NextWordPositionInternal(
return SkipWhitespaceIfNeeded(text, runner);
continue;
}
- // We stop searching when the character preceding the break is
- // alphanumeric or punctuations or underscore or linebreaks.
+ // We stop searching in the following conditions:
+ // 1. When the character preceding the break is
+ // alphanumeric or punctuations or underscore or linebreaks.
+ // Only on Windows:
+ // 2. When the character preceding the break is a whitespace and
+ // the character following it is an alphanumeric or punctuations
+ // or underscore or linebreaks.
if (static_cast<unsigned>(runner) < text.length() &&
IsWordBreak(text[runner - 1]))
return SkipWhitespaceIfNeeded(text, runner);
+ else if (platform_word_behavior_ ==
+ PlatformWordBehavior::kWordSkipSpaces &&
+ static_cast<unsigned>(runner) < text.length() &&
+ IsWhitespace(text[runner - 1]) && IsWordBreak(text[runner]))
+ return SkipWhitespaceIfNeeded(text, runner);
}
if (text[text.length() - 1] != kNewlineCharacter)
return Position::After(text.length() - 1);
@@ -276,19 +286,6 @@ Position EndOfWordPosition(const Position& position, WordSide side) {
EndOfWordPosition(ToPositionInFlatTree(position), side));
}
-VisiblePosition EndOfWord(const VisiblePosition& position, WordSide side) {
- return CreateVisiblePosition(
- EndOfWordPosition(position.DeepEquivalent(), side),
- TextAffinity::kUpstreamIfPossible);
-}
-
-VisiblePositionInFlatTree EndOfWord(const VisiblePositionInFlatTree& position,
- WordSide side) {
- return CreateVisiblePosition(
- EndOfWordPosition(position.DeepEquivalent(), side),
- TextAffinity::kUpstreamIfPossible);
-}
-
// ----
// TODO(editing-dev): Because of word boundary can not be an upstream position,
// we should make this function to return |PositionInFlatTree|.