diff options
author | Leon Scroggins <scroggo@google.com> | 2009-10-15 13:33:58 -0400 |
---|---|---|
committer | Leon Scroggins <scroggo@google.com> | 2009-10-15 14:03:04 -0400 |
commit | 8601da30c7a307f6ca8a2b15688480cc1e8251c9 (patch) | |
tree | 420d968a1dbfcbe270264ca7a4277b3857f8880b /WebKit | |
parent | 31f7153b80559d0b0580ce91bd1465aea7588aa2 (diff) | |
download | external_webkit-8601da30c7a307f6ca8a2b15688480cc1e8251c9.zip external_webkit-8601da30c7a307f6ca8a2b15688480cc1e8251c9.tar.gz external_webkit-8601da30c7a307f6ca8a2b15688480cc1e8251c9.tar.bz2 |
Do not bring up the soft keyboard for readonly input fields.
Partial fix for http://b/issue?id=2159869. Add a field to CachedNode
for readonly. In WebView.cpp, only call displaySoftKeyboard if the
node is not readonly. Also call displaySoftKeyboard in nativeTextMotionUp
to replace a call being removed in WebView.touchUpOnTextField(java).
Diffstat (limited to 'WebKit')
-rw-r--r-- | WebKit/android/nav/CacheBuilder.cpp | 12 | ||||
-rw-r--r-- | WebKit/android/nav/CachedNode.h | 3 | ||||
-rw-r--r-- | WebKit/android/nav/WebView.cpp | 7 |
3 files changed, 18 insertions, 4 deletions
diff --git a/WebKit/android/nav/CacheBuilder.cpp b/WebKit/android/nav/CacheBuilder.cpp index 1f25a59..80965d2 100644 --- a/WebKit/android/nav/CacheBuilder.cpp +++ b/WebKit/android/nav/CacheBuilder.cpp @@ -42,6 +42,7 @@ #include "HTMLNames.h" #include "HTMLOptionElement.h" #include "HTMLSelectElement.h" +#include "HTMLTextAreaElement.h" #include "InlineTextBox.h" #include "KURL.h" #include "PluginView.h" @@ -991,6 +992,7 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame, bool isPassword = false; bool isTextArea = false; bool isTextField = false; + bool isReadOnly = false; bool isRtlText = false; bool isUnclipped = false; bool isFocus = node == focused; @@ -1098,15 +1100,18 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame, HTMLInputElement* input = (HTMLInputElement*) node; isTextField = input->isTextField(); - if (isTextField) + if (isTextField) { wantsKeyEvents = true; + isReadOnly = input->readOnly(); + } isPassword = input->inputType() == HTMLInputElement::PASSWORD; maxLength = input->maxLength(); name = input->name().string().copy(); isUnclipped = isTransparent; // can't detect if this is drawn on top (example: deviant.com login parts) - } else if (node->hasTagName(HTMLNames::textareaTag)) + } else if (node->hasTagName(HTMLNames::textareaTag)) { isTextArea = wantsKeyEvents = true; - else if (node->hasTagName(HTMLNames::aTag)) { + isReadOnly = (static_cast<HTMLTextAreaElement*>(node))->readOnly(); + } else if (node->hasTagName(HTMLNames::aTag)) { const HTMLAnchorElement* anchorNode = (const HTMLAnchorElement*) node; if (!anchorNode->isFocusable() && !HasTriggerEvent(node)) @@ -1195,6 +1200,7 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame, cachedNode.setIsArea(isArea); cachedNode.setIsFocus(isFocus); cachedNode.setIsPassword(isPassword); + cachedNode.setIsReadOnly(isReadOnly); cachedNode.setIsRtlText(isRtlText); cachedNode.setIsTextArea(isTextArea); cachedNode.setIsTextField(isTextField); diff --git a/WebKit/android/nav/CachedNode.h b/WebKit/android/nav/CachedNode.h index 2efbaf7..540ba49 100644 --- a/WebKit/android/nav/CachedNode.h +++ b/WebKit/android/nav/CachedNode.h @@ -120,6 +120,7 @@ public: bool isPlugin() const { return mWantsKeyEvents && !mIsTextArea && !mIsTextField; } + bool isReadOnly() const { return mIsReadOnly; } bool isRtlText() const { return mIsRtlText; } bool isTextArea() const { return mIsTextArea; } bool isTextField() const { return mIsTextField; } @@ -152,6 +153,7 @@ public: void setIsFocus(bool isFocus) { mIsFocus = isFocus; } void setIsParentAnchor(bool isAnchor) { mIsParentAnchor = isAnchor; } void setIsPassword(bool isPassword) { mIsPassword = isPassword; } + void setIsReadOnly(bool isReadOnly) { mIsReadOnly = isReadOnly; } void setIsRtlText(bool isRtlText) { mIsRtlText = isRtlText; } void setIsTextArea(bool isTextArea) { mIsTextArea = isTextArea; } void setIsTextField(bool isTextField) { mIsTextField = isTextField; } @@ -204,6 +206,7 @@ private: bool mIsHidden : 1; bool mIsParentAnchor : 1; bool mIsPassword : 1; + bool mIsReadOnly : 1; bool mIsRtlText : 1; bool mIsTextArea : 1; bool mIsTextField : 1; diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp index 23a1ec0..0b1a4cf 100644 --- a/WebKit/android/nav/WebView.cpp +++ b/WebKit/android/nav/WebView.cpp @@ -945,6 +945,9 @@ void textInputMotionUp(int x, int y) if (node) { sendMotionUp(static_cast<WebCore::Frame*>(frame->framePointer()), static_cast<WebCore::Node*>(node->nodePointer()), x, y); + if (!node->isReadOnly()) { + displaySoftKeyboard(true); + } } } @@ -992,7 +995,9 @@ bool motionUp(int x, int y, int slop) viewInvalidate(); if (result->isTextField() || result->isTextArea()) { rebuildWebTextView(); - displaySoftKeyboard(true); + if (!result->isReadOnly()) { + displaySoftKeyboard(true); + } } else { clearTextEntry(); setFollowedLink(true); |