diff options
Diffstat (limited to 'WebKit/android')
| -rw-r--r-- | WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp | 10 | ||||
| -rw-r--r-- | WebKit/android/nav/CacheBuilder.cpp | 11 | ||||
| -rw-r--r-- | WebKit/android/nav/CachedInput.h | 7 | ||||
| -rw-r--r-- | WebKit/android/nav/CachedRoot.cpp | 1 | ||||
| -rw-r--r-- | WebKit/android/nav/WebView.cpp | 56 |
5 files changed, 64 insertions, 21 deletions
diff --git a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp index ea1f327..265dfb4 100644 --- a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp +++ b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp @@ -825,6 +825,7 @@ void FrameLoaderClientAndroid::transitionToCommittedFromCachedFrame(WebCore::Cac #ifdef ANDROID_META_SUPPORT platformData->restoreMetadata(m_frame->settings()); #endif + m_webFrame->transitionToCommitted(m_frame); } void FrameLoaderClientAndroid::transitionToCommittedForNewPage() { @@ -842,12 +843,17 @@ void FrameLoaderClientAndroid::transitionToCommittedForNewPage() { WebViewCore* webViewCore = WebViewCore::getWebViewCore(m_frame->view()); Retain(webViewCore); + // Save the old WebFrameView's bounds and apply them to the new WebFrameView WebFrameView* oldFrameView = static_cast<WebFrameView*> (m_frame->view()->platformWidget()); + IntRect bounds = oldFrameView->getBounds(); + IntRect windowBounds = oldFrameView->getWindowBounds(); // we only support opaque, white background for now - m_frame->createView(oldFrameView->getBounds().size(), Color::white, false, IntSize(), false); - + m_frame->createView(bounds.size(), Color::white, false, IntSize(), false); // Create a new WebFrameView for the new FrameView WebFrameView* newFrameView = new WebFrameView(m_frame->view(), webViewCore); + newFrameView->setLocation(bounds.x(), bounds.y()); + newFrameView->setSize(bounds.width(), bounds.height()); + newFrameView->setWindowBounds(windowBounds.x(), windowBounds.y(), windowBounds.width(), windowBounds.height()); // newFrameView attaches itself to FrameView which Retains the reference, so // call Release for newFrameView Release(newFrameView); diff --git a/WebKit/android/nav/CacheBuilder.cpp b/WebKit/android/nav/CacheBuilder.cpp index c9adb53..219e4c6 100644 --- a/WebKit/android/nav/CacheBuilder.cpp +++ b/WebKit/android/nav/CacheBuilder.cpp @@ -1097,26 +1097,31 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame, } if (node->hasTagName(WebCore::HTMLNames::inputTag)) { HTMLInputElement* input = (HTMLInputElement*) node; + HTMLInputElement::InputType inputType = input->inputType(); if (input->isTextField()) { type = TEXT_INPUT_CACHEDNODETYPE; cachedInput.init(); cachedInput.setIsTextField(true); cachedInput.setIsReadOnly(input->readOnly()); exported = input->value().threadsafeCopy(); - cachedInput.setIsPassword(input->inputType() == - HTMLInputElement::PASSWORD); cachedInput.setMaxLength(input->maxLength()); + cachedInput.setInputType(inputType); // 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) + continue; } else if (node->hasTagName(HTMLNames::textareaTag)) { cachedInput.init(); type = TEXT_INPUT_CACHEDNODETYPE; HTMLTextAreaElement* area = static_cast<HTMLTextAreaElement*>(node); cachedInput.setIsReadOnly(area->readOnly()); + // 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/CachedInput.h b/WebKit/android/nav/CachedInput.h index 3b00b52..f4f0e95 100644 --- a/WebKit/android/nav/CachedInput.h +++ b/WebKit/android/nav/CachedInput.h @@ -27,6 +27,7 @@ #define CachedInput_H #include "CachedDebug.h" +#include "HTMLInputElement.h" #include "PlatformString.h" namespace android { @@ -41,13 +42,13 @@ public: bzero(this, sizeof(CachedInput)); mName = WebCore::String(); } - bool isPassword() const { return mIsPassword; } + WebCore::HTMLInputElement::InputType inputType() const { return mInputType; } bool isReadOnly() const { return mIsReadOnly; } bool isRtlText() const { return mIsRtlText; } bool isTextField() const { return mIsTextField; } int maxLength() const { return mMaxLength; }; const WebCore::String& name() const { return mName; } - void setIsPassword(bool isPassword) { mIsPassword = isPassword; } + void setInputType(WebCore::HTMLInputElement::InputType type) { mInputType = type; } void setIsReadOnly(bool isReadOnly) { mIsReadOnly = isReadOnly; } void setIsRtlText(bool isRtlText) { mIsRtlText = isRtlText; } void setIsTextField(bool isTextField) { mIsTextField = isTextField; } @@ -59,7 +60,7 @@ private: WebCore::String mName; int mMaxLength; int mTextSize; - bool mIsPassword : 1; + WebCore::HTMLInputElement::InputType mInputType; bool mIsReadOnly : 1; bool mIsRtlText : 1; bool mIsTextField : 1; diff --git a/WebKit/android/nav/CachedRoot.cpp b/WebKit/android/nav/CachedRoot.cpp index 83e2ab6..0011f06 100644 --- a/WebKit/android/nav/CachedRoot.cpp +++ b/WebKit/android/nav/CachedRoot.cpp @@ -26,6 +26,7 @@ #include "CachedPrefix.h" #include "android_graphics.h" #include "CachedHistory.h" +#include "CachedInput.h" #include "CachedNode.h" #include "SkBitmap.h" #include "SkBounder.h" diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp index f47b7f0..938d93c 100644 --- a/WebKit/android/nav/WebView.cpp +++ b/WebKit/android/nav/WebView.cpp @@ -36,6 +36,7 @@ #include "FindCanvas.h" #include "Frame.h" #include "GraphicsJNI.h" +#include "HTMLInputElement.h" #include "IntPoint.h" #include "IntRect.h" #include "Node.h" @@ -940,15 +941,15 @@ bool motionUp(int x, int y, int slop) bool syntheticLink = result->isSyntheticLink(); if (!syntheticLink) { sendMotionUp( - frame ? (WebCore::Frame*) frame->framePointer() : 0, - result ? (WebCore::Node*) result->nodePointer() : 0, rx, ry); + (WebCore::Frame*) frame->framePointer(), + (WebCore::Node*) result->nodePointer(), rx, ry); } viewInvalidate(); if (result->isTextInput()) { + bool isReadOnly = frame->textInput(result)->isReadOnly(); rebuildWebTextView(true); - if (!frame->textInput(result)->isReadOnly()) { + if (!isReadOnly) displaySoftKeyboard(true); - } } else { clearTextEntry(); setFollowedLink(true); @@ -1613,7 +1614,7 @@ static jint nativeFocusCandidateFramePointer(JNIEnv *env, jobject obj) static bool nativeFocusCandidateIsPassword(JNIEnv *env, jobject obj) { const CachedInput* input = getInputCandidate(env, obj); - return input ? input->isPassword() : false; + return input && input->inputType() == WebCore::HTMLInputElement::PASSWORD; } static bool nativeFocusCandidateIsRtlText(JNIEnv *env, jobject obj) @@ -1622,12 +1623,6 @@ static bool nativeFocusCandidateIsRtlText(JNIEnv *env, jobject obj) 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); @@ -1683,6 +1678,41 @@ static jint nativeFocusCandidateTextSize(JNIEnv *env, jobject obj) 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); @@ -2057,8 +2087,6 @@ static JNINativeMethod gJavaWebViewMethods[] = { (void*) nativeFocusCandidateIsPlugin }, { "nativeFocusCandidateIsRtlText", "()Z", (void*) nativeFocusCandidateIsRtlText }, - { "nativeFocusCandidateIsTextField", "()Z", - (void*) nativeFocusCandidateIsTextField }, { "nativeFocusCandidateIsTextInput", "()Z", (void*) nativeFocusCandidateIsTextInput }, { "nativeFocusCandidateMaxLength", "()I", @@ -2073,6 +2101,8 @@ static JNINativeMethod gJavaWebViewMethods[] = { (void*) nativeFocusCandidateText }, { "nativeFocusCandidateTextSize", "()I", (void*) nativeFocusCandidateTextSize }, + { "nativeFocusCandidateType", "()I", + (void*) nativeFocusCandidateType }, { "nativeFocusIsPlugin", "()Z", (void*) nativeFocusIsPlugin }, { "nativeFocusNodePointer", "()I", |
