HTMLFormElement.autocomplete should only return known values
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 20 Feb 2016 00:09:11 +0000 (00:09 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 20 Feb 2016 00:09:11 +0000 (00:09 +0000)
commit968e8b04a06d4d3642f25351b2d3bc984e8e8f88
treecbc8fbf8bca1bc1a8d28f8a98ec4b0d341c35761
parent36840d85c820e1ee79689e4e8ba4f4598f256296
HTMLFormElement.autocomplete should only return known values
https://bugs.webkit.org/show_bug.cgi?id=154247
<rdar://problem/24658195>

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline a couple of W3C HTML tests now that more checks are passing.

* web-platform-tests/html/dom/reflection-forms-expected.txt:
* web-platform-tests/html/semantics/forms/the-form-element/form-autocomplete-expected.txt:

Source/WebCore:

Update HTMLFormElement.autocomplete to only return known values:
- https://html.spec.whatwg.org/multipage/forms.html#dom-form-autocomplete
- https://html.spec.whatwg.org/multipage/forms.html#attr-form-autocomplete

Also, update HTMLInputElement.autocomplete to fall back to using the form
owner's autocomplete attribute ("on" or "off") when it's autocomplete
attribute is omitted and the input element is wearing the "autofill
expectation mantle" (i.e. the input is not hidden). If there is no
form owner, the "on" value is used instead. This behavior is specified
in:
https://html.spec.whatwg.org/multipage/forms.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-7

No new tests, already covered by existing tests.

* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::autocomplete):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::setAutocomplete):
(WebCore::HTMLFormElement::autocomplete):
* html/HTMLFormElement.h:
* html/HTMLFormElement.idl:

LayoutTests:

Update test to expect Form.autocomplete to return "on" by
default instead of the empty string.

* fast/forms/autocomplete-expected.txt:
* fast/forms/autocomplete.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196846 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/forms/autocomplete-expected.txt
LayoutTests/fast/forms/autocomplete.html
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt
LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-autocomplete-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLFormElement.cpp
Source/WebCore/html/HTMLFormElement.h
Source/WebCore/html/HTMLFormElement.idl