Changeset 166890 in webkit


Ignore:
Timestamp:
Apr 7, 2014 4:00:04 PM (10 years ago)
Author:
mitz@apple.com
Message:

Add API::InjectedBundle::FormClient
https://bugs.webkit.org/show_bug.cgi?id=131317

Reviewed by Anders Carlsson.

  • WebKit2.xcodeproj/project.pbxproj: Added reference to new file.
  • WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:

(WKBundlePageSetFormClient):

  • WebProcess/InjectedBundle/API/c/WKBundlePageFormClient.h:
  • WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:

(-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): Changed to define and
create a FormClient (which derives from API::InjectedBundle::FormClient and messages a
delegate), and set it as the form client.
(didFocusTextField): Deleted.
(willSubmitForm): Deleted.
(setUpFormClient): Deleted.

  • WebProcess/InjectedBundle/APIInjectedBundleFormClient.h: Added.

(API::InjectedBundle::FormClient::~FormClient):
(API::InjectedBundle::FormClient::didFocusTextField):
(API::InjectedBundle::FormClient::textFieldDidBeginEditing):
(API::InjectedBundle::FormClient::textFieldDidEndEditing):
(API::InjectedBundle::FormClient::textDidChangeInTextField):
(API::InjectedBundle::FormClient::textDidChangeInTextArea):
(API::InjectedBundle::FormClient::shouldPerformActionInTextField):
(API::InjectedBundle::FormClient::willSubmitForm):
(API::InjectedBundle::FormClient::willSendSubmitEvent):
(API::InjectedBundle::FormClient::didAssociateFormControls):
(API::InjectedBundle::FormClient::shouldNotifyOnFormChanges):

  • WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:

(WebKit::InjectedBundlePageFormClient::InjectedBundlePageFormClient): Added a constructor
from WKBundlePageFormClientBase.
(WebKit::toWKInputFieldActionType): Added helper to convert from internal enum to C SPI
enum.
(WebKit::InjectedBundlePageFormClient::shouldPerformActionInTextField): Use helper.

  • WebProcess/InjectedBundle/InjectedBundlePageFormClient.h: Added inheritance from

API::InjectedBundle::FormClient, marked overrides as such.

  • WebProcess/InjectedBundle/InjectedBundlePageUIClient.h: Removed unused forward

declarations.

  • WebProcess/WebCoreSupport/WebEditorClient.cpp:

(WebKit::toInputFieldAction): Added helper to convert from C SPI enum to internal enum.
(WebKit::WebEditorClient::doTextFieldCommandFromEvent): Use helper.
(WebKit::WebEditorClient::textWillBeDeletedInTextField): Ditto.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::WebPage): Initialize m_formClient member.
(WebKit::WebPage::setInjectedBundleFormClient): Added. Updates m_formClient.
(WebKit::WebPage::close): Updated code to clear m_formClient.
(WebKit::WebPage::initializeInjectedBundleFormClient): Deleted.

  • WebProcess/WebPage/WebPage.h:

(WebKit::WebPage::injectedBundleFormClient): Updated return type.

Location:
trunk/Source/WebKit2
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r166889 r166890  
     12014-04-07  Dan Bernstein  <mitz@apple.com>
     2
     3        Add API::InjectedBundle::FormClient
     4        https://bugs.webkit.org/show_bug.cgi?id=131317
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * WebKit2.xcodeproj/project.pbxproj: Added reference to new file.
     9
     10        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
     11        (WKBundlePageSetFormClient):
     12        * WebProcess/InjectedBundle/API/c/WKBundlePageFormClient.h:
     13        * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
     14        (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): Changed to define and
     15        create a FormClient (which derives from API::InjectedBundle::FormClient and messages a
     16        delegate), and set it as the form client.
     17        (didFocusTextField): Deleted.
     18        (willSubmitForm): Deleted.
     19        (setUpFormClient): Deleted.
     20
     21        * WebProcess/InjectedBundle/APIInjectedBundleFormClient.h: Added.
     22        (API::InjectedBundle::FormClient::~FormClient):
     23        (API::InjectedBundle::FormClient::didFocusTextField):
     24        (API::InjectedBundle::FormClient::textFieldDidBeginEditing):
     25        (API::InjectedBundle::FormClient::textFieldDidEndEditing):
     26        (API::InjectedBundle::FormClient::textDidChangeInTextField):
     27        (API::InjectedBundle::FormClient::textDidChangeInTextArea):
     28        (API::InjectedBundle::FormClient::shouldPerformActionInTextField):
     29        (API::InjectedBundle::FormClient::willSubmitForm):
     30        (API::InjectedBundle::FormClient::willSendSubmitEvent):
     31        (API::InjectedBundle::FormClient::didAssociateFormControls):
     32        (API::InjectedBundle::FormClient::shouldNotifyOnFormChanges):
     33
     34        * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:
     35        (WebKit::InjectedBundlePageFormClient::InjectedBundlePageFormClient): Added a constructor
     36        from WKBundlePageFormClientBase.
     37        (WebKit::toWKInputFieldActionType): Added helper to convert from internal enum to C SPI
     38        enum.
     39        (WebKit::InjectedBundlePageFormClient::shouldPerformActionInTextField): Use helper.
     40        * WebProcess/InjectedBundle/InjectedBundlePageFormClient.h: Added inheritance from
     41        API::InjectedBundle::FormClient, marked overrides as such.
     42
     43        * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h: Removed unused forward
     44        declarations.
     45
     46        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
     47        (WebKit::toInputFieldAction): Added helper to convert from C SPI enum to internal enum.
     48        (WebKit::WebEditorClient::doTextFieldCommandFromEvent): Use helper.
     49        (WebKit::WebEditorClient::textWillBeDeletedInTextField): Ditto.
     50
     51        * WebProcess/WebPage/WebPage.cpp:
     52        (WebKit::WebPage::WebPage): Initialize m_formClient member.
     53        (WebKit::WebPage::setInjectedBundleFormClient): Added. Updates m_formClient.
     54        (WebKit::WebPage::close): Updated code to clear m_formClient.
     55        (WebKit::WebPage::initializeInjectedBundleFormClient): Deleted.
     56        * WebProcess/WebPage/WebPage.h:
     57        (WebKit::WebPage::injectedBundleFormClient): Updated return type.
     58
    1592014-04-07  Hyowon Kim  <hw1008.kim@samsung.com>
    260
  • trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r166886 r166890  
    666666                3766F9F1189A1254003CF19B /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BC87DFA91018101400564216 /* libicucore.dylib */; };
    667667                3769079A18F31CB2001DFF04 /* APIInjectedBundlePageUIClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 3769079818F31CB2001DFF04 /* APIInjectedBundlePageUIClient.h */; };
     668                3769079E18F340A2001DFF04 /* APIInjectedBundleFormClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 3769079C18F340A2001DFF04 /* APIInjectedBundleFormClient.h */; };
    668669                37694525184FC6B600CDE21F /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCF5068412431861005955AE /* Security.framework */; };
    669670                377EAD4517E2C51A002D193D /* WKDeclarationSpecifiers.h in Headers */ = {isa = PBXBuildFile; fileRef = 377EAD4417E2C51A002D193D /* WKDeclarationSpecifiers.h */; settings = {ATTRIBUTES = (Public, ); }; };
     
    24852486                37608821150414F700FC82C7 /* WKRenderObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKRenderObject.h; sourceTree = "<group>"; };
    24862487                3769079818F31CB2001DFF04 /* APIInjectedBundlePageUIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = APIInjectedBundlePageUIClient.h; path = API/APIInjectedBundlePageUIClient.h; sourceTree = "<group>"; };
     2488                3769079C18F340A2001DFF04 /* APIInjectedBundleFormClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIInjectedBundleFormClient.h; sourceTree = "<group>"; };
    24872489                377EAD4417E2C51A002D193D /* WKDeclarationSpecifiers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDeclarationSpecifiers.h; sourceTree = "<group>"; };
    24882490                377EAD4617E2C77B002D193D /* WKUserContentInjectedFrames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserContentInjectedFrames.h; sourceTree = "<group>"; };
     
    57635765                                BC4BEE96120A091700FBA0C7 /* DOM */,
    57645766                                BC204EE411C83E9C008F3375 /* mac */,
     5767                                3769079C18F340A2001DFF04 /* APIInjectedBundleFormClient.h */,
    57655768                                3769079818F31CB2001DFF04 /* APIInjectedBundlePageUIClient.h */,
    57665769                                BC204EE011C83E98008F3375 /* InjectedBundle.cpp */,
     
    72617264                                E1AEA22F14687BDB00804569 /* WKFullKeyboardAccessWatcher.h in Headers */,
    72627265                                CDCA85C9132ABA4E00E961DF /* WKFullScreenWindowController.h in Headers */,
     7266                                3769079E18F340A2001DFF04 /* APIInjectedBundleFormClient.h in Headers */,
    72637267                                1AB8A1F618400B9D00E9AE69 /* WKPageFindMatchesClient.h in Headers */,
    72647268                                BC54CC1212D674EE005C67B0 /* WKGeolocationManager.h in Headers */,
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp

    r166879 r166890  
    3434#include "InjectedBundleBackForwardList.h"
    3535#include "InjectedBundleNodeHandle.h"
     36#include "InjectedBundlePageFormClient.h"
    3637#include "InjectedBundlePageUIClient.h"
    3738#include "PageBanner.h"
     
    8081void WKBundlePageSetFormClient(WKBundlePageRef pageRef, WKBundlePageFormClientBase* wkClient)
    8182{
    82     toImpl(pageRef)->initializeInjectedBundleFormClient(wkClient);
     83    toImpl(pageRef)->setInjectedBundleFormClient(std::make_unique<InjectedBundlePageFormClient>(wkClient));
    8384}
    8485
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageFormClient.h

    r160104 r166890  
    2828
    2929#include <WebKit2/WKBase.h>
     30#include <WebKit2/WKBundlePageEditorClient.h>
    3031
    3132typedef void (*WKBundlePageTextFieldDidBeginEditingCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo);
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm

    r166433 r166890  
    5454#import <WebCore/Document.h>
    5555#import <WebCore/Frame.h>
     56#import <WebCore/HTMLFormElement.h>
     57#import <WebCore/HTMLInputElement.h>
    5658
    5759using namespace WebCore;
     
    268270}
    269271
    270 static void didFocusTextField(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandleRef, WKBundleFrameRef frameRef, const void* clientInfo)
    271 {
    272     WKWebProcessPlugInBrowserContextController *controller = (WKWebProcessPlugInBrowserContextController *)clientInfo;
    273     auto formDelegate = controller->_formDelegate.get();
    274 
    275     if ([formDelegate respondsToSelector:@selector(_webProcessPlugInBrowserContextController:didFocusTextField:inFrame:)])
    276         [formDelegate _webProcessPlugInBrowserContextController:controller didFocusTextField:wrapper(*toImpl(htmlInputElementHandleRef)) inFrame:wrapper(*toImpl(frameRef))];
    277 }
    278 
    279 static void willSubmitForm(WKBundlePageRef page, WKBundleNodeHandleRef htmlFormElementHandle, WKBundleFrameRef frame, WKBundleFrameRef sourceFrame, WKDictionaryRef values, WKTypeRef* userData, const void* clientInfo)
    280 {
    281     WKWebProcessPlugInBrowserContextController *controller = (WKWebProcessPlugInBrowserContextController *)clientInfo;
    282     auto formDelegate = controller->_formDelegate.get();
    283 
    284     if ([formDelegate respondsToSelector:@selector(_webProcessPlugInBrowserContextController:willSubmitForm:toFrame:fromFrame:withValues:)])
    285         [formDelegate _webProcessPlugInBrowserContextController:controller willSubmitForm:wrapper(*toImpl(htmlFormElementHandle)) toFrame:wrapper(*toImpl(frame)) fromFrame:wrapper(*toImpl(sourceFrame)) withValues:wrapper(*toImpl(values))];
    286 }
    287 
    288 static void setUpFormClient(WKWebProcessPlugInBrowserContextController *contextController, WebPage& page)
    289 {
    290     WKBundlePageFormClientV2 client;
    291     memset(&client, 0, sizeof(client));
    292 
    293     client.base.version = 2;
    294     client.base.clientInfo = contextController;
    295     client.didFocusTextField = didFocusTextField;
    296     client.willSubmitForm = willSubmitForm;
    297 
    298     page.initializeInjectedBundleFormClient(&client.base);
    299 }
    300 
    301272- (id <WKWebProcessPlugInLoadDelegate>)loadDelegate
    302273{
     
    405376    _formDelegate = formDelegate;
    406377
     378    class FormClient : public API::InjectedBundle::FormClient {
     379    public:
     380        explicit FormClient(WKWebProcessPlugInBrowserContextController *controller)
     381            : m_controller(controller)
     382        {
     383        }
     384
     385        virtual ~FormClient() { }
     386
     387        virtual void didFocusTextField(WebPage*, HTMLInputElement* inputElement, WebFrame* frame) override
     388        {
     389            auto formDelegate = m_controller->_formDelegate.get();
     390
     391            if ([formDelegate respondsToSelector:@selector(_webProcessPlugInBrowserContextController:didFocusTextField:inFrame:)])
     392                [formDelegate _webProcessPlugInBrowserContextController:m_controller didFocusTextField:wrapper(*InjectedBundleNodeHandle::getOrCreate(inputElement).get()) inFrame:wrapper(*frame)];
     393        }
     394
     395        virtual void willSubmitForm(WebPage*, HTMLFormElement* formElement, WebFrame* frame, WebFrame* sourceFrame, const Vector<std::pair<WTF::String, WTF::String>>& values, RefPtr<API::Object>& userData) override
     396        {
     397            auto formDelegate = m_controller->_formDelegate.get();
     398
     399            if ([formDelegate respondsToSelector:@selector(_webProcessPlugInBrowserContextController:willSubmitForm:toFrame:fromFrame:withValues:)]) {
     400                auto valueMap = adoptNS([[NSMutableDictionary alloc] initWithCapacity:values.size()]);
     401                for (const auto& pair : values)
     402                    [valueMap setObject:pair.second forKey:pair.first];
     403
     404                [formDelegate _webProcessPlugInBrowserContextController:m_controller willSubmitForm:wrapper(*InjectedBundleNodeHandle::getOrCreate(formElement).get()) toFrame:wrapper(*frame) fromFrame:wrapper(*sourceFrame) withValues:valueMap.get()];
     405            }
     406        }
     407
     408    private:
     409        WKWebProcessPlugInBrowserContextController *m_controller;
     410    };
     411
    407412    if (formDelegate)
    408         setUpFormClient(self, *_page);
     413        _page->setInjectedBundleFormClient(std::make_unique<FormClient>(self));
    409414    else
    410         _page->initializeInjectedBundleFormClient(nullptr);
     415        _page->setInjectedBundleFormClient(nullptr);
    411416}
    412417
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp

    r160608 r166890  
    3939
    4040namespace WebKit {
     41
     42InjectedBundlePageFormClient::InjectedBundlePageFormClient(const WKBundlePageFormClientBase* client)
     43{
     44    initialize(client);
     45}
    4146
    4247void InjectedBundlePageFormClient::didFocusTextField(WebPage* page, HTMLInputElement* inputElement, WebFrame* frame)
     
    8590}
    8691
    87 bool InjectedBundlePageFormClient::shouldPerformActionInTextField(WebPage* page, HTMLInputElement* inputElement, WKInputFieldActionType actionType, WebFrame* frame)
     92static WKInputFieldActionType toWKInputFieldActionType(API::InjectedBundle::FormClient::InputFieldAction action)
     93{
     94    switch (action) {
     95    case API::InjectedBundle::FormClient::InputFieldAction::MoveUp:
     96        return WKInputFieldActionTypeMoveUp;
     97    case API::InjectedBundle::FormClient::InputFieldAction::MoveDown:
     98        return WKInputFieldActionTypeMoveDown;
     99    case API::InjectedBundle::FormClient::InputFieldAction::Cancel:
     100        return WKInputFieldActionTypeCancel;
     101    case API::InjectedBundle::FormClient::InputFieldAction::InsertTab:
     102        return WKInputFieldActionTypeInsertTab;
     103    case API::InjectedBundle::FormClient::InputFieldAction::InsertBacktab:
     104        return WKInputFieldActionTypeInsertBacktab;
     105    case API::InjectedBundle::FormClient::InputFieldAction::InsertNewline:
     106        return WKInputFieldActionTypeInsertNewline;
     107    case API::InjectedBundle::FormClient::InputFieldAction::InsertDelete:
     108        return WKInputFieldActionTypeInsertDelete;
     109    }
     110
     111    ASSERT_NOT_REACHED();
     112    return WKInputFieldActionTypeCancel;
     113}
     114
     115bool InjectedBundlePageFormClient::shouldPerformActionInTextField(WebPage* page, HTMLInputElement* inputElement, API::InjectedBundle::FormClient::InputFieldAction actionType, WebFrame* frame)
    88116{
    89117    if (!m_client.shouldPerformActionInTextField)
     
    91119
    92120    RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(inputElement);
    93     return m_client.shouldPerformActionInTextField(toAPI(page), toAPI(nodeHandle.get()), actionType, toAPI(frame), m_client.base.clientInfo);
     121    return m_client.shouldPerformActionInTextField(toAPI(page), toAPI(nodeHandle.get()), toWKInputFieldActionType(actionType), toAPI(frame), m_client.base.clientInfo);
    94122}
    95123
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h

    r159994 r166890  
    2828
    2929#include "APIClient.h"
    30 #include "WKBundlePage.h"
    31 #include <algorithm>
    32 #include <wtf/Forward.h>
    33 #include <wtf/Vector.h>
     30#include "APIInjectedBundleFormClient.h"
     31#include "WKBundlePageFormClient.h"
    3432
    3533namespace API {
    36 class Object;
    3734
    3835template<> struct ClientTraits<WKBundlePageFormClientBase> {
     
    4138}
    4239
    43 namespace WebCore {
    44 class Element;
    45 class HTMLFormElement;
    46 class HTMLInputElement;
    47 class HTMLTextAreaElement;
    48 }
    49 
    5040namespace WebKit {
    5141
    52 class ImmutableDictionary;
    53 class WebFrame;
    54 class WebPage;
     42class InjectedBundlePageFormClient : public API::Client<WKBundlePageFormClientBase>, public API::InjectedBundle::FormClient {
     43public:
     44    explicit InjectedBundlePageFormClient(const WKBundlePageFormClientBase*);
    5545
    56 class InjectedBundlePageFormClient : public API::Client<WKBundlePageFormClientBase> {
    57 public:
    58     void didFocusTextField(WebPage*, WebCore::HTMLInputElement*, WebFrame*);
    59     void textFieldDidBeginEditing(WebPage*, WebCore::HTMLInputElement*, WebFrame*);
    60     void textFieldDidEndEditing(WebPage*, WebCore::HTMLInputElement*, WebFrame*);
    61     void textDidChangeInTextField(WebPage*, WebCore::HTMLInputElement*, WebFrame*);
    62     void textDidChangeInTextArea(WebPage*, WebCore::HTMLTextAreaElement*, WebFrame*);
    63     bool shouldPerformActionInTextField(WebPage*, WebCore::HTMLInputElement*, WKInputFieldActionType, WebFrame*);   
    64     void willSubmitForm(WebPage*, WebCore::HTMLFormElement*, WebFrame*, WebFrame* sourceFrame, const Vector<std::pair<String, String>>&, RefPtr<API::Object>& userData);
    65     void willSendSubmitEvent(WebPage*, WebCore::HTMLFormElement*, WebFrame*, WebFrame* sourceFrame, const Vector<std::pair<String, String>>&);
    66     void didAssociateFormControls(WebPage*, const Vector<RefPtr<WebCore::Element>>&);
    67     bool shouldNotifyOnFormChanges(WebPage*);
     46    virtual void didFocusTextField(WebPage*, WebCore::HTMLInputElement*, WebFrame*) override;
     47    virtual void textFieldDidBeginEditing(WebPage*, WebCore::HTMLInputElement*, WebFrame*) override;
     48    virtual void textFieldDidEndEditing(WebPage*, WebCore::HTMLInputElement*, WebFrame*) override;
     49    virtual void textDidChangeInTextField(WebPage*, WebCore::HTMLInputElement*, WebFrame*) override;
     50    virtual void textDidChangeInTextArea(WebPage*, WebCore::HTMLTextAreaElement*, WebFrame*) override;
     51    virtual bool shouldPerformActionInTextField(WebPage*, WebCore::HTMLInputElement*, InputFieldAction, WebFrame*) override;   
     52    virtual void willSubmitForm(WebPage*, WebCore::HTMLFormElement*, WebFrame*, WebFrame* sourceFrame, const Vector<std::pair<String, String>>&, RefPtr<API::Object>& userData) override;
     53    virtual void willSendSubmitEvent(WebPage*, WebCore::HTMLFormElement*, WebFrame*, WebFrame* sourceFrame, const Vector<std::pair<String, String>>&) override;
     54    virtual void didAssociateFormControls(WebPage*, const Vector<RefPtr<WebCore::Element>>&) override;
     55    virtual bool shouldNotifyOnFormChanges(WebPage*) override;
    6856};
    6957
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h

    r166879 r166890  
    4242}
    4343
    44 namespace WebCore {
    45 class GraphicsContext;
    46 class HitTestResult;
    47 class IntRect;
    48 }
    49 
    5044namespace WebKit {
    51 
    52 class WebFrame;
    53 class WebPage;
    54 class WebSecurityOrigin;
    5545
    5646class InjectedBundlePageUIClient : public API::Client<WKBundlePageUIClientBase>, public API::InjectedBundle::PageUIClient {
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp

    r166818 r166890  
    362362}
    363363
     364static API::InjectedBundle::FormClient::InputFieldAction toInputFieldAction(WKInputFieldActionType action)
     365{
     366    switch (action) {
     367    case WKInputFieldActionTypeMoveUp:
     368        return API::InjectedBundle::FormClient::InputFieldAction::MoveUp;
     369    case WKInputFieldActionTypeMoveDown:
     370        return API::InjectedBundle::FormClient::InputFieldAction::MoveDown;
     371    case WKInputFieldActionTypeCancel:
     372        return API::InjectedBundle::FormClient::InputFieldAction::Cancel;
     373    case WKInputFieldActionTypeInsertTab:
     374        return API::InjectedBundle::FormClient::InputFieldAction::InsertTab;
     375    case WKInputFieldActionTypeInsertNewline:
     376        return API::InjectedBundle::FormClient::InputFieldAction::InsertNewline;
     377    case WKInputFieldActionTypeInsertDelete:
     378        return API::InjectedBundle::FormClient::InputFieldAction::InsertDelete;
     379    case WKInputFieldActionTypeInsertBacktab:
     380        return API::InjectedBundle::FormClient::InputFieldAction::InsertBacktab;
     381    }
     382
     383    ASSERT_NOT_REACHED();
     384    return API::InjectedBundle::FormClient::InputFieldAction::Cancel;
     385}
     386
    364387bool WebEditorClient::doTextFieldCommandFromEvent(Element* element, KeyboardEvent* event)
    365388{
     
    374397    ASSERT(webFrame);
    375398
    376     return m_page->injectedBundleFormClient().shouldPerformActionInTextField(m_page, toHTMLInputElement(element), actionType, webFrame);
     399    return m_page->injectedBundleFormClient().shouldPerformActionInTextField(m_page, toHTMLInputElement(element), toInputFieldAction(actionType), webFrame);
    377400}
    378401
     
    385408    ASSERT(webFrame);
    386409
    387     m_page->injectedBundleFormClient().shouldPerformActionInTextField(m_page, toHTMLInputElement(element), WKInputFieldActionTypeInsertDelete, webFrame);
     410    m_page->injectedBundleFormClient().shouldPerformActionInTextField(m_page, toHTMLInputElement(element), toInputFieldAction(WKInputFieldActionTypeInsertDelete), webFrame);
    388411}
    389412
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r166879 r166890  
    264264    , m_setCanStartMediaTimer(RunLoop::main(), this, &WebPage::setCanStartMediaTimerFired)
    265265    , m_sendDidUpdateViewStateTimer(RunLoop::main(), this, &WebPage::didUpdateViewStateTimerFired)
     266    , m_formClient(std::make_unique<API::InjectedBundle::FormClient>())
    266267    , m_uiClient(std::make_unique<API::InjectedBundle::PageUIClient>())
    267268    , m_findController(this)
     
    530531}
    531532
    532 void WebPage::initializeInjectedBundleFormClient(WKBundlePageFormClientBase* client)
    533 {
    534     m_formClient.initialize(client);
     533void WebPage::setInjectedBundleFormClient(std::unique_ptr<API::InjectedBundle::FormClient> formClient)
     534{
     535    if (!formClient) {
     536        m_formClient = std::make_unique<API::InjectedBundle::FormClient>();
     537        return;
     538    }
     539
     540    m_formClient = std::move(formClient);
    535541}
    536542
     
    880886#endif
    881887    m_editorClient.initialize(0);
    882     m_formClient.initialize(0);
     888    m_formClient = std::unique_ptr<API::InjectedBundle::FormClient>();
    883889    m_loaderClient.initialize(0);
    884890    m_policyClient.initialize(0);
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r166881 r166890  
    2727#define WebPage_h
    2828
     29#include "APIInjectedBundleFormClient.h"
    2930#include "APIInjectedBundlePageUIClient.h"
    3031#include "APIObject.h"
     
    3536#include "InjectedBundlePageDiagnosticLoggingClient.h"
    3637#include "InjectedBundlePageEditorClient.h"
    37 #include "InjectedBundlePageFormClient.h"
    3838#include "InjectedBundlePageFullScreenClient.h"
    3939#include "InjectedBundlePageLoaderClient.h"
     
    282282#endif
    283283    void initializeInjectedBundleEditorClient(WKBundlePageEditorClientBase*);
    284     void initializeInjectedBundleFormClient(WKBundlePageFormClientBase*);
     284    void setInjectedBundleFormClient(std::unique_ptr<API::InjectedBundle::FormClient>);
    285285    void initializeInjectedBundleLoaderClient(WKBundlePageLoaderClientBase*);
    286286    void initializeInjectedBundlePolicyClient(WKBundlePagePolicyClientBase*);
     
    296296#endif
    297297    InjectedBundlePageEditorClient& injectedBundleEditorClient() { return m_editorClient; }
    298     InjectedBundlePageFormClient& injectedBundleFormClient() { return m_formClient; }
     298    API::InjectedBundle::FormClient& injectedBundleFormClient() { return *m_formClient.get(); }
    299299    InjectedBundlePageLoaderClient& injectedBundleLoaderClient() { return m_loaderClient; }
    300300    InjectedBundlePagePolicyClient& injectedBundlePolicyClient() { return m_policyClient; }
     
    10761076#endif
    10771077    InjectedBundlePageEditorClient m_editorClient;
    1078     InjectedBundlePageFormClient m_formClient;
     1078    std::unique_ptr<API::InjectedBundle::FormClient> m_formClient;
    10791079    InjectedBundlePageLoaderClient m_loaderClient;
    10801080    InjectedBundlePagePolicyClient m_policyClient;
Note: See TracChangeset for help on using the changeset viewer.