OSDN Git Service

Keep track of whether input fields have autocomplete.
authorLeon Scroggins <scroggo@google.com>
Wed, 5 Jan 2011 20:14:34 +0000 (15:14 -0500)
committerLeon Scroggins <scroggo@google.com>
Wed, 5 Jan 2011 20:42:19 +0000 (15:42 -0500)
Bug:3300365

Requires a change in frameworks/base.

Change-Id: Ia466cae0c43b43817651e9d5903e18aae96a814f

WebKit/android/nav/CacheBuilder.cpp
WebKit/android/nav/CachedInput.cpp
WebKit/android/nav/CachedInput.h
WebKit/android/nav/WebView.cpp

index 4cb9695..61e5f46 100644 (file)
@@ -1243,6 +1243,7 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
             if (input->isTextField()) {
                 type = TEXT_INPUT_CACHEDNODETYPE;
                 cachedInput.init();
+                cachedInput.setAutoComplete(input->autoComplete());
                 cachedInput.setFormPointer(input->form());
                 cachedInput.setIsTextField(true);
                 exported = input->value().threadsafeCopy();
index 716abfd..a6a57ef 100644 (file)
@@ -79,6 +79,7 @@ static void printWebCoreString(const char* label,
 void CachedInput::Debug::print() const
 {
     CachedInput* b = base();
+    DEBUG_PRINT_BOOL(mAutoComplete);
     DUMP_NAV_LOGD("// void* mForm=%p;\n", b->mForm);
     printWebCoreString("// char* mName=\"", b->mName);
     DUMP_NAV_LOGD("// int mMaxLength=%d;\n", b->mMaxLength);
index 8369195..f7f9eea 100644 (file)
@@ -51,6 +51,7 @@ public:
         URL = 7
     };
 
+    bool autoComplete() const { return mAutoComplete; }
     void* formPointer() const { return mForm; }
     void init();
     void setTypeFromElement(WebCore::HTMLInputElement*);
@@ -65,6 +66,7 @@ public:
     int paddingLeft() const { return mPaddingLeft; }
     int paddingRight() const { return mPaddingRight; }
     int paddingTop() const { return mPaddingTop; }
+    void setAutoComplete(bool autoComplete) { mAutoComplete = autoComplete; }
     void setFormPointer(void* form) { mForm = form; }
     void setIsRtlText(bool isRtlText) { mIsRtlText = isRtlText; }
     void setIsTextField(bool isTextField) { mIsTextField = isTextField; }
@@ -91,6 +93,7 @@ private:
     int mPaddingTop;
     float mTextSize;
     Type mType;
+    bool mAutoComplete : 1;
     bool mIsRtlText : 1;
     bool mIsTextField : 1;
     bool mIsTextArea : 1;
index a022fe1..d9f831e 100644 (file)
@@ -1711,6 +1711,12 @@ static jint nativeFocusCandidateMaxLength(JNIEnv *env, jobject obj)
     return input ? input->maxLength() : false;
 }
 
+static jint nativeFocusCandidateIsAutoComplete(JNIEnv *env, jobject obj)
+{
+    const CachedInput* input = getInputCandidate(env, obj);
+    return input ? input->autoComplete() : false;
+}
+
 static jobject nativeFocusCandidateName(JNIEnv *env, jobject obj)
 {
     const CachedInput* input = getInputCandidate(env, obj);
@@ -2328,6 +2334,8 @@ static JNINativeMethod gJavaWebViewMethods[] = {
         (void*) nativeFocusCandidateLineHeight },
     { "nativeFocusCandidateMaxLength", "()I",
         (void*) nativeFocusCandidateMaxLength },
+    { "nativeFocusCandidateIsAutoComplete", "()Z",
+        (void*) nativeFocusCandidateIsAutoComplete },
     { "nativeFocusCandidateName", "()Ljava/lang/String;",
         (void*) nativeFocusCandidateName },
     { "nativeFocusCandidateNodeBounds", "()Landroid/graphics/Rect;",