Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(564)

Unified Diff: third_party/WebKit/Source/core/editing/InputMethodController.cpp

Issue 2422663002: Define WebTextInputMode as a enum in the public API. (Closed)
Patch Set: Rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/InputMethodController.cpp
diff --git a/third_party/WebKit/Source/core/editing/InputMethodController.cpp b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
index 3681b8a9ffae6dd4813029d118f21824d72bd981..22f16bb5d2fbb913e4ac9ad7d32c472468662efe 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodController.cpp
+++ b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
@@ -26,6 +26,7 @@
#include "core/editing/InputMethodController.h"
+#include "core/InputModeNames.h"
#include "core/InputTypeNames.h"
#include "core/dom/Document.h"
#include "core/dom/Element.h"
@@ -1045,26 +1046,52 @@ int InputMethodController::textInputFlags() const {
return flags;
}
-String InputMethodController::inputModeOfFocusedElement() const {
+WebTextInputMode InputMethodController::inputModeOfFocusedElement() const {
if (!RuntimeEnabledFeatures::inputModeAttributeEnabled())
- return String();
+ return kWebTextInputModeDefault;
Element* element = frame().document()->focusedElement();
if (!element)
- return String();
+ return kWebTextInputModeDefault;
+ AtomicString mode;
if (isHTMLInputElement(*element)) {
const HTMLInputElement& input = toHTMLInputElement(*element);
if (input.supportsInputModeAttribute())
- return input.fastGetAttribute(HTMLNames::inputmodeAttr).lower();
- return String();
+ mode = input.fastGetAttribute(HTMLNames::inputmodeAttr).lower();
}
if (isHTMLTextAreaElement(*element)) {
const HTMLTextAreaElement& textarea = toHTMLTextAreaElement(*element);
- return textarea.fastGetAttribute(HTMLNames::inputmodeAttr).lower();
+ mode = textarea.fastGetAttribute(HTMLNames::inputmodeAttr).lower();
}
- return String();
+ if (mode.isEmpty())
+ return kWebTextInputModeDefault;
+ if (mode == InputModeNames::verbatim)
+ return kWebTextInputModeVerbatim;
+ if (mode == InputModeNames::latin)
+ return kWebTextInputModeLatin;
+ if (mode == InputModeNames::latin_name)
+ return kWebTextInputModeLatinName;
+ if (mode == InputModeNames::latin_prose)
+ return kWebTextInputModeLatinProse;
+ if (mode == InputModeNames::full_width_latin)
+ return kWebTextInputModeFullWidthLatin;
+ if (mode == InputModeNames::kana)
+ return kWebTextInputModeKana;
+ if (mode == InputModeNames::kana_name)
+ return kWebTextInputModeKanaName;
+ if (mode == InputModeNames::katakana)
+ return kWebTextInputModeKataKana;
+ if (mode == InputModeNames::numeric)
+ return kWebTextInputModeNumeric;
+ if (mode == InputModeNames::tel)
+ return kWebTextInputModeTel;
+ if (mode == InputModeNames::email)
+ return kWebTextInputModeEmail;
+ if (mode == InputModeNames::url)
+ return kWebTextInputModeUrl;
+ return kWebTextInputModeDefault;
}
WebTextInputType InputMethodController::textInputType() const {

Powered by Google App Engine
This is Rietveld 408576698