OSDN Git Service

Show "Go" for the last textfield in a form.
authorLeon Scroggins <scroggo@google.com>
Mon, 7 Dec 2009 21:54:56 +0000 (16:54 -0500)
committerLeon Scroggins <scroggo@google.com>
Tue, 8 Dec 2009 15:50:02 +0000 (10:50 -0500)
Fixes http://b/issue?id=2210152

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

index 522d381..f854e71 100644 (file)
@@ -1101,6 +1101,7 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
             if (input->isTextField()) {
                 type = TEXT_INPUT_CACHEDNODETYPE;
                 cachedInput.init();
+                cachedInput.setFormPointer(input->form());
                 cachedInput.setIsTextField(true);
                 cachedInput.setIsReadOnly(input->readOnly());
                 exported = input->value().threadsafeCopy();
@@ -1117,6 +1118,7 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
             cachedInput.init();
             type = TEXT_INPUT_CACHEDNODETYPE;
             HTMLTextAreaElement* area = static_cast<HTMLTextAreaElement*>(node);
+            cachedInput.setFormPointer(area->form());
             cachedInput.setIsReadOnly(area->readOnly());
             // Although technically it is not an HTMLInputElement, and therefore
             // has no InputType, this one is the most appropriate.
index 858402f..52d2066 100644 (file)
@@ -50,6 +50,7 @@ void CachedInput::Debug::print() const
         scratch[index++] = c;
     }
     DUMP_NAV_LOGD("%.*s\"\n", index, scratch);
+    DUMP_NAV_LOGD("// void* mForm=%p;", b->mForm);
     DUMP_NAV_LOGD("// int mMaxLength=%d;\n", b->mMaxLength);
     DUMP_NAV_LOGD("// int mTextSize=%d;\n", b->mTextSize);
     DUMP_NAV_LOGD("// int mInputType=%d;\n", b->mInputType);
index f4f0e95..f3cf1fe 100644 (file)
@@ -38,6 +38,7 @@ public:
         // Initiaized to 0 in its array, so nothing to do in the
         // constructor
     }
+    void* formPointer() const { return mForm; }
     void init() {
         bzero(this, sizeof(CachedInput));
         mName = WebCore::String();
@@ -48,6 +49,7 @@ public:
     bool isTextField() const { return mIsTextField; }
     int maxLength() const { return mMaxLength; };
     const WebCore::String& name() const { return mName; }
+    void setFormPointer(void* form) { mForm = form; }
     void setInputType(WebCore::HTMLInputElement::InputType type) { mInputType = type; }
     void setIsReadOnly(bool isReadOnly) { mIsReadOnly = isReadOnly; }
     void setIsRtlText(bool isRtlText) { mIsRtlText = isRtlText; }
@@ -57,6 +59,7 @@ public:
     void setTextSize(int textSize) { mTextSize = textSize; }
     int textSize() const { return mTextSize; }
 private:
+    void* mForm;
     WebCore::String mName;
     int mMaxLength;
     int mTextSize;
index 0011f06..2354ebc 100644 (file)
@@ -771,9 +771,13 @@ CachedRoot::ImeAction CachedRoot::cursorTextFieldAction() const
         return FAILURE;
     }
     // Now find the next textfield/area starting with the cursor
-    if (cursorFrame->nextTextField(cursor, 0, true)) {
-        // There is a textfield/area after the cursor, so the textfield under
-        // the cursor should have the NEXT action
+    const CachedFrame* potentialFrame;
+    const CachedNode* potentialNext
+            = cursorFrame->nextTextField(cursor, &potentialFrame, true);
+    if (potentialNext && cursorFrame->textInput(cursor)->formPointer()
+            == potentialFrame->textInput(potentialNext)->formPointer()) {
+        // There is a textfield/area after the cursor in the same form,
+        // so the textfield under the cursor should have the NEXT action
         return NEXT;
     }
     // If this line is reached, we know that the textfield under the cursor is