summaryrefslogtreecommitdiffstats
path: root/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android/WebCoreSupport/EditorClientAndroid.cpp')
-rw-r--r--WebKit/android/WebCoreSupport/EditorClientAndroid.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp b/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp
index 45498c0..f5f8211 100644
--- a/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp
@@ -32,6 +32,7 @@
#include "EventNames.h"
#include "FocusController.h"
#include "Frame.h"
+#include "HTMLNames.h"
#include "KeyboardEvent.h"
#include "NotImplemented.h"
#include "PlatformKeyboardEvent.h"
@@ -39,6 +40,8 @@
#include "WebViewCore.h"
#include "WindowsKeyboardCodes.h"
+using namespace WebCore::HTMLNames;
+
namespace android {
void EditorClientAndroid::pageDestroyed() {
@@ -235,6 +238,19 @@ void EditorClientAndroid::respondToChangedSelection() {
Frame* frame = m_page->focusController()->focusedOrMainFrame();
if (!frame || !frame->view())
return;
+
+#if ENABLE(WEB_AUTOFILL)
+ WebCore::Node* focusedNode = frame->document()->focusedNode();
+ if (focusedNode && focusedNode->hasTagName(inputTag)) {
+ WebCore::HTMLInputElement* element = static_cast<WebCore::HTMLInputElement*>(focusedNode);
+ // TODO: If it's a text field, inform AutoFill that it should get AutoFill suggestions for
+ // the form it belongs to. AutoFill can also work with select-one elements (i.e. <select>
+ // without the "multiple" attribute set. Is it safe to call this function with select elements?
+ // How should AutoFill communicate select suggestions to Java?
+ if (element->isTextField())
+ m_autoFill->formFieldFocused(static_cast<HTMLFormControlElement*>(focusedNode));
+ }
+#endif
WebViewCore* webViewCore = WebViewCore::getWebViewCore(frame->view());
webViewCore->updateTextSelection();
}
@@ -261,4 +277,15 @@ void EditorClientAndroid::willSetInputMethodState()
{
notImplemented();
}
+
+#if ENABLE(WEB_AUTOFILL)
+WebAutoFill* EditorClientAndroid::getAutoFill()
+{
+ if (!m_autoFill)
+ m_autoFill.set(new WebAutoFill());
+
+ return m_autoFill.get();
+}
+#endif
+
}