summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2011-02-25 14:50:57 -0500
committerLeon Scroggins <scroggo@google.com>2011-02-25 16:39:17 -0500
commitd914e54363c3b0482ac7f4843af11d1beb340afe (patch)
tree4a7f36f0723898c3c347295ba342341212d15c1b
parentfaad3e550b7c5b481c8e5866bc44e34dba67323d (diff)
downloadexternal_webkit-d914e54363c3b0482ac7f4843af11d1beb340afe.zip
external_webkit-d914e54363c3b0482ac7f4843af11d1beb340afe.tar.gz
external_webkit-d914e54363c3b0482ac7f4843af11d1beb340afe.tar.bz2
Allow a site to specify to not show the IME for a textfield.
Bug:3391139 Change-Id: Ic1c99750c9e91940d9ac628444be594f5f860748
-rw-r--r--WebKit/android/jni/WebViewCore.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 815a968..a72864f 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -29,6 +29,7 @@
#include "WebViewCore.h"
#include "AccessibilityObject.h"
+#include "Attribute.h"
#include "BaseLayerAndroid.h"
#include "CachedNode.h"
#include "CachedRoot.h"
@@ -78,6 +79,7 @@
#include "HitTestResult.h"
#include "InlineTextBox.h"
#include "MemoryUsage.h"
+#include "NamedNodeMap.h"
#include "Navigator.h"
#include "Node.h"
#include "NodeList.h"
@@ -3117,6 +3119,22 @@ void WebViewCore::touchUp(int touchGeneration,
handleMouseClick(frame, node, false);
}
+// Check for the "x-webkit-soft-keyboard" attribute. If it is there and
+// set to hidden, do not show the soft keyboard. Node passed as a parameter
+// must not be null.
+static bool shouldSuppressKeyboard(const WebCore::Node* node) {
+ LOG_ASSERT(node, "node passed to shouldSuppressKeyboard cannot be null");
+ const NamedNodeMap* attributes = node->attributes();
+ if (!attributes) return false;
+ size_t length = attributes->length();
+ for (size_t i = 0; i < length; i++) {
+ const Attribute* a = attributes->attributeItem(i);
+ if (a->localName() == "x-webkit-soft-keyboard" && a->value() == "hidden")
+ return true;
+ }
+ return false;
+}
+
// Common code for both clicking with the trackball and touchUp
// Also used when typing into a non-focused textfield to give the textfield focus,
// in which case, 'fake' is set to true
@@ -3158,8 +3176,8 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node
if (focusNode) {
WebCore::RenderObject* renderer = focusNode->renderer();
if (renderer && (renderer->isTextField() || renderer->isTextArea())) {
- bool ime = !(static_cast<WebCore::HTMLInputElement*>(focusNode))
- ->readOnly();
+ bool ime = !shouldSuppressKeyboard(focusNode)
+ && !(static_cast<WebCore::HTMLInputElement*>(focusNode))->readOnly();
if (ime) {
#if ENABLE(WEB_AUTOFILL)
if (renderer->isTextField()) {