Changeset 183038 in webkit


Ignore:
Timestamp:
Apr 20, 2015 5:43:23 PM (9 years ago)
Author:
mitz@apple.com
Message:

Expose more bundle form client functions as WKWebProcessPlugInFormDelegatePrivate methods
https://bugs.webkit.org/show_bug.cgi?id=143973

Reviewed by Anders Carlsson.

  • WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFormDelegatePrivate.h: Declared new

delegate methods.

  • WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h: Declared new frame

property.

  • WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:

(-[WKWebProcessPlugInNodeHandle frame]): Added. Returns the node’s document’s frame. This is
useful to delegates getting an array of nodes via the new method.

  • WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:

(-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): Added overrides of
shouldNotifyOnFormChanges and didAssociateFormControls, which call the new delegate methods.

Location:
trunk/Source/WebKit2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r183031 r183038  
     12015-04-20  Dan Bernstein  <mitz@apple.com>
     2
     3        Expose more bundle form client functions as WKWebProcessPlugInFormDelegatePrivate methods
     4        https://bugs.webkit.org/show_bug.cgi?id=143973
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFormDelegatePrivate.h: Declared new
     9        delegate methods.
     10
     11        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h: Declared new frame
     12        property.
     13        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
     14        (-[WKWebProcessPlugInNodeHandle frame]): Added. Returns the node’s document’s frame. This is
     15        useful to delegates getting an array of nodes via the new method.
     16
     17        * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
     18        (-[WKWebProcessPlugInBrowserContextController _setFormDelegate:]): Added overrides of
     19        shouldNotifyOnFormChanges and didAssociateFormControls, which call the new delegate methods.
     20
    1212015-04-20  Joseph Pecoraro  <pecoraro@apple.com>
    222
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFormDelegatePrivate.h

    r168541 r183038  
    4646- (NSObject <NSSecureCoding> *)_webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller willBeginInputSessionForElement:(WKWebProcessPlugInNodeHandle *)node inFrame:(WKWebProcessPlugInFrame *)frame;
    4747
     48- (BOOL)_webProcessPlugInBrowserContextControllerShouldNotifyOnFormChanges:(WKWebProcessPlugInBrowserContextController *)controller;
     49- (void)_webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller didAssociateFormControls:(NSArray *)elements;
     50
    4851@end
    4952
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.h

    r182327 r183038  
    5555@property (nonatomic, readonly) BOOL HTMLTextAreaElementIsUserEdited;
    5656@property (nonatomic, readonly) WKWebProcessPlugInNodeHandle *HTMLTableCellElementCellAbove;
     57@property (nonatomic, readonly) WKWebProcessPlugInFrame *frame;
    5758
    5859- (BOOL)isTextField;
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm

    r182327 r183038  
    126126}
    127127
     128- (WKWebProcessPlugInFrame *)frame
     129{
     130    return [wrapper(*_nodeHandle->document()->documentFrame().leakRef()) autorelease];
     131}
     132
    128133- (InjectedBundleNodeHandle&)_nodeHandle
    129134{
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm

    r182267 r183038  
    524524        }
    525525
     526        virtual bool shouldNotifyOnFormChanges(WebKit::WebPage*) override
     527        {
     528            auto formDelegate = m_controller->_formDelegate.get();
     529
     530            if (![formDelegate respondsToSelector:@selector(_webProcessPlugInBrowserContextControllerShouldNotifyOnFormChanges:)])
     531                return false;
     532
     533            return [formDelegate _webProcessPlugInBrowserContextControllerShouldNotifyOnFormChanges:m_controller];
     534        }
     535
     536        virtual void didAssociateFormControls(WebKit::WebPage*, const Vector<RefPtr<WebCore::Element>>& elements) override
     537        {
     538            auto formDelegate = m_controller->_formDelegate.get();
     539
     540            if (![formDelegate respondsToSelector:@selector(_webProcessPlugInBrowserContextController:didAssociateFormControls:)])
     541                return;
     542
     543            auto controls = adoptNS([[NSMutableArray alloc] initWithCapacity:elements.size()]);
     544            for (const auto& element : elements)
     545                [controls addObject:wrapper(*WebKit::InjectedBundleNodeHandle::getOrCreate(element.get()))];
     546            return [formDelegate _webProcessPlugInBrowserContextController:m_controller didAssociateFormControls:controls.get()];
     547        }
     548
    526549    private:
    527550        WKWebProcessPlugInBrowserContextController *m_controller;
Note: See TracChangeset for help on using the changeset viewer.