Title: [145133] trunk/Source
Revision
145133
Author
ander...@apple.com
Date
2013-03-07 14:02:48 -0800 (Thu, 07 Mar 2013)

Log Message

Add a didFocusTextField callback to the injected bundle form client
https://bugs.webkit.org/show_bug.cgi?id=111771

Reviewed by Andreas Kling.

Source/WebCore:

Export a symbol needed by WebKit2.

* WebCore.exp.in:

Source/WebKit2:

Add a new client callback that's invoked whenever a text input field is focused.

* Shared/APIClientTraits.cpp:
(WebKit):
* Shared/APIClientTraits.h:
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
* WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:
(WebKit::InjectedBundlePageFormClient::didFocusTextField):
(WebKit):
* WebProcess/InjectedBundle/InjectedBundlePageFormClient.h:
(InjectedBundlePageFormClient):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::focusedNodeChanged):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (145132 => 145133)


--- trunk/Source/WebCore/ChangeLog	2013-03-07 22:01:38 UTC (rev 145132)
+++ trunk/Source/WebCore/ChangeLog	2013-03-07 22:02:48 UTC (rev 145133)
@@ -1,3 +1,14 @@
+2013-03-07  Anders Carlsson  <ander...@apple.com>
+
+        Add a didFocusTextField callback to the injected bundle form client
+        https://bugs.webkit.org/show_bug.cgi?id=111771
+
+        Reviewed by Andreas Kling.
+
+        Export a symbol needed by WebKit2.
+
+        * WebCore.exp.in:
+
 2013-03-06  James Robinson  <jam...@chromium.org>
 
         [chromium] Stop using WebTransformationMatrix on WebLayer

Modified: trunk/Source/WebCore/WebCore.exp.in (145132 => 145133)


--- trunk/Source/WebCore/WebCore.exp.in	2013-03-07 22:01:38 UTC (rev 145132)
+++ trunk/Source/WebCore/WebCore.exp.in	2013-03-07 22:02:48 UTC (rev 145133)
@@ -1345,6 +1345,7 @@
 __ZNK7WebCore16HTMLInputElement14suggestedValueEv
 __ZNK7WebCore16HTMLInputElement15isPasswordFieldEv
 __ZNK7WebCore16HTMLInputElement18shouldAutocompleteEv
+__ZNK7WebCore16HTMLInputElement6isTextEv
 __ZNK7WebCore16IconDatabaseBase12databasePathEv
 __ZNK7WebCore16ResourceResponse13nsURLResponseEv
 __ZNK7WebCore16ResourceResponse16certificateChainEv

Modified: trunk/Source/WebKit2/ChangeLog (145132 => 145133)


--- trunk/Source/WebKit2/ChangeLog	2013-03-07 22:01:38 UTC (rev 145132)
+++ trunk/Source/WebKit2/ChangeLog	2013-03-07 22:02:48 UTC (rev 145133)
@@ -1,3 +1,24 @@
+2013-03-07  Anders Carlsson  <ander...@apple.com>
+
+        Add a didFocusTextField callback to the injected bundle form client
+        https://bugs.webkit.org/show_bug.cgi?id=111771
+
+        Reviewed by Andreas Kling.
+
+        Add a new client callback that's invoked whenever a text input field is focused.
+
+        * Shared/APIClientTraits.cpp:
+        (WebKit):
+        * Shared/APIClientTraits.h:
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+        * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:
+        (WebKit::InjectedBundlePageFormClient::didFocusTextField):
+        (WebKit):
+        * WebProcess/InjectedBundle/InjectedBundlePageFormClient.h:
+        (InjectedBundlePageFormClient):
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::focusedNodeChanged):
+
 2013-03-07  Tim Horton  <timothy_hor...@apple.com>
 
         Null-check the page overlay before trying to use it.

Modified: trunk/Source/WebKit2/Shared/APIClientTraits.cpp (145132 => 145133)


--- trunk/Source/WebKit2/Shared/APIClientTraits.cpp	2013-03-07 22:01:38 UTC (rev 145132)
+++ trunk/Source/WebKit2/Shared/APIClientTraits.cpp	2013-03-07 22:02:48 UTC (rev 145133)
@@ -74,6 +74,7 @@
     
 const size_t APIClientTraits<WKBundlePageFormClient>::interfaceSizesByVersion[] = {
     offsetof(WKBundlePageFormClient, willSendSubmitEvent),
+    offsetof(WKBundlePageFormClient, didFocusTextField),
     sizeof(WKBundlePageFormClient)
 };
 

Modified: trunk/Source/WebKit2/Shared/APIClientTraits.h (145132 => 145133)


--- trunk/Source/WebKit2/Shared/APIClientTraits.h	2013-03-07 22:01:38 UTC (rev 145132)
+++ trunk/Source/WebKit2/Shared/APIClientTraits.h	2013-03-07 22:02:48 UTC (rev 145133)
@@ -72,7 +72,7 @@
 };
 
 template<> struct APIClientTraits<WKBundlePageFormClient> {
-    static const size_t interfaceSizesByVersion[2];
+    static const size_t interfaceSizesByVersion[3];
 };
 
 template<> struct APIClientTraits<WKBundlePageEditorClient> {

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h (145132 => 145133)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h	2013-03-07 22:01:38 UTC (rev 145132)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h	2013-03-07 22:02:48 UTC (rev 145133)
@@ -325,6 +325,7 @@
 typedef bool (*WKBundlePageShouldPerformActionInTextFieldCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKInputFieldActionType actionType, WKBundleFrameRef frame, const void* clientInfo);
 typedef void (*WKBundlePageWillSubmitFormCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlFormElementHandle, WKBundleFrameRef frame, WKBundleFrameRef sourceFrame, WKDictionaryRef values, WKTypeRef* userData, const void* clientInfo);
 typedef void (*WKBundlePageWillSendSubmitEventCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlFormElementHandle, WKBundleFrameRef frame, WKBundleFrameRef sourceFrame, WKDictionaryRef values, const void* clientInfo);
+typedef void (*WKBundlePageDidFocusTextFieldCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo);
 
 struct WKBundlePageFormClient {
     int                                                                 version;
@@ -340,10 +341,13 @@
     
     // Version 1.
     WKBundlePageWillSendSubmitEventCallback                             willSendSubmitEvent;
+
+    // version 2.
+    WKBundlePageDidFocusTextFieldCallback                               didFocusTextField;
 };
 typedef struct WKBundlePageFormClient WKBundlePageFormClient;
 
-enum { kWKBundlePageFormClientCurrentVersion = 1 };
+enum { kWKBundlePageFormClientCurrentVersion = 2 };
 
 // ContextMenu client
 typedef void (*WKBundlePageGetContextMenuFromDefaultContextMenuCallback)(WKBundlePageRef page, WKBundleHitTestResultRef hitTestResult, WKArrayRef defaultMenu, WKArrayRef* newMenu, WKTypeRef* userData, const void* clientInfo);

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp (145132 => 145133)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp	2013-03-07 22:01:38 UTC (rev 145132)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp	2013-03-07 22:02:48 UTC (rev 145133)
@@ -38,6 +38,15 @@
 
 namespace WebKit {
 
+void InjectedBundlePageFormClient::didFocusTextField(WebPage* page, HTMLInputElement* inputElement, WebFrame* frame)
+{
+    if (!m_client.didFocusTextField)
+        return;
+
+    RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(inputElement);
+    m_client.didFocusTextField(toAPI(page), toAPI(nodeHandle.get()), toAPI(frame), m_client.clientInfo);
+}
+
 void InjectedBundlePageFormClient::textFieldDidBeginEditing(WebPage* page, HTMLInputElement* inputElement, WebFrame* frame)
 {
     if (!m_client.textFieldDidBeginEditing)

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h (145132 => 145133)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h	2013-03-07 22:01:38 UTC (rev 145132)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h	2013-03-07 22:02:48 UTC (rev 145133)
@@ -47,6 +47,7 @@
 
 class InjectedBundlePageFormClient : public APIClient<WKBundlePageFormClient, kWKBundlePageFormClientCurrentVersion> {
 public:
+    void didFocusTextField(WebPage*, WebCore::HTMLInputElement*, WebFrame*);
     void textFieldDidBeginEditing(WebPage*, WebCore::HTMLInputElement*, WebFrame*);
     void textFieldDidEndEditing(WebPage*, WebCore::HTMLInputElement*, WebFrame*);
     void textDidChangeInTextField(WebPage*, WebCore::HTMLInputElement*, WebFrame*);

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (145132 => 145133)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2013-03-07 22:01:38 UTC (rev 145132)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2013-03-07 22:02:48 UTC (rev 145133)
@@ -57,6 +57,7 @@
 #include <WebCore/FrameLoadRequest.h>
 #include <WebCore/FrameLoader.h>
 #include <WebCore/FrameView.h>
+#include <WebCore/HTMLInputElement.h>
 #include <WebCore/HTMLNames.h>
 #include <WebCore/HTMLParserIdioms.h>
 #include <WebCore/HTMLPlugInImageElement.h>
@@ -152,9 +153,19 @@
     m_page->send(Messages::WebPageProxy::TakeFocus(direction));
 }
 
-void WebChromeClient::focusedNodeChanged(Node*)
+void WebChromeClient::focusedNodeChanged(Node* node)
 {
-    notImplemented();
+    if (!node)
+        return;
+    if (!node->hasTagName(inputTag))
+        return;
+
+    HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(node);
+    if (!inputElement->isText())
+        return;
+
+    WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(node->document()->frame()->loader()->client())->webFrame();
+    m_page->injectedBundleFormClient().didFocusTextField(m_page, inputElement, webFrame);
 }
 
 void WebChromeClient::focusedFrameChanged(Frame* frame)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to