Commit 1f0eb07b authored by John Palmer's avatar John Palmer Committed by Chromium LUCI CQ

Use ICU to measure string length to get correct underlining.

This means that words with accents get the correct length of underlining.

Before this fix autocorrect "francais " to "français " would have an underline on the space after the word which this fixes.

Bug: b/176562554
Change-Id: Ic05a46ee351bbd9159b6c197cd3f02f3b3d3a7e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2612290
Commit-Queue: John Palmer <jopalmer@chromium.org>
Reviewed-by: default avatarDarren Shen <shend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843849}
parent 06d6c1c6
...@@ -17,6 +17,10 @@ ...@@ -17,6 +17,10 @@
#include "chrome/browser/ui/settings_window_manager_chromeos.h" #include "chrome/browser/ui/settings_window_manager_chromeos.h"
#include "chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom.h" #include "chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom.h"
#include "chromeos/constants/chromeos_features.h" #include "chromeos/constants/chromeos_features.h"
#include "third_party/icu/source/common/unicode/unistr.h"
#include "third_party/icu/source/common/unicode/urename.h"
#include "third_party/icu/source/common/unicode/ustring.h"
#include "third_party/icu/source/common/unicode/utypes.h"
#include "ui/base/ime/chromeos/ime_bridge.h" #include "ui/base/ime/chromeos/ime_bridge.h"
#include "ui/base/ime/chromeos/input_method_manager.h" #include "ui/base/ime/chromeos/input_method_manager.h"
#include "ui/events/keycodes/dom/keycode_converter.h" #include "ui/events/keycodes/dom/keycode_converter.h"
...@@ -167,7 +171,10 @@ void NativeInputMethodEngine::OnAutocorrect(std::string typed_word, ...@@ -167,7 +171,10 @@ void NativeInputMethodEngine::OnAutocorrect(std::string typed_word,
std::string corrected_word, std::string corrected_word,
int start_index) { int start_index) {
autocorrect_manager_->HandleAutocorrect( autocorrect_manager_->HandleAutocorrect(
gfx::Range(start_index, start_index + corrected_word.length()), gfx::Range(
start_index,
start_index +
icu::UnicodeString::fromUTF8(corrected_word).countChar32()),
typed_word); typed_word);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment