Add value to ImeTextSpan::Type enum for misspelling suggestions
Currently, the Type enums in the ImeTextSpan classes (ui::ImeTextSpan,
blink::ImeTextSpan, and blink::WebImeTextSpan) define two values: kComposition,
for composition markers, and kSuggestion, for Android SuggestionSpans. This
CL adds a third value, kMisspellingSuggestion, for Android SuggestionSpans that
represent misspellings. Misspelling suggestions will behave differently in two
ways from regular suggestions:
- They will not be added to an editable region with spell checking disabled.
- They will be removed if one of their suggested replacements is chosen.
Bug: 672259
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_site_isolation
Change-Id: Ie4b3d2f67ef53b5819380261da5d91ac0209a7ff
Reviewed-on: https://chromium-review.googlesource.com/660689
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Yoshifumi Inoue <[email protected]>
Reviewed-by: Will Harris <[email protected]>
Commit-Queue: Ryan Landay <[email protected]>
Cr-Commit-Position: refs/heads/master@{#501843}
diff --git a/content/renderer/input/widget_input_handler_impl.cc b/content/renderer/input/widget_input_handler_impl.cc
index 916799e2..c32c751 100644
--- a/content/renderer/input/widget_input_handler_impl.cc
+++ b/content/renderer/input/widget_input_handler_impl.cc
@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/logging.h"
+#include "content/common/input/ime_text_span_conversions.h"
#include "content/common/input_messages.h"
#include "content/renderer/gpu/render_widget_compositor.h"
#include "content/renderer/ime_event_guard.h"
@@ -24,25 +25,12 @@
namespace {
-blink::WebImeTextSpan::Type ConvertUiImeTextSpanTypeToBlinkType(
- ui::ImeTextSpan::Type type) {
- switch (type) {
- case ui::ImeTextSpan::Type::kComposition:
- return blink::WebImeTextSpan::Type::kComposition;
- case ui::ImeTextSpan::Type::kSuggestion:
- return blink::WebImeTextSpan::Type::kSuggestion;
- }
-
- NOTREACHED();
- return blink::WebImeTextSpan::Type::kComposition;
-}
-
std::vector<blink::WebImeTextSpan> ConvertUIImeTextSpansToBlinkImeTextSpans(
const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) {
std::vector<blink::WebImeTextSpan> ime_text_spans;
for (const auto& ime_text_span : ui_ime_text_spans) {
blink::WebImeTextSpan blink_ime_text_span(
- ConvertUiImeTextSpanTypeToBlinkType(ime_text_span.type),
+ ConvertUiImeTextSpanTypeToWebType(ime_text_span.type),
ime_text_span.start_offset, ime_text_span.end_offset,
ime_text_span.underline_color, ime_text_span.thick,
ime_text_span.background_color,