Provide <input> type information to Java side.

Help to fix http://b/issue?id=1890360 and http://b/issue?id=2150538

CacheBuilder.cpp:
Explicitly set isTextField to false for textareas.

CachedRoot:
Remove the code which checks to see if the textfield is a search,
since if it is, we can avoid this path altogether.

WebView:
Return a single integer which tells what type the current text
input field is.

Requires a change to frameworks/base.
diff --git a/WebKit/android/nav/CacheBuilder.cpp b/WebKit/android/nav/CacheBuilder.cpp
index 620e059..219e4c6 100644
--- a/WebKit/android/nav/CacheBuilder.cpp
+++ b/WebKit/android/nav/CacheBuilder.cpp
@@ -1121,6 +1121,7 @@
             // Although technically it is not an HTMLInputElement, and therefore
             // has no InputType, this one is the most appropriate.
             cachedInput.setInputType(HTMLInputElement::TEXT);
+            cachedInput.setIsTextField(false);
             exported = area->value().threadsafeCopy();
         } else if (node->hasTagName(HTMLNames::aTag)) {
             const HTMLAnchorElement* anchorNode = 
diff --git a/WebKit/android/nav/CachedRoot.cpp b/WebKit/android/nav/CachedRoot.cpp
index 77fb5b8..0011f06 100644
--- a/WebKit/android/nav/CachedRoot.cpp
+++ b/WebKit/android/nav/CachedRoot.cpp
@@ -28,7 +28,6 @@
 #include "CachedHistory.h"
 #include "CachedInput.h"
 #include "CachedNode.h"
-#include "HTMLInputElement.h"
 #include "SkBitmap.h"
 #include "SkBounder.h"
 #include "SkCanvas.h"
@@ -766,10 +765,6 @@
         // the cursor
         return FAILURE;
     }
-    const CachedInput* textInput = cursorFrame->textInput(cursor);
-    if (!textInput) return FAILURE;
-    if (textInput->inputType() == WebCore::HTMLInputElement::SEARCH)
-        return SEARCH;
     const CachedNode* firstTextfield = nextTextField(0, 0, false);
     if (!firstTextfield) {
         // Error case.  There are no textfields in this tree.
diff --git a/WebKit/android/nav/CachedRoot.h b/WebKit/android/nav/CachedRoot.h
index f93927c..435937a 100644
--- a/WebKit/android/nav/CachedRoot.h
+++ b/WebKit/android/nav/CachedRoot.h
@@ -44,8 +44,7 @@
         FAILURE = -1,
         NEXT    = 0,
         GO      = 1,
-        DONE    = 2,
-        SEARCH  = 3
+        DONE    = 2
     };
     bool adjustForScroll(BestData* , Direction , WebCore::IntPoint* scrollPtr,
         bool findClosest);
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index af9227d..938d93c 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -1623,12 +1623,6 @@
     return input ? input->isRtlText() : false;
 }
 
-static bool nativeFocusCandidateIsTextField(JNIEnv *env, jobject obj)
-{
-    const CachedInput* input = getInputCandidate(env, obj);
-    return input ? input->isTextField() : false;
-}
-
 static bool nativeFocusCandidateIsTextInput(JNIEnv *env, jobject obj)
 {
     const CachedNode* node = getFocusCandidate(env, obj);
@@ -1684,6 +1678,41 @@
     return input ? input->textSize() : 0;
 }
 
+enum type {
+    NONE = -1,
+    NORMAL_TEXT_FIELD = 0,
+    TEXT_AREA = 1,
+    PASSWORD = 2,
+    SEARCH = 3,
+    EMAIL = 4,
+    NUMBER = 5,
+    TELEPHONE = 6,
+    URL = 7
+};
+
+static int nativeFocusCandidateType(JNIEnv *env, jobject obj)
+{
+    const CachedInput* input = getInputCandidate(env, obj);
+    if (!input) return NONE;
+    if (!input->isTextField()) return TEXT_AREA;
+    switch (input->inputType()) {
+    case HTMLInputElement::PASSWORD:
+        return PASSWORD;
+    case HTMLInputElement::SEARCH:
+        return SEARCH;
+    case HTMLInputElement::EMAIL:
+        return EMAIL;
+    case HTMLInputElement::NUMBER:
+        return NUMBER;
+    case HTMLInputElement::TELEPHONE:
+        return TELEPHONE;
+    case HTMLInputElement::URL:
+        return URL;
+    default:
+        return NORMAL_TEXT_FIELD;
+    }
+}
+
 static bool nativeFocusCandidateIsPlugin(JNIEnv *env, jobject obj)
 {
     const CachedNode* node = getFocusCandidate(env, obj);
@@ -2058,8 +2087,6 @@
         (void*) nativeFocusCandidateIsPlugin },
     { "nativeFocusCandidateIsRtlText", "()Z",
         (void*) nativeFocusCandidateIsRtlText },
-    { "nativeFocusCandidateIsTextField", "()Z",
-        (void*) nativeFocusCandidateIsTextField },
     { "nativeFocusCandidateIsTextInput", "()Z",
         (void*) nativeFocusCandidateIsTextInput },
     { "nativeFocusCandidateMaxLength", "()I",
@@ -2074,6 +2101,8 @@
         (void*) nativeFocusCandidateText },
     { "nativeFocusCandidateTextSize", "()I",
         (void*) nativeFocusCandidateTextSize },
+    { "nativeFocusCandidateType", "()I",
+        (void*) nativeFocusCandidateType },
     { "nativeFocusIsPlugin", "()Z",
         (void*) nativeFocusIsPlugin },
     { "nativeFocusNodePointer", "()I",