Changeset 146919 in webkit


Ignore:
Timestamp:
Mar 26, 2013, 12:41:45 PM (12 years ago)
Author:
kareng@chromium.org
Message:

Revert 146672 "Add client callbacks to notify of changes of asso..."

Add client callbacks to notify of changes of associated from controls
https://bugs.webkit.org/show_bug.cgi?id=110375

Patch by Dane Wallinga <dgwallinga@chromium.org> on 2013-03-22
Reviewed by Ryosuke Niwa.

Source/WebCore:

Hook FormAssociatedElement, HTMLFormElement to notify EditorClient of form changes after a page has loaded.
Will be used to add autofill support for ajax-y webpages. e.g if while filling out a form, new fields
are dynamically created, autofill can know to re-query the autofill server and keep going.
https://bugs.webkit.org/show_bug.cgi?id=110375

  • dom/Document.cpp:

(WebCore::Document::Document):
(WebCore::Document::didAssociateFormControl):
(WebCore):
(WebCore::Document::didAssociateFormControlsTimerFired):

  • dom/Document.h:

(Document):
added method didAssociateFormControl, which batches form changes
and calls out to ChromeClient on a timer.

  • html/FormAssociatedElement.cpp:

(WebCore::FormAssociatedElement::resetFormOwner):
(WebCore::FormAssociatedElement::formAttributeChanged):
(WebCore):

  • html/FormAssociatedElement.h:

(FormAssociatedElement):
add calls to Document::didAssociateFormControl when form changes

  • html/HTMLFormElement.cpp:

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

  • html/HTMLFormElement.h:

add call to Document::didAssociateFormControl

  • loader/EmptyClients.h:

(EmptyChromeClient):
(WebCore::EmptyChromeClient::didAssociateFormControls):
(WebCore::EmptyChromeClient::shouldNotifyOnFormChanges):

  • page/ChromeClient.h:

(ChromeClient):
add new method didAssociateFormControls

Source/WebKit/chromium:

Implement form association methods of ChromeClient
to inform autofill of form changes after a page has loaded

  • public/WebAutofillClient.h:

(WebAutofillClient):
(WebKit::WebAutofillClient::didAssociateInput):
(WebKit::WebAutofillClient::didAddForm):
(WebKit::WebAutofillClient::didAssociateFormControls):

  • src/ChromeClientImpl.cpp:

(WebKit::ChromeClientImpl::didAssociateFormControls):
(WebKit):
(WebKit::ChromeClientImpl::shouldNotifyOnFormChanges):

  • src/ChromeClientImpl.h:

(ChromeClientImpl):

TBR=commit-queue@webkit.org
Review URL: https://codereview.chromium.org/12670015

Location:
branches/chromium/1453/Source
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/chromium/1453/Source/WebCore/dom/Document.cpp

    r146891 r146919  
    497497    , m_fontloader(0)
    498498#endif
    499     , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsTimerFired)
    500499{
    501500    m_printing = false;
     
    61616160#endif
    61626161
    6163 void Document::didAssociateFormControl(Element* element)
    6164 {
    6165     if (!frame() || !frame()->page() || !frame()->page()->chrome()->client()->shouldNotifyOnFormChanges())
    6166         return;
    6167     m_associatedFormControls.add(element);
    6168     if (!m_didAssociateFormControlsTimer.isActive())
    6169         m_didAssociateFormControlsTimer.startOneShot(0);
    6170 }
    6171 
    6172 void Document::didAssociateFormControlsTimerFired(Timer<Document>* timer)
    6173 {
    6174     ASSERT_UNUSED(timer, timer == &m_didAssociateFormControlsTimer);
    6175     if (!frame() || !frame()->page())
    6176         return;
    6177 
    6178     Vector<Element*> associatedFormControls;
    6179     copyToVector(m_associatedFormControls, associatedFormControls);
    6180 
    6181     frame()->page()->chrome()->client()->didAssociateFormControls(associatedFormControls);
    6182     m_associatedFormControls.clear();
    6183 }
    6184 
    61856162} // namespace WebCore
  • branches/chromium/1453/Source/WebCore/dom/Document.h

    r146891 r146919  
    5353#include <wtf/Deque.h>
    5454#include <wtf/FixedArray.h>
    55 #include <wtf/HashSet.h>
    5655#include <wtf/OwnPtr.h>
    5756#include <wtf/PassOwnPtr.h>
     
    12111210#endif
    12121211
    1213     void didAssociateFormControl(Element*);
    1214 
    12151212    virtual void addConsoleMessage(MessageSource, MessageLevel, const String& message, unsigned long requestIdentifier = 0);
    12161213
     
    13001297    void addListenerType(ListenerType listenerType) { m_listenerTypes |= listenerType; }
    13011298    void addMutationEventListenerTypeIfEnabled(ListenerType);
    1302 
    1303     void didAssociateFormControlsTimerFired(Timer<Document>*);
    13041299
    13051300    void styleResolverThrowawayTimerFired(Timer<Document>*);
     
    15981593    RefPtr<FontLoader> m_fontloader;
    15991594#endif
    1600 
    1601     Timer<Document> m_didAssociateFormControlsTimer;
    1602     HashSet<Element*> m_associatedFormControls;
    1603 
    16041595};
    16051596
  • branches/chromium/1453/Source/WebCore/html/FormAssociatedElement.cpp

    r146672 r146919  
    2626#include "FormAssociatedElement.h"
    2727
    28 #include "EditorClient.h"
    2928#include "FormController.h"
    30 #include "Frame.h"
    3129#include "HTMLFormControlElement.h"
    3230#include "HTMLFormElement.h"
     
    160158void FormAssociatedElement::resetFormOwner()
    161159{
    162     HTMLFormElement* originalForm = m_form;
    163160    setForm(findAssociatedForm(toHTMLElement(this), m_form));
    164     HTMLElement* element = toHTMLElement(this);     
    165     if (m_form && m_form != originalForm && m_form->inDocument())
    166         element->document()->didAssociateFormControl(element);
    167161}
    168162
     
    172166    if (!element->fastHasAttribute(formAttr)) {
    173167        // The form attribute removed. We need to reset form owner here.
    174         HTMLFormElement* originalForm = m_form;
    175168        setForm(element->findFormAncestor());
    176         HTMLElement* element = toHTMLElement(this);
    177         if (m_form && m_form != originalForm && m_form->inDocument())
    178             element->document()->didAssociateFormControl(element);
    179169        m_formAttributeTargetObserver = nullptr;
    180170    } else {
  • branches/chromium/1453/Source/WebCore/html/HTMLFormElement.cpp

    r146672 r146919  
    140140{
    141141    HTMLElement::insertedInto(insertionPoint);
    142     if (insertionPoint->inDocument())
    143         this->document()->didAssociateFormControl(this);
    144142    return InsertionDone;
    145143}
  • branches/chromium/1453/Source/WebCore/loader/EmptyClients.h

    r146672 r146919  
    209209   
    210210    virtual bool isEmptyChromeClient() const { return true; }
    211 
    212     virtual void didAssociateFormControls(const Vector<Element*>&) { }
    213     virtual bool shouldNotifyOnFormChanges() { return false; }
    214211};
    215212
  • branches/chromium/1453/Source/WebCore/page/ChromeClient.h

    r146672 r146919  
    383383    virtual bool shouldAutoscrollForDragAndDrop(RenderBox*) const { return false; }
    384384
    385     virtual void didAssociateFormControls(const Vector<Element*>&) { };
    386     virtual bool shouldNotifyOnFormChanges() { return false; };
    387 
    388385protected:
    389386    virtual ~ChromeClient() { }
  • branches/chromium/1453/Source/WebKit/chromium/public/WebAutofillClient.h

    r146672 r146919  
    4040class WebNode;
    4141class WebString;
    42 
    43 template <typename T> class WebVector;
    4442
    4543class WebAutofillClient {
     
    9694    virtual void setIgnoreTextChanges(bool ignore) { }
    9795
    98     virtual void didAssociateFormControls(const WebVector<WebNode>&) { }
    99 
    10096protected:
    10197    virtual ~WebAutofillClient() { }
  • branches/chromium/1453/Source/WebKit/chromium/src/ChromeClientImpl.cpp

    r146672 r146919  
    7878#include "TextFieldDecorationElement.h"
    7979#include "WebAccessibilityObject.h"
    80 #include "WebAutofillClient.h"
    8180#if ENABLE(INPUT_TYPE_COLOR)
    8281#include "WebColorChooser.h"
     
    11461145#endif
    11471146
    1148 void ChromeClientImpl::didAssociateFormControls(const Vector<Element*>& elements)
    1149 {
    1150     if (!m_webView->autofillClient())
    1151         return;
    1152     WebVector<WebNode> elementVector(static_cast<size_t>(elements.size()));
    1153     size_t elementsCount = elements.size();
    1154     for (size_t i = 0; i < elementsCount; ++i)
    1155         elementVector[i] = elements[i];
    1156     m_webView->autofillClient()->didAssociateFormControls(elementVector);
    1157 }
    1158 
    1159 bool ChromeClientImpl::shouldNotifyOnFormChanges()
    1160 {
    1161     return true;
    1162 }
    1163 
    11641147#if ENABLE(NAVIGATOR_CONTENT_UTILS)
    11651148PassOwnPtr<NavigatorContentUtilsClientImpl> NavigatorContentUtilsClientImpl::create(WebViewImpl* webView)
  • branches/chromium/1453/Source/WebKit/chromium/src/ChromeClientImpl.h

    r146672 r146919  
    235235#endif
    236236
    237     virtual void didAssociateFormControls(const Vector<WebCore::Element*>&) OVERRIDE;
    238     virtual bool shouldNotifyOnFormChanges() OVERRIDE;
    239 
    240237private:
    241238    WebNavigationPolicy getNavigationPolicy();
Note: See TracChangeset for help on using the changeset viewer.