[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

weinig at apple.com weinig at apple.com
Wed Dec 22 13:33:05 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 33d60adacb9c66e7ea2c99872634b776b6655c0d
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Sep 20 05:20:08 2010 +0000

    Add WebKit2 equivalent of the WebFormDelegate's doCommandBySelector
    <rdar://problem/8377088>
    https://bugs.webkit.org/show_bug.cgi?id=46073
    
    Reviewed by Anders Carlsson.
    
    Add bundle client to match the behavior of:
      - (BOOL)textField:(DOMHTMLInputElement *)element doCommandBySelector:(SEL)commandSelector inFrame:(WebFrame *)frame;
    
    * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
    * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:
    (WebKit::InjectedBundlePageFormClient::shouldPerformActionInTextField):
    * WebProcess/InjectedBundle/InjectedBundlePageFormClient.h:
    * WebProcess/WebCoreSupport/WebEditorClient.cpp:
    (WebKit::getActionTypeForKeyEvent):
    (WebKit::WebEditorClient::doTextFieldCommandFromEvent):
    (WebKit::WebEditorClient::textWillBeDeletedInTextField):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67836 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 39ee585..94d661b 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -2,6 +2,26 @@
 
         Reviewed by Anders Carlsson.
 
+        Add WebKit2 equivalent of the WebFormDelegate's doCommandBySelector
+        <rdar://problem/8377088>
+        https://bugs.webkit.org/show_bug.cgi?id=46073
+
+        Add bundle client to match the behavior of:
+          - (BOOL)textField:(DOMHTMLInputElement *)element doCommandBySelector:(SEL)commandSelector inFrame:(WebFrame *)frame;
+
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+        * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:
+        (WebKit::InjectedBundlePageFormClient::shouldPerformActionInTextField):
+        * WebProcess/InjectedBundle/InjectedBundlePageFormClient.h:
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        (WebKit::getActionTypeForKeyEvent):
+        (WebKit::WebEditorClient::doTextFieldCommandFromEvent):
+        (WebKit::WebEditorClient::textWillBeDeletedInTextField):
+
+2010-09-19  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Anders Carlsson.
+
         WebKit2 decidePolicyForNavigationAction should include mouse button information
         <rdar://problem/8413165>
         https://bugs.webkit.org/show_bug.cgi?id=46060
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
index f5313c4..1c9f647 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
@@ -28,6 +28,11 @@
 
 #include <WebKit2/WKBase.h>
 #include <WebKit2/WKBundleBase.h>
+
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
+
 #include <stdint.h>
 
 #ifdef __cplusplus
@@ -47,6 +52,17 @@ enum {
 };
 typedef uint32_t WKAffinityType;
 
+enum {
+    WKInputFieldActionTypeMoveUp,
+    WKInputFieldActionTypeMoveDown,
+    WKInputFieldActionTypeCancel,
+    WKInputFieldActionTypeInsertTab,
+    WKInputFieldActionTypeInsertBacktab,
+    WKInputFieldActionTypeInsertNewline,
+    WKInputFieldActionTypeInsertDelete
+};
+typedef uint32_t WKInputFieldActionType;
+
 // Loader Client
 typedef void (*WKBundlePageDidStartProvisionalLoadForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
 typedef void (*WKBundlePageDidReceiveServerRedirectForProvisionalLoadForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
@@ -144,6 +160,7 @@ typedef void (*WKBundlePageTextFieldDidBeginEditingCallback)(WKBundlePageRef pag
 typedef void (*WKBundlePageTextFieldDidEndEditingCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo);
 typedef void (*WKBundlePageTextDidChangeInTextFieldCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo);
 typedef void (*WKBundlePageTextDidChangeInTextAreaCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlTextAreaElementHandle, WKBundleFrameRef frame, const void* clientInfo);
+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);
 
 struct WKBundlePageFormClient {
@@ -153,6 +170,7 @@ struct WKBundlePageFormClient {
     WKBundlePageTextFieldDidEndEditingCallback                          textFieldDidEndEditing;
     WKBundlePageTextDidChangeInTextFieldCallback                        textDidChangeInTextField;
     WKBundlePageTextDidChangeInTextAreaCallback                         textDidChangeInTextArea;
+    WKBundlePageShouldPerformActionInTextFieldCallback                  shouldPerformActionInTextField;
     WKBundlePageWillSubmitFormCallback                                  willSubmitForm;
 };
 typedef struct WKBundlePageFormClient WKBundlePageFormClient;
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp
index 563edc6..a9dcbbe 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp
@@ -86,6 +86,15 @@ void InjectedBundlePageFormClient::textDidChangeInTextArea(WebPage* page, HTMLTe
     m_client.textDidChangeInTextArea(toRef(page), toRef(nodeHandle.get()), toRef(frame), m_client.clientInfo);
 }
 
+bool InjectedBundlePageFormClient::shouldPerformActionInTextField(WebPage* page, HTMLInputElement* inputElement, WKInputFieldActionType actionType, WebFrame* frame)
+{
+    if (!m_client.shouldPerformActionInTextField)
+        return false;
+
+    RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(inputElement);
+    return m_client.shouldPerformActionInTextField(toRef(page), toRef(nodeHandle.get()), actionType, toRef(frame), m_client.clientInfo);
+}
+
 void InjectedBundlePageFormClient::willSubmitForm(WebPage* page, HTMLFormElement* formElement, WebFrame* frame, WebFrame* sourceFrame, const Vector<std::pair<String, String> >& values, RefPtr<APIObject>& userData)
 {
     if (!m_client.willSubmitForm)
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h
index 909a45e..cc6620c 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h
@@ -53,7 +53,7 @@ public:
     void textFieldDidEndEditing(WebPage*, WebCore::HTMLInputElement*, WebFrame*);
     void textDidChangeInTextField(WebPage*, WebCore::HTMLInputElement*, WebFrame*);
     void textDidChangeInTextArea(WebPage*, WebCore::HTMLTextAreaElement*, WebFrame*);
-
+    bool shouldPerformActionInTextField(WebPage*, WebCore::HTMLInputElement*, WKInputFieldActionType, WebFrame*);    
     void willSubmitForm(WebPage*, WebCore::HTMLFormElement*, WebFrame*, WebFrame* sourceFrame, const Vector<std::pair<String, String> >&, RefPtr<APIObject>& userData);
 
 private:
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
index 08be997..839bde7 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
@@ -296,15 +296,48 @@ void WebEditorClient::textDidChangeInTextArea(Element* element)
     m_page->injectedBundleFormClient().textDidChangeInTextArea(m_page, static_cast<HTMLTextAreaElement*>(element), webFrame);
 }
 
-bool WebEditorClient::doTextFieldCommandFromEvent(Element*, KeyboardEvent*)
+static bool getActionTypeForKeyEvent(KeyboardEvent* event, WKInputFieldActionType& type)
+{
+    String key = event->keyIdentifier();
+    if (key == "Up")
+        type = WKInputFieldActionTypeMoveUp;
+    else if (key == "Down")
+        type = WKInputFieldActionTypeMoveDown;
+    else if (key == "U+001B")
+        type = WKInputFieldActionTypeCancel;
+    else if (key == "U+0009") {
+        if (event->shiftKey())
+            type = WKInputFieldActionTypeInsertBacktab;
+        else
+            type = WKInputFieldActionTypeInsertTab;
+    } else if (key == "Enter")
+        type = WKInputFieldActionTypeInsertNewline;
+    else
+        return false;
+
+    return true;
+}
+
+bool WebEditorClient::doTextFieldCommandFromEvent(Element* element, KeyboardEvent* event)
 {
-    notImplemented();
-    return false;
+    if (!element->hasTagName(inputTag))
+        return false;
+
+    WKInputFieldActionType actionType;
+    if (!getActionTypeForKeyEvent(event, actionType))
+        return false;
+
+    WebFrame* webFrame =  static_cast<WebFrameLoaderClient*>(element->document()->frame()->loader()->client())->webFrame();
+    return m_page->injectedBundleFormClient().shouldPerformActionInTextField(m_page, static_cast<HTMLInputElement*>(element), actionType, webFrame);
 }
 
-void WebEditorClient::textWillBeDeletedInTextField(Element*)
+void WebEditorClient::textWillBeDeletedInTextField(Element* element)
 {
-    notImplemented();
+    if (!element->hasTagName(inputTag))
+        return;
+
+    WebFrame* webFrame =  static_cast<WebFrameLoaderClient*>(element->document()->frame()->loader()->client())->webFrame();
+    m_page->injectedBundleFormClient().shouldPerformActionInTextField(m_page, static_cast<HTMLInputElement*>(element), WKInputFieldActionTypeInsertDelete, webFrame);
 }
 
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list