Bug 116334 - Expose a way to know when forms are added to a page or when form controls are added to a form in the injected bundle
Summary: Expose a way to know when forms are added to a page or when form controls are...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jessie Berlin
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-05-17 11:04 PDT by Jessie Berlin
Modified: 2013-05-20 19:09 PDT (History)
3 users (show)

See Also:


Attachments
Patch (27.34 KB, patch)
2013-05-17 11:24 PDT, Jessie Berlin
no flags Details | Formatted Diff | Diff
Patch (version 2) (28.92 KB, patch)
2013-05-20 15:47 PDT, Jessie Berlin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jessie Berlin 2013-05-17 11:04:28 PDT
We should use the didAssociateFormControls and shouldNotifyOnFormChanges callbacks on ChromeClient.

<rdar://problem/13905067>
Comment 1 Jessie Berlin 2013-05-17 11:24:22 PDT
Created attachment 202124 [details]
Patch
Comment 2 Alexey Proskuryakov 2013-05-17 21:54:32 PDT
Comment on attachment 202124 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=202124&action=review

> Source/WebKit2/ChangeLog:26
> +        At this time, there is no known use for the elements themselves, so don't bother piping
> +        that through to the API.

Hmm. I wonder if checks in injected bundle will be efficient enough without knowing the elements. These calls might be made frequently on certain pages.
Comment 3 Jessie Berlin 2013-05-20 15:45:50 PDT
(In reply to comment #2)
> (From update of attachment 202124 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=202124&action=review
> 
> > Source/WebKit2/ChangeLog:26
> > +        At this time, there is no known use for the elements themselves, so don't bother piping
> > +        that through to the API.
> 
> Hmm. I wonder if checks in injected bundle will be efficient enough without knowing the elements. These calls might be made frequently on certain pages.

Thanks for the review! I discussed this further with you and others, and decided to add the elements. New patch coming momentarily.
Comment 4 Jessie Berlin 2013-05-20 15:47:46 PDT
Created attachment 202328 [details]
Patch (version 2)
Comment 5 Alexey Proskuryakov 2013-05-20 15:53:28 PDT
Comment on attachment 202328 [details]
Patch (version 2)

View in context: https://bugs.webkit.org/attachment.cgi?id=202328&action=review

> Source/WebKit2/ChangeLog:20
> +        (InjectedBundlePageFormClient):

It's best to remove such unhelpful lines from ChangeLogs (it's a bug in the tool that it generates them).

> Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:133
> +    unsigned size = elements.size();

The type should be size_t.

> Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:135
> +    Vector<RefPtr<APIObject> > elementHandles;

We are now using C++11 ">>" in WebKit2 code (as well as in all Mac code).

> Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:138
> +    for (unsigned i = 0; i < size; ++i)

size_t

> Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h:59
> +    void didAssociateFormControls(WebPage*, const Vector<RefPtr<WebCore::Element> >&);

Same comment about ">>".

> Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp:719
> +void WebChromeClient::didAssociateFormControls(const Vector<RefPtr<WebCore::Element> >& elements)

Ditto.

> Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h:173
> +    virtual void didAssociateFormControls(const Vector<RefPtr<WebCore::Element> >&) OVERRIDE;

Ditto.

> Tools/TestWebKitAPI/Tests/WebKit2/DidAssociateFormControls_Bundle.cpp:39
> +    virtual void didCreatePage(WKBundleRef, WKBundlePageRef);

OVERRIDE?
Comment 6 Jessie Berlin 2013-05-20 16:14:25 PDT
(In reply to comment #5)
> (From update of attachment 202328 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=202328&action=review
> 
> > Source/WebKit2/ChangeLog:20
> > +        (InjectedBundlePageFormClient):
> 
> It's best to remove such unhelpful lines from ChangeLogs (it's a bug in the tool that it generates them).

Done.

> 
> > Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:133
> > +    unsigned size = elements.size();
> 
> The type should be size_t.

Done.

> 
> > Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:135
> > +    Vector<RefPtr<APIObject> > elementHandles;
> 
> We are now using C++11 ">>" in WebKit2 code (as well as in all Mac code).

I initially had that, but check-webkit-style complained. I fixed this and Filed https://bugs.webkit.org/show_bug.cgi?id=116474

> 
> > Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:138
> > +    for (unsigned i = 0; i < size; ++i)
> 
> size_t

Done.

> 
> > Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h:59
> > +    void didAssociateFormControls(WebPage*, const Vector<RefPtr<WebCore::Element> >&);
> 
> Same comment about ">>”.

Done.

> 
> > Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp:719
> > +void WebChromeClient::didAssociateFormControls(const Vector<RefPtr<WebCore::Element> >& elements)
> 
> Ditto.

Done.

> 
> > Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h:173
> > +    virtual void didAssociateFormControls(const Vector<RefPtr<WebCore::Element> >&) OVERRIDE;
> 
> Ditto.

Done.

> 
> > Tools/TestWebKitAPI/Tests/WebKit2/DidAssociateFormControls_Bundle.cpp:39
> > +    virtual void didCreatePage(WKBundleRef, WKBundlePageRef);
> 
> OVERRIDE?

Done.

Thanks for the review!
Comment 7 Jessie Berlin 2013-05-20 19:08:49 PDT
Comment on attachment 202328 [details]
Patch (version 2)

Committed with the changes mentioned above in http://trac.webkit.org/changeset/150398