Changeset 133396 in webkit


Ignore:
Timestamp:
Nov 3, 2012 9:08:40 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Implement HTMLFormElement#requestAutocomplete and associated events
https://bugs.webkit.org/show_bug.cgi?id=100557

Patch by Dan Beam <dbeam@chromium.org> on 2012-11-03
Reviewed by Adam Barth.

Source/WebCore:

Implements an initial version of the proposal for interactive autocomplete outlined in this email:
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-October/037711.html

The goal of this patch is to allow web authors to call formElement.requestAutocomplete(); after subscribing for
autocomplete/autocompleteerror events on formElement. If the form's [autocomplete] attribute is "off" an
error will be dispatched. Otherwise, a request will be issued to the FrameLoaderClient. At the moment, the
implementation in Chrome (https://codereview.chromium.org/11270018/) will simply dispatch an error until the
UI on Chrome's side is built. Both autocomplete and autocompleteerror events will be dispatched asynchronously
after a small delay to behave consistently in all situations and implementations.

Currently this is behind the feature flag REQUEST_AUTOCOMPLETE, which is disabled.

Test: fast/forms/form-request-autocomplete.html

  • dom/EventNames.h:

(WebCore):

Added autocomplete and autocompleteerror events. The autocomplete event is dispatched after a user adds more
information to a form using the future UI. This is not currently dispatched in any implementation (including Chrome)
but will be in the future. The autocompleteerror event is dispatched when the form has [autocomplete="off"] on the
node being asked for an interactive autocomplete. The user agent may also dispatch this event if it doesn't implement
this API but has turned on the feature flag, can't currently show an autocomplete UI (e.g. running headlessly or in
an HTML notification, security concerns, or any other reason it desires).

  • html/HTMLAttributeNames.in:

Added onautocomplete and onautocompleteerror attributes so they can be parsed when creating form elements and used
as event listeners. For example:

<form onautocomplete="/* when autocomplete succeeds */" autocompleteerror="/* when autocomplete fails */">

  • html/HTMLFormElement.cpp:

(WebCore::HTMLFormElement::HTMLFormElement):
(WebCore):

Added m_requestAutocompleteTimer (a timer that's used to dispatch events asynchronously) to the initializer list that
triggers requestAutocompleteTimerFired when it times out.

(WebCore::HTMLFormElement::requestAutocomplete):

Called when HTMLFormElement#requestAutocomplete is called from JS (also see HTMLFormElement.idl) and decides whether
to dispatch an error and exit early (in the case where autocomplete="off") or pass the request on to the
FrameLoaderClient.

(WebCore::HTMLFormElement::finishRequestAutocomplete):

Called when the request for an interactive autocomplete is finished with either a success or error result. This
causes an event to queue and fired after a 0 second delay. Events are owned by HTMLFormElement and reference the
target element (this) until fired.

(WebCore::HTMLFormElement::requestAutocompleteTimerFired):

Called when the event timer runs out to pump the queue of current events. Events are released on dispatch.

(WebCore::HTMLFormElement::parseAttribute):

Encountering onautocomplete or onautocompleteerror attributes while parsing HTMLFormElements now adds event listeners
for autocomplete an autocompleteerror events (respectively) to dispatch the value of the attribute as a script.

  • html/HTMLFormElement.h:

(HTMLFormElement):

Added various methods and data members as required by the implementation.

  • html/HTMLFormElement.idl:

Added the method requestAutocomplete and associated DOM event handler attributes (onautocomplete/onautocompleteerror)
to HTMLFormElement's public DOM API (unprefixed, as per Ian Hickson's advice). All are require the Conditional
REQUEST_AUTOCOMPLETE to be enabled to be activated.

  • loader/EmptyClients.cpp:

(WebCore):
(WebCore::EmptyFrameLoaderClient::didRequestAutocomplete):

Added noop implementation for FrameLoader::didRequestAutocomplete.

  • loader/EmptyClients.h:

(EmptyFrameLoaderClient):

Added FrameLoader::didRequestAutocomplete to EmptyFrameLoaderClient interface.

  • loader/FrameLoaderClient.h:

(FrameLoaderClient):

Added noop implementation to FrameLoaderClient interface (which is implemented chromium's FrameLoaderLoaderImpl.cpp).

Source/WebKit/chromium:

Implements an initial version of the proposal for interactive autocomplete outlined in this email:
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-October/037711.html

The goal of this patch is to allow web authors to call formElement.requestAutocomplete(); after subscribing for
autocomplete/autocompleteerror events on formElement. If the form's [autocomplete] attribute is "off" an
error will be dispatched. Otherwise, a request will be issued to the FrameLoaderClient. At the moment, the
implementation in Chrome (https://codereview.chromium.org/11270018/) will simply dispatch an error until the
UI on Chrome's side is built. Both autocomplete and autocompleteerror events will be dispatched asynchronously
after a small delay to behave consistently in all situations and implementations.

Currently this is behind the feature flag REQUEST_AUTOCOMPLETE, which is disabled.

Test: fast/forms/form-request-autocomplete.html

  • public/WebAutofillClient.h:

(WebKit):
(WebAutofillClient):
(WebKit::WebAutofillClient::didRequestAutocomplete):

Added WebAutofillClient::didRequestAutocomplete to chrome's public WebKit interface.

  • public/WebFormElement.h:

Added an enum that matches HTMLFormElement::AutocompleteResult (and added compile time assert) and a public method
(WebFormElement::finishRequestAutocomplete) to WebFormElement's public interface.

  • src/AssertMatchingEnums.cpp:

Added a compile time assert to guarantee the HTMLFormElement::AutocompleteResult enum matches the
WebFormElement::AutocompleteResult enum.

  • src/FrameLoaderClientImpl.cpp:

(WebKit):
(WebKit::FrameLoaderClientImpl::didRequestAutocomplete):

Implemented the added FrameLoaderClient::didRequestAutocomplete, which simply passes through to the
WebAutofillClient.

  • src/FrameLoaderClientImpl.h:

(FrameLoaderClientImpl):

Implementing FrameLoaderClient::didRequestAutocomplete.

  • src/WebFormElement.cpp:

(WebKit::WebFormElement::finishRequestAutocomplete):
(WebKit):

Added WebFormElement::finishRequestAutocomplete to allow chromium's renderer a public API to call to finish the
autocomplete request on a WebFormElement.

LayoutTests:

Adds tests for an initial implementation of the proposal for interactive autocomplete outlined in this email:
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-October/037711.html

The goal of this patch is to allow web authors to call formElement.requestAutocomplete(); after subscribing
for autocomplete/autocompleteerror events on formElement. If the form's [autocomplete] attribute is "off" an
error will be dispatched. Otherwise, a request will be issued to the FrameLoaderClient. At the moment, the
implementation in Chrome (https://codereview.chromium.org/11270018/) will simply dispatch an error until the
UI on Chrome's side is built. Both autocomplete and autocompleteerror events will be dispatched asynchronously
after a small delay to behave consistently in all situations and implementations.

Currently the implementation is behind the feature flag REQUEST_AUTOCOMPLETE, which is disabled, so the test
is expected to fail. This test verifies that currently no client implements this method on HTMLFormElement
(HTMLFormElement#requestAutocomplete) and returns. When the chrome-side lands I'll add a success case in
LayoutTests/platform/chromium/fast/forms/ with the expected successful results.

  • fast/forms/form-request-autocomplete-expected.txt: Added.
  • fast/forms/form-request-autocomplete.html: Added.
Location:
trunk
Files:
2 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r133395 r133396  
     12012-11-03  Dan Beam  <dbeam@chromium.org>
     2
     3        Implement HTMLFormElement#requestAutocomplete and associated events
     4        https://bugs.webkit.org/show_bug.cgi?id=100557
     5
     6        Reviewed by Adam Barth.
     7
     8        Adds tests for an initial implementation of the proposal for interactive autocomplete outlined in this email:
     9        http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-October/037711.html
     10
     11        The goal of this patch is to allow web authors to call formElement.requestAutocomplete(); after subscribing
     12        for autocomplete/autocompleteerror events on formElement. If the form's [autocomplete] attribute is "off" an
     13        error will be dispatched. Otherwise, a request will be issued to the FrameLoaderClient. At the moment, the
     14        implementation in Chrome (https://codereview.chromium.org/11270018/) will simply dispatch an error until the
     15        UI on Chrome's side is built. Both autocomplete and autocompleteerror events will be dispatched asynchronously
     16        after a small delay to behave consistently in all situations and implementations.
     17
     18        Currently the implementation is behind the feature flag REQUEST_AUTOCOMPLETE, which is disabled, so the test
     19        is expected to fail. This test verifies that currently no client implements this method on HTMLFormElement
     20        (HTMLFormElement#requestAutocomplete) and returns. When the chrome-side lands I'll add a success case in
     21        LayoutTests/platform/chromium/fast/forms/ with the expected successful results.
     22
     23        * fast/forms/form-request-autocomplete-expected.txt: Added.
     24        * fast/forms/form-request-autocomplete.html: Added.
     25
    1262012-11-03  Pavel Feldman  <pfeldman@chromium.org>
    227
  • trunk/Source/WebCore/ChangeLog

    r133395 r133396  
     12012-11-03  Dan Beam  <dbeam@chromium.org>
     2
     3        Implement HTMLFormElement#requestAutocomplete and associated events
     4        https://bugs.webkit.org/show_bug.cgi?id=100557
     5
     6        Reviewed by Adam Barth.
     7
     8        Implements an initial version of the proposal for interactive autocomplete outlined in this email:
     9        http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-October/037711.html
     10
     11        The goal of this patch is to allow web authors to call formElement.requestAutocomplete(); after subscribing for
     12        autocomplete/autocompleteerror events on formElement. If the form's [autocomplete] attribute is "off" an
     13        error will be dispatched. Otherwise, a request will be issued to the FrameLoaderClient.  At the moment, the
     14        implementation in Chrome (https://codereview.chromium.org/11270018/) will simply dispatch an error until the
     15        UI on Chrome's side is built. Both autocomplete and autocompleteerror events will be dispatched asynchronously
     16        after a small delay to behave consistently in all situations and implementations.
     17
     18        Currently this is behind the feature flag REQUEST_AUTOCOMPLETE, which is disabled.
     19
     20        Test: fast/forms/form-request-autocomplete.html
     21
     22        * dom/EventNames.h:
     23        (WebCore):
     24
     25        Added autocomplete and autocompleteerror events. The autocomplete event is dispatched after a user adds more
     26        information to a form using the future UI. This is not currently dispatched in any implementation (including Chrome)
     27        but will be in the future. The autocompleteerror event is dispatched when the form has [autocomplete="off"] on the
     28        node being asked for an interactive autocomplete. The user agent may also dispatch this event if it doesn't implement
     29        this API but has turned on the feature flag, can't currently show an autocomplete UI (e.g. running headlessly or in
     30        an HTML notification, security concerns, or any other reason it desires).
     31
     32        * html/HTMLAttributeNames.in:
     33
     34        Added onautocomplete and onautocompleteerror attributes so they can be parsed when creating form elements and used
     35        as event listeners. For example:
     36
     37          <form onautocomplete="/* when autocomplete succeeds */" autocompleteerror="/* when autocomplete fails */">
     38
     39        * html/HTMLFormElement.cpp:
     40        (WebCore::HTMLFormElement::HTMLFormElement):
     41        (WebCore):
     42
     43        Added m_requestAutocompleteTimer (a timer that's used to dispatch events asynchronously) to the initializer list that
     44        triggers requestAutocompleteTimerFired when it times out.
     45
     46        (WebCore::HTMLFormElement::requestAutocomplete):
     47
     48        Called when HTMLFormElement#requestAutocomplete is called from JS (also see HTMLFormElement.idl) and decides whether
     49        to dispatch an error and exit early (in the case where autocomplete="off") or pass the request on to the
     50        FrameLoaderClient.
     51
     52        (WebCore::HTMLFormElement::finishRequestAutocomplete):
     53
     54        Called when the request for an interactive autocomplete is finished with either a success or error result. This
     55        causes an event to queue and fired after a 0 second delay. Events are owned by HTMLFormElement and reference the
     56        target element (this) until fired.
     57
     58        (WebCore::HTMLFormElement::requestAutocompleteTimerFired):
     59
     60        Called when the event timer runs out to pump the queue of current events. Events are released on dispatch.
     61
     62        (WebCore::HTMLFormElement::parseAttribute):
     63
     64        Encountering onautocomplete or onautocompleteerror attributes while parsing HTMLFormElements now adds event listeners
     65        for autocomplete an autocompleteerror events (respectively) to dispatch the value of the attribute as a script.
     66
     67        * html/HTMLFormElement.h:
     68        (HTMLFormElement):
     69
     70        Added various methods and data members as required by the implementation.
     71
     72        * html/HTMLFormElement.idl:
     73
     74        Added the method requestAutocomplete and associated DOM event handler attributes (onautocomplete/onautocompleteerror)
     75        to HTMLFormElement's public DOM API (unprefixed, as per Ian Hickson's advice). All are require the Conditional
     76        REQUEST_AUTOCOMPLETE to be enabled to be activated.
     77
     78        * loader/EmptyClients.cpp:
     79        (WebCore):
     80        (WebCore::EmptyFrameLoaderClient::didRequestAutocomplete):
     81
     82        Added noop implementation for FrameLoader::didRequestAutocomplete.
     83
     84        * loader/EmptyClients.h:
     85        (EmptyFrameLoaderClient):
     86
     87        Added FrameLoader::didRequestAutocomplete to EmptyFrameLoaderClient interface.
     88
     89        * loader/FrameLoaderClient.h:
     90        (FrameLoaderClient):
     91
     92        Added noop implementation to FrameLoaderClient interface (which is implemented chromium's FrameLoaderLoaderImpl.cpp).
     93
    1942012-11-03  Pavel Feldman  <pfeldman@chromium.org>
    295
  • trunk/Source/WebCore/dom/EventNames.h

    r131372 r133396  
    244244    macro(webkitdeviceproximity) \
    245245    \
     246    macro(autocomplete) \
     247    macro(autocompleteerror) \
     248    \
    246249
    247250// end of DOM_EVENT_NAMES_FOR_EACH
  • trunk/Source/WebCore/html/HTMLAttributeNames.in

    r133268 r133396  
    166166object
    167167onabort
     168onautocomplete
     169onautocompleteerror
    168170onbeforecopy
    169171onbeforecut
  • trunk/Source/WebCore/html/HTMLFormElement.cpp

    r133053 r133396  
    7575    , m_isInResetFunction(false)
    7676    , m_wasDemoted(false)
     77#if ENABLE(REQUEST_AUTOCOMPLETE)
     78    , m_requestAutocompleteTimer(this, &HTMLFormElement::requestAutocompleteTimerFired)
     79#endif
    7780{
    7881    ASSERT(hasTagName(formTag));
     
    387390    m_isInResetFunction = false;
    388391}
     392
     393#if ENABLE(REQUEST_AUTOCOMPLETE)
     394void HTMLFormElement::requestAutocomplete()
     395{
     396    Frame* frame = document()->frame();
     397    if (!frame)
     398        return;
     399
     400    if (!shouldAutocomplete()) {
     401        finishRequestAutocomplete(AutocompleteResultError);
     402        return;
     403    }
     404
     405    StringPairVector controlNamesAndValues;
     406    getTextFieldValues(controlNamesAndValues);
     407    RefPtr<FormState> formState = FormState::create(this, controlNamesAndValues, document(), SubmittedByJavaScript);
     408    frame->loader()->client()->didRequestAutocomplete(formState.release());
     409}
     410
     411void HTMLFormElement::finishRequestAutocomplete(AutocompleteResult result)
     412{
     413    RefPtr<Event> event(Event::create(result == AutocompleteResultSuccess ? eventNames().autocompleteEvent : eventNames().autocompleteerrorEvent, false, false));
     414    event->setTarget(this);
     415    m_pendingAutocompleteEvents.append(event.release());
     416
     417    // Dispatch events later as this API is meant to work asynchronously in all situations and implementations.
     418    if (!m_requestAutocompleteTimer.isActive())
     419        m_requestAutocompleteTimer.startOneShot(0);
     420}
     421
     422void HTMLFormElement::requestAutocompleteTimerFired(Timer<HTMLFormElement>*)
     423{
     424    Vector<RefPtr<Event> > pendingEvents;
     425    m_pendingAutocompleteEvents.swap(pendingEvents);
     426    for (size_t i = 0; i < pendingEvents.size(); ++i)
     427        dispatchEvent(pendingEvents[i].release());
     428}
     429#endif
    389430
    390431void HTMLFormElement::parseAttribute(const Attribute& attribute)
     
    409450    else if (attribute.name() == onresetAttr)
    410451        setAttributeEventListener(eventNames().resetEvent, createAttributeEventListener(this, attribute));
     452#if ENABLE(REQUEST_AUTOCOMPLETE)
     453    else if (attribute.name() == onautocompleteAttr)
     454        setAttributeEventListener(eventNames().autocompleteEvent, createAttributeEventListener(this, attribute));
     455    else if (attribute.name() == onautocompleteerrorAttr)
     456        setAttributeEventListener(eventNames().autocompleteerrorEvent, createAttributeEventListener(this, attribute));
     457#endif
    411458    else
    412459        HTMLElement::parseAttribute(attribute);
  • trunk/Source/WebCore/html/HTMLFormElement.h

    r130461 r133396  
    100100    bool checkValidity();
    101101
     102#if ENABLE(REQUEST_AUTOCOMPLETE)
     103    enum AutocompleteResult { AutocompleteResultSuccess, AutocompleteResultError };
     104
     105    void requestAutocomplete();
     106    void finishRequestAutocomplete(AutocompleteResult);
     107
     108    DEFINE_ATTRIBUTE_EVENT_LISTENER(autocomplete);
     109    DEFINE_ATTRIBUTE_EVENT_LISTENER(autocompleteerror);
     110#endif
     111
    102112    HTMLFormControlElement* elementForAlias(const AtomicString&);
    103113    void addElementAlias(HTMLFormControlElement*, const AtomicString& alias);
     
    163173
    164174    bool m_wasDemoted;
     175
     176#if ENABLE(REQUEST_AUTOCOMPLETE)
     177    void requestAutocompleteTimerFired(Timer<HTMLFormElement>*);
     178
     179    Vector<RefPtr<Event> > m_pendingAutocompleteEvents;
     180    Timer<HTMLFormElement> m_requestAutocompleteTimer;
     181#endif
    165182};
    166183
  • trunk/Source/WebCore/html/HTMLFormElement.idl

    r131172 r133396  
    4343    void reset();
    4444    boolean checkValidity();
     45
     46    [Conditional=REQUEST_AUTOCOMPLETE] void requestAutocomplete();
     47    [NotEnumerable, Conditional=REQUEST_AUTOCOMPLETE] attribute EventListener onautocomplete;
     48    [NotEnumerable, Conditional=REQUEST_AUTOCOMPLETE] attribute EventListener onautocompleteerror;
    4549};
  • trunk/Source/WebCore/loader/EmptyClients.cpp

    r133284 r133396  
    195195#endif
    196196
    197 }
     197#if ENABLE(REQUEST_AUTOCOMPLETE)
     198void EmptyFrameLoaderClient::didRequestAutocomplete(PassRefPtr<FormState>)
     199{
     200}
     201#endif
     202
     203}
  • trunk/Source/WebCore/loader/EmptyClients.h

    r133284 r133396  
    385385    virtual void dispatchIntent(PassRefPtr<IntentRequest>) OVERRIDE;
    386386#endif
     387
     388#if ENABLE(REQUEST_AUTOCOMPLETE)
     389    virtual void didRequestAutocomplete(PassRefPtr<FormState>) OVERRIDE;
     390#endif
    387391};
    388392
  • trunk/Source/WebCore/loader/FrameLoaderClient.h

    r130977 r133396  
    350350        virtual void dispatchWillStartUsingPeerConnectionHandler(RTCPeerConnectionHandler*) { }
    351351#endif
     352
     353#if ENABLE(REQUEST_AUTOCOMPLETE)
     354        virtual void didRequestAutocomplete(PassRefPtr<FormState>) = 0;
     355#endif
    352356    };
    353357
  • trunk/Source/WebKit/chromium/ChangeLog

    r133338 r133396  
     12012-11-03  Dan Beam  <dbeam@chromium.org>
     2
     3        Implement HTMLFormElement#requestAutocomplete and associated events
     4        https://bugs.webkit.org/show_bug.cgi?id=100557
     5
     6        Reviewed by Adam Barth.
     7
     8        Implements an initial version of the proposal for interactive autocomplete outlined in this email:
     9        http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-October/037711.html
     10
     11        The goal of this patch is to allow web authors to call formElement.requestAutocomplete(); after subscribing for
     12        autocomplete/autocompleteerror events on formElement. If the form's [autocomplete] attribute is "off" an
     13        error will be dispatched. Otherwise, a request will be issued to the FrameLoaderClient.  At the moment, the
     14        implementation in Chrome (https://codereview.chromium.org/11270018/) will simply dispatch an error until the
     15        UI on Chrome's side is built. Both autocomplete and autocompleteerror events will be dispatched asynchronously
     16        after a small delay to behave consistently in all situations and implementations.
     17
     18        Currently this is behind the feature flag REQUEST_AUTOCOMPLETE, which is disabled.
     19
     20        Test: fast/forms/form-request-autocomplete.html
     21
     22        * public/WebAutofillClient.h:
     23        (WebKit):
     24        (WebAutofillClient):
     25        (WebKit::WebAutofillClient::didRequestAutocomplete):
     26
     27        Added WebAutofillClient::didRequestAutocomplete to chrome's public WebKit interface.
     28
     29        * public/WebFormElement.h:
     30
     31        Added an enum that matches HTMLFormElement::AutocompleteResult (and added compile time assert) and a public method
     32        (WebFormElement::finishRequestAutocomplete) to WebFormElement's public interface.
     33
     34        * src/AssertMatchingEnums.cpp:
     35
     36        Added a compile time assert to guarantee the HTMLFormElement::AutocompleteResult enum matches the
     37        WebFormElement::AutocompleteResult enum.
     38
     39        * src/FrameLoaderClientImpl.cpp:
     40        (WebKit):
     41        (WebKit::FrameLoaderClientImpl::didRequestAutocomplete):
     42
     43        Implemented the added FrameLoaderClient::didRequestAutocomplete, which simply passes through to the
     44        WebAutofillClient.
     45
     46        * src/FrameLoaderClientImpl.h:
     47        (FrameLoaderClientImpl):
     48
     49        Implementing FrameLoaderClient::didRequestAutocomplete.
     50
     51        * src/WebFormElement.cpp:
     52        (WebKit::WebFormElement::finishRequestAutocomplete):
     53        (WebKit):
     54
     55        Added WebFormElement::finishRequestAutocomplete to allow chromium's renderer a public API to call to finish the
     56        autocomplete request on a WebFormElement.
     57
    1582012-11-02  Anders Carlsson  <andersca@apple.com>
    259
  • trunk/Source/WebKit/chromium/public/WebAutofillClient.h

    r114223 r133396  
    3434namespace WebKit {
    3535
     36class WebFormElement;
     37class WebFrame;
    3638class WebInputElement;
    3739class WebKeyboardEvent;
     
    7678    virtual void didClearAutofillSelection(const WebNode&) { }
    7779
     80    // Informs the browser an interactive autocomplete has been requested.
     81    virtual void didRequestAutocomplete(WebFrame*, const WebFormElement&) { }
     82
    7883    // Instructs the browser to remove the Autocomplete entry specified from
    7984    // its DB.
  • trunk/Source/WebKit/chromium/public/WebFormElement.h

    r101122 r133396  
    7070        WEBKIT_EXPORT void getFormControlElements(WebVector<WebFormControlElement>&) const;
    7171
     72        enum AutocompleteResult { AutocompleteResultSuccess, AutocompleteResultError };
     73        WEBKIT_EXPORT void finishRequestAutocomplete(WebFormElement::AutocompleteResult);
     74
    7275#if WEBKIT_IMPLEMENTATION
    7376        WebFormElement(const WTF::PassRefPtr<WebCore::HTMLFormElement>&);
  • trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp

    r133095 r133396  
    4949#include "GeolocationError.h"
    5050#include "GeolocationPosition.h"
     51#if ENABLE(REQUEST_AUTOCOMPLETE)
     52#include "HTMLFormElement.h"
     53#endif
    5154#include "HTMLInputElement.h"
    5255#include "IDBCursor.h"
     
    8790#include "WebFileInfo.h"
    8891#include "WebFontDescription.h"
     92#if ENABLE(REQUEST_AUTOCOMPLETE)
     93#include "WebFormElement.h"
     94#endif
    8995#include "WebGeolocationError.h"
    9096#include "WebGeolocationPosition.h"
     
    634640COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::CORSModeAnonymous, MediaPlayerClient::Anonymous);
    635641COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::CORSModeUseCredentials, MediaPlayerClient::UseCredentials);
     642
     643#if ENABLE(REQUEST_AUTOCOMPLETE)
     644COMPILE_ASSERT_MATCHING_ENUM(WebFormElement::AutocompleteResultSuccess, HTMLFormElement::AutocompleteResultSuccess);
     645COMPILE_ASSERT_MATCHING_ENUM(WebFormElement::AutocompleteResultError, HTMLFormElement::AutocompleteResultError);
     646#endif
  • trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp

    r132478 r133396  
    6363#include "Settings.h"
    6464#include "SocketStreamHandleInternal.h"
     65#if ENABLE(REQUEST_AUTOCOMPLETE)
     66#include "WebAutofillClient.h"
     67#endif
    6568#include "WebDOMEvent.h"
    6669#include "WebDataSourceImpl.h"
     
    16521655#endif
    16531656
     1657#if ENABLE(REQUEST_AUTOCOMPLETE)
     1658void FrameLoaderClientImpl::didRequestAutocomplete(PassRefPtr<FormState> formState)
     1659{
     1660    if (m_webFrame->viewImpl() && m_webFrame->viewImpl()->autofillClient())
     1661        m_webFrame->viewImpl()->autofillClient()->didRequestAutocomplete(m_webFrame, WebFormElement(formState->form()));
     1662}
     1663#endif
    16541664
    16551665} // namespace WebKit
  • trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.h

    r130977 r133396  
    226226#endif
    227227
     228#if ENABLE(REQUEST_AUTOCOMPLETE)
     229    virtual void didRequestAutocomplete(PassRefPtr<WebCore::FormState>) OVERRIDE;
     230#endif
     231
    228232private:
    229233    void makeDocumentView();
  • trunk/Source/WebKit/chromium/src/WebFormElement.cpp

    r130530 r133396  
    103103}
    104104
     105void WebFormElement::finishRequestAutocomplete(WebFormElement::AutocompleteResult result)
     106{
     107#if ENABLE(REQUEST_AUTOCOMPLETE)
     108    unwrap<HTMLFormElement>()->finishRequestAutocomplete(static_cast<HTMLFormElement::AutocompleteResult>(result));
     109#endif
     110}
     111
    105112WebFormElement::WebFormElement(const PassRefPtr<HTMLFormElement>& e)
    106113    : WebElement(e)
Note: See TracChangeset for help on using the changeset viewer.