diff options
| author | George Mount <mount@google.com> | 2012-02-29 07:17:25 -0800 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-02-29 07:17:25 -0800 |
| commit | 0104dd8872053465f6c61881d447239223832be0 (patch) | |
| tree | 71e3b9908f7a0c060029bfea75cfcfa669b6dfde /Source/WebKit/android | |
| parent | 0aa65f94b471566ce9c541f604caae9deb189c02 (diff) | |
| parent | 51a13477370a2da7ad6ed5015762a4928543ecdc (diff) | |
| download | external_webkit-0104dd8872053465f6c61881d447239223832be0.zip external_webkit-0104dd8872053465f6c61881d447239223832be0.tar.gz external_webkit-0104dd8872053465f6c61881d447239223832be0.tar.bz2 | |
Merge "Add support for maxlength text fields to WebViewInputConnection."
Diffstat (limited to 'Source/WebKit/android')
| -rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 15 | ||||
| -rw-r--r-- | Source/WebKit/android/jni/WebViewCore.h | 1 |
2 files changed, 14 insertions, 2 deletions
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index 32befc7..763b4bf 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -489,7 +489,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m #endif m_javaGlue->m_setWebTextViewAutoFillable = GetJMethod(env, clazz, "setWebTextViewAutoFillable", "(ILjava/lang/String;)V"); m_javaGlue->m_selectAt = GetJMethod(env, clazz, "selectAt", "(II)V"); - m_javaGlue->m_initEditField = GetJMethod(env, clazz, "initEditField", "(ILjava/lang/String;IZZLjava/lang/String;III)V"); + m_javaGlue->m_initEditField = GetJMethod(env, clazz, "initEditField", "(ILjava/lang/String;IZZLjava/lang/String;IIII)V"); m_javaGlue->m_updateMatchCount = GetJMethod(env, clazz, "updateMatchCount", "(IILjava/lang/String;)V"); env->DeleteLocalRef(clazz); @@ -3288,6 +3288,16 @@ WebViewCore::InputType WebViewCore::getInputType(Node* node) return WebViewCore::NONE; } +int WebViewCore::getMaxLength(Node* node) +{ + int maxLength = -1; + if (node->hasTagName(WebCore::HTMLNames::inputTag)) { + HTMLInputElement* htmlInput = static_cast<HTMLInputElement*>(node); + maxLength = htmlInput->maxLength(); + } + return maxLength; +} + bool WebViewCore::isSpellCheckEnabled(Node* node) { bool isEnabled = true; @@ -3317,6 +3327,7 @@ void WebViewCore::initEditField(Node* node) Node* nextFocus = document->nextFocusableNode(node, tabEvent.get()); bool isNextText = isTextInput(nextFocus); bool spellCheckEnabled = isSpellCheckEnabled(node); + int maxLength = getMaxLength(node); String label = requestLabel(document->frame(), node); jstring fieldText = wtfStringToJstring(env, text, true); jstring labelText = wtfStringToJstring(env, text, false); @@ -3324,7 +3335,7 @@ void WebViewCore::initEditField(Node* node) env->CallVoidMethod(javaObject.get(), m_javaGlue->m_initEditField, reinterpret_cast<int>(node), fieldText, inputType, spellCheckEnabled, isNextText, labelText, start, end, - reinterpret_cast<int>(selectText)); + reinterpret_cast<int>(selectText), maxLength); checkException(env); } diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h index c5bb63f..7c45096 100644 --- a/Source/WebKit/android/jni/WebViewCore.h +++ b/Source/WebKit/android/jni/WebViewCore.h @@ -717,6 +717,7 @@ namespace android { VisiblePosition visiblePositionForContentPoint(const IntPoint& point); void selectWordAroundPosition(Frame* frame, VisiblePosition pos); SelectText* createSelectText(const VisibleSelection&); + static int getMaxLength(Node* node); // called from constructor, to add this to a global list static void addInstance(WebViewCore*); |
