diff options
-rw-r--r-- | WebKit/android/nav/CacheBuilder.cpp | 10 | ||||
-rw-r--r-- | WebKit/android/nav/CachedInput.h | 9 | ||||
-rw-r--r-- | WebKit/android/nav/WebView.cpp | 35 |
3 files changed, 33 insertions, 21 deletions
diff --git a/WebKit/android/nav/CacheBuilder.cpp b/WebKit/android/nav/CacheBuilder.cpp index 1d53721..0905ca7 100644 --- a/WebKit/android/nav/CacheBuilder.cpp +++ b/WebKit/android/nav/CacheBuilder.cpp @@ -1260,30 +1260,28 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame, } if (node->hasTagName(WebCore::HTMLNames::inputTag)) { HTMLInputElement* input = static_cast<HTMLInputElement*>(node); - HTMLInputElement::DeprecatedInputType inputType = input->deprecatedInputType(); if (input->isTextField()) { type = TEXT_INPUT_CACHEDNODETYPE; cachedInput.init(); cachedInput.setFormPointer(input->form()); cachedInput.setIsTextField(true); + cachedInput.setIsTextArea(false); exported = input->value().threadsafeCopy(); cachedInput.setMaxLength(input->maxLength()); - cachedInput.setInputType(inputType); + cachedInput.setInputElement(input); // If this does not need to be threadsafe, we can use crossThreadString(). // See http://trac.webkit.org/changeset/49160. cachedInput.setName(input->name().string().threadsafeCopy()); // can't detect if this is drawn on top (example: deviant.com login parts) isUnclipped = isTransparent; - } else if (inputType == HTMLInputElement::HIDDEN) + } else if (input->isInputTypeHidden()) continue; } else if (node->hasTagName(HTMLNames::textareaTag)) { cachedInput.init(); type = TEXT_INPUT_CACHEDNODETYPE; HTMLTextAreaElement* area = static_cast<HTMLTextAreaElement*>(node); cachedInput.setFormPointer(area->form()); - // Although technically it is not an HTMLInputElement, and therefore - // has no InputType, this one is the most appropriate. - cachedInput.setInputType(HTMLInputElement::TEXT); + cachedInput.setIsTextArea(true); cachedInput.setIsTextField(false); exported = area->value().threadsafeCopy(); } else if (node->hasTagName(HTMLNames::aTag)) { diff --git a/WebKit/android/nav/CachedInput.h b/WebKit/android/nav/CachedInput.h index 0809208..333c346 100644 --- a/WebKit/android/nav/CachedInput.h +++ b/WebKit/android/nav/CachedInput.h @@ -40,9 +40,10 @@ public: } void* formPointer() const { return mForm; } void init(); - WebCore::HTMLInputElement::DeprecatedInputType inputType() const { return mInputType; } + WebCore::HTMLInputElement* inputElement() const { return mElement; } bool isRtlText() const { return mIsRtlText; } bool isTextField() const { return mIsTextField; } + bool isTextArea() const { return mIsTextArea; } int maxLength() const { return mMaxLength; }; const WTF::String& name() const { return mName; } int paddingBottom() const { return mPaddingBottom; } @@ -50,9 +51,10 @@ public: int paddingRight() const { return mPaddingRight; } int paddingTop() const { return mPaddingTop; } void setFormPointer(void* form) { mForm = form; } - void setInputType(WebCore::HTMLInputElement::DeprecatedInputType type) { mInputType = type; } + void setInputElement(WebCore::HTMLInputElement* element) { mElement = element; } void setIsRtlText(bool isRtlText) { mIsRtlText = isRtlText; } void setIsTextField(bool isTextField) { mIsTextField = isTextField; } + void setIsTextArea(bool isTextArea) { mIsTextArea = isTextArea; } void setMaxLength(int maxLength) { mMaxLength = maxLength; } void setName(const WTF::String& name) { mName = name; } void setPaddingBottom(int bottom) { mPaddingBottom = bottom; } @@ -70,9 +72,10 @@ private: int mPaddingRight; int mPaddingTop; int mTextSize; - WebCore::HTMLInputElement::DeprecatedInputType mInputType; + WebCore::HTMLInputElement* mElement; bool mIsRtlText : 1; bool mIsTextField : 1; + bool mIsTextArea : 1; #if DUMP_NAV_CACHE public: class Debug { diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp index 284f1c9..7a3e08f 100644 --- a/WebKit/android/nav/WebView.cpp +++ b/WebKit/android/nav/WebView.cpp @@ -1642,7 +1642,10 @@ static jint nativeFocusCandidateFramePointer(JNIEnv *env, jobject obj) static bool nativeFocusCandidateIsPassword(JNIEnv *env, jobject obj) { const CachedInput* input = getInputCandidate(env, obj); - return input && input->inputType() == WebCore::HTMLInputElement::PASSWORD; + HTMLInputElement* element = 0; + if (input) + element = input->inputElement(); + return element && element->isPasswordField(); } static bool nativeFocusCandidateIsRtlText(JNIEnv *env, jobject obj) @@ -1737,24 +1740,32 @@ enum type { 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: + if (!input) + return NONE; + + if (input->isTextArea()) + return TEXT_AREA; + + HTMLInputElement* element = input->inputElement(); + // If the CachedInput is used to represent a TextArea, + // we have no HTMLInputElement and should have already + // returned above. We must have an HTMLInputElement now. + ASSERT(element); + + if (element->isPasswordField()) return PASSWORD; - case HTMLInputElement::SEARCH: + else if (element->isSearchField()) return SEARCH; - case HTMLInputElement::EMAIL: + else if (element->isEmailField()) return EMAIL; - case HTMLInputElement::NUMBER: + else if (element->isNumberField()) return NUMBER; - case HTMLInputElement::TELEPHONE: + else if (element->isTelephoneField()) return TELEPHONE; - case HTMLInputElement::URL: + else if (element->isURLField()) return URL; - default: + else return NORMAL_TEXT_FIELD; - } } static bool nativeFocusIsPlugin(JNIEnv *env, jobject obj) |