2011-06-28 Ilya Sherman <isherman@chromium.org>
authorisherman@chromium.org <isherman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Jun 2011 06:35:41 +0000 (06:35 +0000)
committerisherman@chromium.org <isherman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Jun 2011 06:35:41 +0000 (06:35 +0000)
        Reviewed by Adam Barth.

        form.autocomplete="off" does not work
        https://bugs.webkit.org/show_bug.cgi?id=35823

        * fast/forms/autocomplete-expected.txt: Added.
        * fast/forms/autocomplete.html: Added.
2011-06-28  Ilya Sherman  <isherman@chromium.org>

        Reviewed by Adam Barth.

        form.autocomplete="off" does not work
        Rename the autoComplete() method for HTMLFormElement, HTMLFormControlElementWithState, and HTMLInputElement to shouldAutocomplete()
        Add the autocomplete attribute to HTMLFormElement.idl and HTMLInputElement.idl
        https://bugs.webkit.org/show_bug.cgi?id=35823

        Test: fast/forms/autocomplete.html

        * html/HTMLFormControlElement.cpp:
        (WebCore::HTMLFormControlElementWithState::shouldAutocomplete): Renamed from ::autoComplete()
        (WebCore::HTMLFormControlElementWithState::shouldSaveAndRestoreFormControlState): Update callsite.
        * html/HTMLFormControlElement.h:
        * html/HTMLFormElement.cpp:
        (WebCore::HTMLFormElement::~HTMLFormElement): Update callsite.
        (WebCore::HTMLFormElement::parseMappedAttribute): Update callsite.
        (WebCore::HTMLFormElement::documentDidBecomeActive): Update callsite.
        (WebCore::HTMLFormElement::willMoveToNewOwnerDocument): Update callsite.
        (WebCore::HTMLFormElement::didMoveToNewOwnerDocument): Update callsite.
        (WebCore::HTMLFormElement::shouldAutocomplete): Renamed from ::autoComplete()
        * html/HTMLFormElement.h:
        * html/HTMLFormElement.idl: Bind the autocomplete attribute to a JavaScript property.
        * html/HTMLInputElement.cpp:
        (WebCore::HTMLInputElement::shouldAutocomplete): Renamed from ::autoComplete()
        * html/HTMLInputElement.h:
        * html/HTMLInputElement.idl: Bind the autocomplete attribute to a JavaScript property.
        * WebCore.exp.in: Updated autoComplete() -> shouldAutocomplete()
2011-06-28  Ilya Sherman  <isherman@chromium.org>

        Reviewed by Adam Barth.

        form.autocomplete="off" does not work
        https://bugs.webkit.org/show_bug.cgi?id=35823

        * src/EditorClientImpl.cpp:
        (WebKit::EditorClientImpl::autofill): Update callsite.
        * src/WebFormElement.cpp:
        (WebKit::WebFormElement::autoComplete): Update callsite.
        * src/WebInputElement.cpp:
        (WebKit::WebInputElement::autoComplete): Update callsite.
        * src/WebPasswordFormUtils.cpp:
        (WebKit::findPasswordFormFields): Update callsite.
2011-06-28  Ilya Sherman  <isherman@chromium.org>

        Reviewed by Adam Barth.

        form.autocomplete="off" does not work
        https://bugs.webkit.org/show_bug.cgi?id=35823

        * WebView/WebHTMLRepresentation.mm:
        (-[WebHTMLRepresentation elementDoesAutoComplete:]): Update callsite.
2011-06-28  Ilya Sherman  <isherman@chromium.org>

        Reviewed by Adam Barth.

        form.autocomplete="off" does not work
        https://bugs.webkit.org/show_bug.cgi?id=35823

        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
        (DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId): Update callsite.
2011-06-28  Ilya Sherman  <isherman@chromium.org>

        Reviewed by Adam Barth.

        form.autocomplete="off" does not work
        https://bugs.webkit.org/show_bug.cgi?id=35823

        * WebFrame.cpp:
        (WebFrame::elementDoesAutoComplete): Updated callsite.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@89991 268f45cc-cd09-0410-ab3c-d52691b4dbfc

24 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/autocomplete-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/autocomplete.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLFormControlElement.h
Source/WebCore/html/HTMLFormElement.cpp
Source/WebCore/html/HTMLFormElement.h
Source/WebCore/html/HTMLFormElement.idl
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLInputElement.h
Source/WebCore/html/HTMLInputElement.idl
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/EditorClientImpl.cpp
Source/WebKit/chromium/src/WebFormElement.cpp
Source/WebKit/chromium/src/WebInputElement.cpp
Source/WebKit/chromium/src/WebPasswordFormUtils.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebHTMLRepresentation.mm
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebFrame.cpp

index c42a1d9..e08ad88 100644 (file)
@@ -1,3 +1,13 @@
+2011-06-28  Ilya Sherman  <isherman@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        form.autocomplete="off" does not work
+        https://bugs.webkit.org/show_bug.cgi?id=35823
+
+        * fast/forms/autocomplete-expected.txt: Added.
+        * fast/forms/autocomplete.html: Added.
+
 2011-06-28  Roland Steiner  <rolandsteiner@chromium.org>
 
         Unreviewed: change URLs in ruby layout tests to lower case in order
diff --git a/LayoutTests/fast/forms/autocomplete-expected.txt b/LayoutTests/fast/forms/autocomplete-expected.txt
new file mode 100644 (file)
index 0000000..df9b351
--- /dev/null
@@ -0,0 +1,13 @@
+This tests that the 'autocomplete' attribute of form and input elements is bound to a JavaScript property.
+
+PASS ('autocomplete' in form) is true
+PASS ('autocomplete' in field) is true
+PASS form.getAttribute('autocomplete') is null
+PASS field.getAttribute('autocomplete') is null
+PASS form.autocomplete is ""
+PASS field.autocomplete is ""
+PASS form.getAttribute('autocomplete') is "off"
+PASS field.getAttribute('autocomplete') is "off"
+PASS form.autocomplete is "on"
+PASS field.autocomplete is "on"
+
diff --git a/LayoutTests/fast/forms/autocomplete.html b/LayoutTests/fast/forms/autocomplete.html
new file mode 100644 (file)
index 0000000..c638627
--- /dev/null
@@ -0,0 +1,37 @@
+<html>
+<head>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script>
+    function test() {
+        var form = document.getElementById('form');
+        var field = document.getElementById('field');
+
+        shouldBeTrue("('autocomplete' in form)");
+        shouldBeTrue("('autocomplete' in field)");
+
+        shouldBeNull("form.getAttribute('autocomplete')");
+        shouldBeNull("field.getAttribute('autocomplete')");
+
+        shouldBeEqualToString("form.autocomplete", "");
+        shouldBeEqualToString("field.autocomplete", "");
+
+        form.autocomplete = 'off';
+        field.autocomplete = 'off';
+        shouldBeEqualToString("form.getAttribute('autocomplete')", "off");
+        shouldBeEqualToString("field.getAttribute('autocomplete')", "off");
+
+        form.setAttribute('autocomplete', 'on');
+        field.setAttribute('autocomplete', 'on');
+        shouldBeEqualToString("form.autocomplete", "on");
+        shouldBeEqualToString("field.autocomplete", "on");
+    }
+    </script>
+</head>
+<body onload="test()">
+    This tests that the 'autocomplete' attribute of form and input elements is bound to a JavaScript property.
+    <form id="form">
+        <input type="text" id="field" />
+    </form>
+    <div id="console"></div>
+</body>
+</html>
index a16b4b9..673cbbe 100644 (file)
@@ -1,3 +1,33 @@
+2011-06-28  Ilya Sherman  <isherman@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        form.autocomplete="off" does not work
+        Rename the autoComplete() method for HTMLFormElement, HTMLFormControlElementWithState, and HTMLInputElement to shouldAutocomplete()
+        Add the autocomplete attribute to HTMLFormElement.idl and HTMLInputElement.idl
+        https://bugs.webkit.org/show_bug.cgi?id=35823
+
+        Test: fast/forms/autocomplete.html
+
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::HTMLFormControlElementWithState::shouldAutocomplete): Renamed from ::autoComplete()
+        (WebCore::HTMLFormControlElementWithState::shouldSaveAndRestoreFormControlState): Update callsite.
+        * html/HTMLFormControlElement.h:
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::~HTMLFormElement): Update callsite.
+        (WebCore::HTMLFormElement::parseMappedAttribute): Update callsite.
+        (WebCore::HTMLFormElement::documentDidBecomeActive): Update callsite.
+        (WebCore::HTMLFormElement::willMoveToNewOwnerDocument): Update callsite.
+        (WebCore::HTMLFormElement::didMoveToNewOwnerDocument): Update callsite.
+        (WebCore::HTMLFormElement::shouldAutocomplete): Renamed from ::autoComplete()
+        * html/HTMLFormElement.h:
+        * html/HTMLFormElement.idl: Bind the autocomplete attribute to a JavaScript property.
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::shouldAutocomplete): Renamed from ::autoComplete()
+        * html/HTMLInputElement.h:
+        * html/HTMLInputElement.idl: Bind the autocomplete attribute to a JavaScript property.
+        * WebCore.exp.in: Updated autoComplete() -> shouldAutocomplete()
+
 2011-06-28  Dimitri Glazkov  <dglazkov@chromium.org>
 
         Reviewed by Kent Tamura.
index ccd8384..d71295b 100644 (file)
@@ -1163,8 +1163,8 @@ __ZNK7WebCore15VisiblePosition4nextENS_27EditingBoundaryCrossingRuleE
 __ZNK7WebCore15VisiblePosition8previousENS_27EditingBoundaryCrossingRuleE
 __ZNK7WebCore16FontFallbackList10fontDataAtEPKNS_4FontEj
 __ZNK7WebCore16HTMLInputElement11isTextFieldEv
-__ZNK7WebCore16HTMLInputElement12autoCompleteEv
 __ZNK7WebCore16HTMLInputElement15isPasswordFieldEv
+__ZNK7WebCore16HTMLInputElement18shouldAutocompleteEv
 __ZNK7WebCore16HTMLInputElement21lastChangeWasUserEditEv
 __ZNK7WebCore16IconDatabaseBase12databasePathEv
 __ZNK7WebCore16ResourceResponse13nsURLResponseEv
index e3c139d..9c53174 100644 (file)
@@ -521,17 +521,17 @@ void HTMLFormControlElementWithState::didMoveToNewOwnerDocument()
     HTMLFormControlElement::didMoveToNewOwnerDocument();
 }
 
-bool HTMLFormControlElementWithState::autoComplete() const
+bool HTMLFormControlElementWithState::shouldAutocomplete() const
 {
     if (!form())
         return true;
-    return form()->autoComplete();
+    return form()->shouldAutocomplete();
 }
 
 bool HTMLFormControlElementWithState::shouldSaveAndRestoreFormControlState() const
 {
     // We don't save/restore control state in a form with autocomplete=off.
-    return attached() && autoComplete();
+    return attached() && shouldAutocomplete();
 }
 
 void HTMLFormControlElementWithState::finishParsingChildren()
index 1da208c..69e42da 100644 (file)
@@ -175,7 +175,7 @@ public:
 protected:
     HTMLFormControlElementWithState(const QualifiedName& tagName, Document*, HTMLFormElement*);
 
-    virtual bool autoComplete() const;
+    virtual bool shouldAutocomplete() const;
     virtual void finishParsingChildren();
     virtual void willMoveToNewOwnerDocument();
     virtual void didMoveToNewOwnerDocument();
index 8df4776..94b0c62 100644 (file)
@@ -91,7 +91,7 @@ PassRefPtr<HTMLFormElement> HTMLFormElement::create(const QualifiedName& tagName
 
 HTMLFormElement::~HTMLFormElement()
 {
-    if (!autoComplete())
+    if (!shouldAutocomplete())
         document()->unregisterForDocumentActivationCallbacks(this);
 
     for (unsigned i = 0; i < m_associatedElements.size(); ++i)
@@ -376,7 +376,7 @@ void HTMLFormElement::parseMappedAttribute(Attribute* attr)
     else if (attr->name() == accept_charsetAttr)
         m_attributes.setAcceptCharset(attr->value());
     else if (attr->name() == autocompleteAttr) {
-        if (!autoComplete())
+        if (!shouldAutocomplete())
             document()->registerForDocumentActivationCallbacks(this);
         else
             document()->unregisterForDocumentActivationCallbacks(this);
@@ -638,7 +638,7 @@ void HTMLFormElement::getNamedElements(const AtomicString& name, Vector<RefPtr<N
 
 void HTMLFormElement::documentDidBecomeActive()
 {
-    ASSERT(!autoComplete());
+    ASSERT(!shouldAutocomplete());
 
     for (unsigned i = 0; i < m_associatedElements.size(); ++i) {
         if (m_associatedElements[i]->isFormControlElement())
@@ -648,19 +648,19 @@ void HTMLFormElement::documentDidBecomeActive()
 
 void HTMLFormElement::willMoveToNewOwnerDocument()
 {
-    if (!autoComplete())
+    if (!shouldAutocomplete())
         document()->unregisterForDocumentActivationCallbacks(this);
     HTMLElement::willMoveToNewOwnerDocument();
 }
 
 void HTMLFormElement::didMoveToNewOwnerDocument()
 {
-    if (!autoComplete())
+    if (!shouldAutocomplete())
         document()->registerForDocumentActivationCallbacks(this);
     HTMLElement::didMoveToNewOwnerDocument();
 }
 
-bool HTMLFormElement::autoComplete() const
+bool HTMLFormElement::shouldAutocomplete() const
 {
     return !equalIgnoringCase(fastGetAttribute(autocompleteAttr), "off");
 }
index 564772e..843a986 100644 (file)
@@ -61,8 +61,7 @@ public:
     String encoding() const { return m_attributes.encodingType(); }
     void setEncoding(const String& value) { setEnctype(value); }
 
-    // FIXME: Rename this function to shouldAutocomplete.
-    bool autoComplete() const;
+    bool shouldAutocomplete() const;
 
     // FIXME: Should rename these two functions to say "form control" or "form-associated element" instead of "form element".
     void registerFormElement(FormAssociatedElement*);
index e9759e2..5c779b5 100644 (file)
@@ -35,6 +35,7 @@ module html {
         attribute [ConvertNullToNullString] DOMString enctype;
         attribute [Reflect] DOMString method;
         attribute [Reflect] DOMString target;
+        attribute [Reflect] DOMString autocomplete;
         
 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
         [ImplementationFunction=submitFromJavaScript] void submit();
index 28075ba..2c25841 100644 (file)
@@ -161,11 +161,11 @@ HTMLElement* HTMLInputElement::speechButtonElement() const
 }
 #endif
 
-bool HTMLInputElement::autoComplete() const
+bool HTMLInputElement::shouldAutocomplete() const
 {
     if (m_autocomplete != Uninitialized)
         return m_autocomplete == On;
-    return HTMLTextFormControlElement::autoComplete();
+    return HTMLTextFormControlElement::shouldAutocomplete();
 }
 
 void HTMLInputElement::updateCheckedRadioButtons()
index 03f93f4..3c0cd9a 100644 (file)
@@ -44,7 +44,7 @@ public:
 
     virtual HTMLInputElement* toInputElement() { return this; }
 
-    bool autoComplete() const;
+    virtual bool shouldAutocomplete() const;
 
     // For ValidityState
     bool typeMismatch() const;
index 4a4b2e5..6159641 100644 (file)
@@ -39,6 +39,7 @@ module html {
         attribute boolean checked;
         attribute [Reflect] boolean disabled;
         attribute [Reflect] boolean autofocus;
+        attribute [Reflect] DOMString autocomplete;
 #if defined(ENABLE_DATALIST) && ENABLE_DATALIST
         readonly attribute HTMLElement     list;
 #endif
index fa101e3..11db0f9 100644 (file)
@@ -1,3 +1,19 @@
+2011-06-28  Ilya Sherman  <isherman@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        form.autocomplete="off" does not work
+        https://bugs.webkit.org/show_bug.cgi?id=35823
+
+        * src/EditorClientImpl.cpp:
+        (WebKit::EditorClientImpl::autofill): Update callsite.
+        * src/WebFormElement.cpp:
+        (WebKit::WebFormElement::autoComplete): Update callsite.
+        * src/WebInputElement.cpp:
+        (WebKit::WebInputElement::autoComplete): Update callsite.
+        * src/WebPasswordFormUtils.cpp:
+        (WebKit::findPasswordFormFields): Update callsite.
+
 2011-06-28  Ryosuke Niwa  <rniwa@webkit.org>
 
         Rolled DEPS.
index fa30349..102fef0 100644 (file)
@@ -731,11 +731,9 @@ bool EditorClientImpl::autofill(HTMLInputElement* inputElement,
     m_autofillArgs.clear();
     m_autofillTimer.stop();
 
-    // FIXME: Remove the extraneous isEnabledFormControl call below.
     // Let's try to trigger autofill for that field, if applicable.
     if (!inputElement->isEnabledFormControl() || !inputElement->isTextField()
-        || inputElement->isPasswordField() || !inputElement->autoComplete()
-        || !inputElement->isEnabledFormControl()
+        || inputElement->isPasswordField() || !inputElement->shouldAutocomplete()
         || inputElement->isReadOnlyFormControl())
         return false;
 
index 6b6e9be..f3f9dce 100644 (file)
@@ -48,7 +48,7 @@ namespace WebKit {
 
 bool WebFormElement::autoComplete() const
 {
-    return constUnwrap<HTMLFormElement>()->autoComplete();
+    return constUnwrap<HTMLFormElement>()->shouldAutocomplete();
 }
 
 WebString WebFormElement::action() const
index 8a21ed9..13416be 100644 (file)
@@ -62,7 +62,7 @@ bool WebInputElement::isImageButton() const
 
 bool WebInputElement::autoComplete() const
 {
-    return constUnwrap<HTMLInputElement>()->autoComplete();
+    return constUnwrap<HTMLInputElement>()->shouldAutocomplete();
 }
 
 int WebInputElement::maxLength() const
index 5f8a1ec..7401717 100644 (file)
@@ -82,7 +82,7 @@ void findPasswordFormFields(HTMLFormElement* form, PasswordFormFields* fields)
 
         if ((fields->passwords.size() < maxPasswords)
             && inputElement->isPasswordField()
-            && inputElement->autoComplete()) {
+            && inputElement->shouldAutocomplete()) {
             if (fields->passwords.isEmpty())
                 firstPasswordIndex = i;
             fields->passwords.append(inputElement);
@@ -104,7 +104,7 @@ void findPasswordFormFields(HTMLFormElement* form, PasswordFormFields* fields)
 
             // Various input types such as text, url, email can be a username field.
             if ((inputElement->isTextField() && !inputElement->isPasswordField())
-                && (inputElement->autoComplete())) {
+                && (inputElement->shouldAutocomplete())) {
                 fields->userName = inputElement;
                 break;
             }
index 9c6ced8..6293a50 100644 (file)
@@ -1,3 +1,13 @@
+2011-06-28  Ilya Sherman  <isherman@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        form.autocomplete="off" does not work
+        https://bugs.webkit.org/show_bug.cgi?id=35823
+
+        * WebView/WebHTMLRepresentation.mm:
+        (-[WebHTMLRepresentation elementDoesAutoComplete:]): Update callsite.
+
 2011-06-26  Mark Rowe  <mrowe@apple.com>
 
         Reviewed by Dan Bernstein.
index 1802ca8..89a0cfc 100644 (file)
@@ -313,7 +313,7 @@ static HTMLInputElement* inputElementFromDOMElement(DOMElement* element)
     return inputElement
         && inputElement->isTextField()
         && !inputElement->isPasswordField()
-        && inputElement->autoComplete();
+        && inputElement->shouldAutocomplete();
 }
 
 - (BOOL)elementIsPassword:(DOMElement *)element
index 85076e1..ba0903c 100644 (file)
@@ -1,3 +1,13 @@
+2011-06-28  Ilya Sherman  <isherman@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        form.autocomplete="off" does not work
+        https://bugs.webkit.org/show_bug.cgi?id=35823
+
+        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
+        (DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId): Update callsite.
+
 2011-06-27  Diego Gonzalez  <diegohcg@webkit.org>
 
         Reviewed by Kenneth Rohde Christiansen.
index 6a0ef45..ae4524a 100644 (file)
@@ -642,7 +642,7 @@ bool DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId(QWebFrame*
 
     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(coreNode);
 
-    return inputElement->isTextField() && !inputElement->isPasswordField() && inputElement->autoComplete();
+    return inputElement->isTextField() && !inputElement->isPasswordField() && inputElement->shouldAutocomplete();
 }
 
 void DumpRenderTreeSupportQt::setEditingBehavior(QWebPage* page, const QString& editingBehavior)
index c1b0d0f..a2da9fb 100644 (file)
@@ -1,3 +1,13 @@
+2011-06-28  Ilya Sherman  <isherman@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        form.autocomplete="off" does not work
+        https://bugs.webkit.org/show_bug.cgi?id=35823
+
+        * WebFrame.cpp:
+        (WebFrame::elementDoesAutoComplete): Updated callsite.
+
 2011-06-27  Brent Fulgham  <bfulgham@webkit.org>
 
         Reviewed by Adam Roben.
index be05824..f9c12f6 100644 (file)
@@ -1209,7 +1209,7 @@ HRESULT WebFrame::elementDoesAutoComplete(IDOMElement *element, BOOL *result)
     if (!inputElement)
         *result = false;
     else
-        *result = inputElement->isTextField() && !inputElement->isPasswordField() && inputElement->autoComplete();
+        *result = inputElement->isTextField() && !inputElement->isPasswordField() && inputElement->shouldAutocomplete();
 
     return S_OK;
 }