- Revision
- 196846
- Author
- [email protected]
- Date
- 2016-02-19 16:09:11 -0800 (Fri, 19 Feb 2016)
Log Message
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:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (196845 => 196846)
--- trunk/LayoutTests/ChangeLog 2016-02-20 00:03:56 UTC (rev 196845)
+++ trunk/LayoutTests/ChangeLog 2016-02-20 00:09:11 UTC (rev 196846)
@@ -1,3 +1,17 @@
+2016-02-19 Chris Dumez <[email protected]>
+
+ HTMLFormElement.autocomplete should only return known values
+ https://bugs.webkit.org/show_bug.cgi?id=154247
+ <rdar://problem/24658195>
+
+ Reviewed by Ryosuke Niwa.
+
+ 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:
+
2016-02-19 Simon Fraser <[email protected]>
Wheel event callback removing the window causes crash in WebCore.
Modified: trunk/LayoutTests/fast/forms/autocomplete-expected.txt (196845 => 196846)
--- trunk/LayoutTests/fast/forms/autocomplete-expected.txt 2016-02-20 00:03:56 UTC (rev 196845)
+++ trunk/LayoutTests/fast/forms/autocomplete-expected.txt 2016-02-20 00:09:11 UTC (rev 196846)
@@ -4,8 +4,8 @@
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.autocomplete is "on"
+PASS field.autocomplete is "on"
PASS form.getAttribute('autocomplete') is "off"
PASS field.getAttribute('autocomplete') is "off"
PASS form.autocomplete is "on"
Modified: trunk/LayoutTests/fast/forms/autocomplete.html (196845 => 196846)
--- trunk/LayoutTests/fast/forms/autocomplete.html 2016-02-20 00:03:56 UTC (rev 196845)
+++ trunk/LayoutTests/fast/forms/autocomplete.html 2016-02-20 00:09:11 UTC (rev 196846)
@@ -12,8 +12,8 @@
shouldBeNull("form.getAttribute('autocomplete')");
shouldBeNull("field.getAttribute('autocomplete')");
- shouldBeEqualToString("form.autocomplete", "");
- shouldBeEqualToString("field.autocomplete", "");
+ shouldBeEqualToString("form.autocomplete", "on");
+ shouldBeEqualToString("field.autocomplete", "on");
form.autocomplete = 'off';
field.autocomplete = 'off';
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (196845 => 196846)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2016-02-20 00:03:56 UTC (rev 196845)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2016-02-20 00:09:11 UTC (rev 196846)
@@ -1,5 +1,18 @@
2016-02-19 Chris Dumez <[email protected]>
+ HTMLFormElement.autocomplete should only return known values
+ https://bugs.webkit.org/show_bug.cgi?id=154247
+ <rdar://problem/24658195>
+
+ Reviewed by Ryosuke Niwa.
+
+ 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:
+
+2016-02-19 Chris Dumez <[email protected]>
+
Re-sync W3C web-platform-tests' html/dom/interfaces.html
https://bugs.webkit.org/show_bug.cgi?id=154463
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt (196845 => 196846)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt 2016-02-20 00:03:56 UTC (rev 196845)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt 2016-02-20 00:09:11 UTC (rev 196846)
@@ -674,131 +674,131 @@
PASS form.acceptCharset (<form accept-charset>): IDL set to object "test-valueOf" followed by getAttribute()
PASS form.acceptCharset (<form accept-charset>): IDL set to object "test-valueOf" followed by IDL get
PASS form.autocomplete: typeof IDL attribute
-FAIL form.autocomplete: IDL get with DOM attribute unset assert_equals: expected "on" but got ""
+PASS form.autocomplete: IDL get with DOM attribute unset
PASS form.autocomplete: setAttribute() to "" followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to "" followed by IDL get assert_equals: expected "on" but got ""
+PASS form.autocomplete: setAttribute() to "" followed by IDL get
PASS form.autocomplete: setAttribute() to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " followed by IDL get assert_equals: expected "on" but got " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo "
+PASS form.autocomplete: setAttribute() to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " followed by IDL get
PASS form.autocomplete: setAttribute() to undefined followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to undefined followed by IDL get assert_equals: expected "on" but got "undefined"
+PASS form.autocomplete: setAttribute() to undefined followed by IDL get
PASS form.autocomplete: setAttribute() to 7 followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to 7 followed by IDL get assert_equals: expected "on" but got "7"
+PASS form.autocomplete: setAttribute() to 7 followed by IDL get
PASS form.autocomplete: setAttribute() to 1.5 followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to 1.5 followed by IDL get assert_equals: expected "on" but got "1.5"
+PASS form.autocomplete: setAttribute() to 1.5 followed by IDL get
PASS form.autocomplete: setAttribute() to true followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to true followed by IDL get assert_equals: expected "on" but got "true"
+PASS form.autocomplete: setAttribute() to true followed by IDL get
PASS form.autocomplete: setAttribute() to false followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to false followed by IDL get assert_equals: expected "on" but got "false"
+PASS form.autocomplete: setAttribute() to false followed by IDL get
PASS form.autocomplete: setAttribute() to object "[object Object]" followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to object "[object Object]" followed by IDL get assert_equals: expected "on" but got "[object Object]"
+PASS form.autocomplete: setAttribute() to object "[object Object]" followed by IDL get
PASS form.autocomplete: setAttribute() to NaN followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to NaN followed by IDL get assert_equals: expected "on" but got "NaN"
+PASS form.autocomplete: setAttribute() to NaN followed by IDL get
PASS form.autocomplete: setAttribute() to Infinity followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to Infinity followed by IDL get assert_equals: expected "on" but got "Infinity"
+PASS form.autocomplete: setAttribute() to Infinity followed by IDL get
PASS form.autocomplete: setAttribute() to -Infinity followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to -Infinity followed by IDL get assert_equals: expected "on" but got "-Infinity"
+PASS form.autocomplete: setAttribute() to -Infinity followed by IDL get
PASS form.autocomplete: setAttribute() to "\0" followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to "\0" followed by IDL get assert_equals: expected "on" but got "\0"
+PASS form.autocomplete: setAttribute() to "\0" followed by IDL get
PASS form.autocomplete: setAttribute() to null followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to null followed by IDL get assert_equals: expected "on" but got "null"
+PASS form.autocomplete: setAttribute() to null followed by IDL get
PASS form.autocomplete: setAttribute() to object "test-toString" followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to object "test-toString" followed by IDL get assert_equals: expected "on" but got "test-toString"
+PASS form.autocomplete: setAttribute() to object "test-toString" followed by IDL get
PASS form.autocomplete: setAttribute() to object "test-valueOf" followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to object "test-valueOf" followed by IDL get assert_equals: expected "on" but got "test-valueOf"
+PASS form.autocomplete: setAttribute() to object "test-valueOf" followed by IDL get
PASS form.autocomplete: setAttribute() to "on" followed by getAttribute()
PASS form.autocomplete: setAttribute() to "on" followed by IDL get
PASS form.autocomplete: setAttribute() to "xon" followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to "xon" followed by IDL get assert_equals: expected "on" but got "xon"
+PASS form.autocomplete: setAttribute() to "xon" followed by IDL get
PASS form.autocomplete: setAttribute() to "on\0" followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to "on\0" followed by IDL get assert_equals: expected "on" but got "on\0"
+PASS form.autocomplete: setAttribute() to "on\0" followed by IDL get
PASS form.autocomplete: setAttribute() to "n" followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to "n" followed by IDL get assert_equals: expected "on" but got "n"
+PASS form.autocomplete: setAttribute() to "n" followed by IDL get
PASS form.autocomplete: setAttribute() to "ON" followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to "ON" followed by IDL get assert_equals: expected "on" but got "ON"
+PASS form.autocomplete: setAttribute() to "ON" followed by IDL get
PASS form.autocomplete: setAttribute() to "off" followed by getAttribute()
PASS form.autocomplete: setAttribute() to "off" followed by IDL get
PASS form.autocomplete: setAttribute() to "xoff" followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to "xoff" followed by IDL get assert_equals: expected "on" but got "xoff"
+PASS form.autocomplete: setAttribute() to "xoff" followed by IDL get
PASS form.autocomplete: setAttribute() to "off\0" followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to "off\0" followed by IDL get assert_equals: expected "on" but got "off\0"
+PASS form.autocomplete: setAttribute() to "off\0" followed by IDL get
PASS form.autocomplete: setAttribute() to "ff" followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to "ff" followed by IDL get assert_equals: expected "on" but got "ff"
+PASS form.autocomplete: setAttribute() to "ff" followed by IDL get
PASS form.autocomplete: setAttribute() to "OFF" followed by getAttribute()
-FAIL form.autocomplete: setAttribute() to "OFF" followed by IDL get assert_equals: expected "off" but got "OFF"
+PASS form.autocomplete: setAttribute() to "OFF" followed by IDL get
PASS form.autocomplete: IDL set to "" should not throw
PASS form.autocomplete: IDL set to "" followed by getAttribute()
-FAIL form.autocomplete: IDL set to "" followed by IDL get assert_equals: expected "on" but got ""
+PASS form.autocomplete: IDL set to "" followed by IDL get
PASS form.autocomplete: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " should not throw
PASS form.autocomplete: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " followed by getAttribute()
-FAIL form.autocomplete: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " followed by IDL get assert_equals: expected "on" but got " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo "
+PASS form.autocomplete: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " followed by IDL get
PASS form.autocomplete: IDL set to undefined should not throw
PASS form.autocomplete: IDL set to undefined followed by getAttribute()
-FAIL form.autocomplete: IDL set to undefined followed by IDL get assert_equals: expected "on" but got "undefined"
+PASS form.autocomplete: IDL set to undefined followed by IDL get
PASS form.autocomplete: IDL set to 7 should not throw
PASS form.autocomplete: IDL set to 7 followed by getAttribute()
-FAIL form.autocomplete: IDL set to 7 followed by IDL get assert_equals: expected "on" but got "7"
+PASS form.autocomplete: IDL set to 7 followed by IDL get
PASS form.autocomplete: IDL set to 1.5 should not throw
PASS form.autocomplete: IDL set to 1.5 followed by getAttribute()
-FAIL form.autocomplete: IDL set to 1.5 followed by IDL get assert_equals: expected "on" but got "1.5"
+PASS form.autocomplete: IDL set to 1.5 followed by IDL get
PASS form.autocomplete: IDL set to true should not throw
PASS form.autocomplete: IDL set to true followed by getAttribute()
-FAIL form.autocomplete: IDL set to true followed by IDL get assert_equals: expected "on" but got "true"
+PASS form.autocomplete: IDL set to true followed by IDL get
PASS form.autocomplete: IDL set to false should not throw
PASS form.autocomplete: IDL set to false followed by getAttribute()
-FAIL form.autocomplete: IDL set to false followed by IDL get assert_equals: expected "on" but got "false"
+PASS form.autocomplete: IDL set to false followed by IDL get
PASS form.autocomplete: IDL set to object "[object Object]" should not throw
PASS form.autocomplete: IDL set to object "[object Object]" followed by getAttribute()
-FAIL form.autocomplete: IDL set to object "[object Object]" followed by IDL get assert_equals: expected "on" but got "[object Object]"
+PASS form.autocomplete: IDL set to object "[object Object]" followed by IDL get
PASS form.autocomplete: IDL set to NaN should not throw
PASS form.autocomplete: IDL set to NaN followed by getAttribute()
-FAIL form.autocomplete: IDL set to NaN followed by IDL get assert_equals: expected "on" but got "NaN"
+PASS form.autocomplete: IDL set to NaN followed by IDL get
PASS form.autocomplete: IDL set to Infinity should not throw
PASS form.autocomplete: IDL set to Infinity followed by getAttribute()
-FAIL form.autocomplete: IDL set to Infinity followed by IDL get assert_equals: expected "on" but got "Infinity"
+PASS form.autocomplete: IDL set to Infinity followed by IDL get
PASS form.autocomplete: IDL set to -Infinity should not throw
PASS form.autocomplete: IDL set to -Infinity followed by getAttribute()
-FAIL form.autocomplete: IDL set to -Infinity followed by IDL get assert_equals: expected "on" but got "-Infinity"
+PASS form.autocomplete: IDL set to -Infinity followed by IDL get
PASS form.autocomplete: IDL set to "\0" should not throw
PASS form.autocomplete: IDL set to "\0" followed by getAttribute()
-FAIL form.autocomplete: IDL set to "\0" followed by IDL get assert_equals: expected "on" but got "\0"
+PASS form.autocomplete: IDL set to "\0" followed by IDL get
PASS form.autocomplete: IDL set to null should not throw
-FAIL form.autocomplete: IDL set to null followed by IDL get assert_equals: expected "on" but got "null"
+PASS form.autocomplete: IDL set to null followed by IDL get
PASS form.autocomplete: IDL set to object "test-toString" should not throw
PASS form.autocomplete: IDL set to object "test-toString" followed by getAttribute()
-FAIL form.autocomplete: IDL set to object "test-toString" followed by IDL get assert_equals: expected "on" but got "test-toString"
+PASS form.autocomplete: IDL set to object "test-toString" followed by IDL get
PASS form.autocomplete: IDL set to object "test-valueOf" should not throw
PASS form.autocomplete: IDL set to object "test-valueOf" followed by getAttribute()
-FAIL form.autocomplete: IDL set to object "test-valueOf" followed by IDL get assert_equals: expected "on" but got "test-valueOf"
+PASS form.autocomplete: IDL set to object "test-valueOf" followed by IDL get
PASS form.autocomplete: IDL set to "on" should not throw
PASS form.autocomplete: IDL set to "on" followed by getAttribute()
PASS form.autocomplete: IDL set to "on" followed by IDL get
PASS form.autocomplete: IDL set to "xon" should not throw
PASS form.autocomplete: IDL set to "xon" followed by getAttribute()
-FAIL form.autocomplete: IDL set to "xon" followed by IDL get assert_equals: expected "on" but got "xon"
+PASS form.autocomplete: IDL set to "xon" followed by IDL get
PASS form.autocomplete: IDL set to "on\0" should not throw
PASS form.autocomplete: IDL set to "on\0" followed by getAttribute()
-FAIL form.autocomplete: IDL set to "on\0" followed by IDL get assert_equals: expected "on" but got "on\0"
+PASS form.autocomplete: IDL set to "on\0" followed by IDL get
PASS form.autocomplete: IDL set to "n" should not throw
PASS form.autocomplete: IDL set to "n" followed by getAttribute()
-FAIL form.autocomplete: IDL set to "n" followed by IDL get assert_equals: expected "on" but got "n"
+PASS form.autocomplete: IDL set to "n" followed by IDL get
PASS form.autocomplete: IDL set to "ON" should not throw
PASS form.autocomplete: IDL set to "ON" followed by getAttribute()
-FAIL form.autocomplete: IDL set to "ON" followed by IDL get assert_equals: expected "on" but got "ON"
+PASS form.autocomplete: IDL set to "ON" followed by IDL get
PASS form.autocomplete: IDL set to "off" should not throw
PASS form.autocomplete: IDL set to "off" followed by getAttribute()
PASS form.autocomplete: IDL set to "off" followed by IDL get
PASS form.autocomplete: IDL set to "xoff" should not throw
PASS form.autocomplete: IDL set to "xoff" followed by getAttribute()
-FAIL form.autocomplete: IDL set to "xoff" followed by IDL get assert_equals: expected "on" but got "xoff"
+PASS form.autocomplete: IDL set to "xoff" followed by IDL get
PASS form.autocomplete: IDL set to "off\0" should not throw
PASS form.autocomplete: IDL set to "off\0" followed by getAttribute()
-FAIL form.autocomplete: IDL set to "off\0" followed by IDL get assert_equals: expected "on" but got "off\0"
+PASS form.autocomplete: IDL set to "off\0" followed by IDL get
PASS form.autocomplete: IDL set to "ff" should not throw
PASS form.autocomplete: IDL set to "ff" followed by getAttribute()
-FAIL form.autocomplete: IDL set to "ff" followed by IDL get assert_equals: expected "on" but got "ff"
+PASS form.autocomplete: IDL set to "ff" followed by IDL get
PASS form.autocomplete: IDL set to "OFF" should not throw
PASS form.autocomplete: IDL set to "OFF" followed by getAttribute()
-FAIL form.autocomplete: IDL set to "OFF" followed by IDL get assert_equals: expected "off" but got "OFF"
+PASS form.autocomplete: IDL set to "OFF" followed by IDL get
PASS form.enctype: typeof IDL attribute
PASS form.enctype: IDL get with DOM attribute unset
PASS form.enctype: setAttribute() to "" followed by getAttribute()
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-autocomplete-expected.txt (196845 => 196846)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-autocomplete-expected.txt 2016-02-20 00:03:56 UTC (rev 196845)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-autocomplete-expected.txt 2016-02-20 00:09:11 UTC (rev 196846)
@@ -3,10 +3,10 @@
-FAIL form autocomplete attribute missing assert_equals: expected "on" but got ""
-FAIL form autocomplete attribute on assert_equals: expected "on" but got ""
-FAIL form autocomplete attribute off assert_equals: expected "off" but got ""
-FAIL form autocomplete attribute invalid assert_equals: expected "on" but got "foobar"
+PASS form autocomplete attribute missing
+PASS form autocomplete attribute on
+PASS form autocomplete attribute off
+PASS form autocomplete attribute invalid
PASS name is an allowed autocomplete field name
PASS honorific-prefix is an allowed autocomplete field name
PASS given-name is an allowed autocomplete field name
Modified: trunk/Source/WebCore/ChangeLog (196845 => 196846)
--- trunk/Source/WebCore/ChangeLog 2016-02-20 00:03:56 UTC (rev 196845)
+++ trunk/Source/WebCore/ChangeLog 2016-02-20 00:09:11 UTC (rev 196846)
@@ -1,5 +1,35 @@
2016-02-19 Chris Dumez <[email protected]>
+ HTMLFormElement.autocomplete should only return known values
+ https://bugs.webkit.org/show_bug.cgi?id=154247
+ <rdar://problem/24658195>
+
+ Reviewed by Ryosuke Niwa.
+
+ 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:
+
+2016-02-19 Chris Dumez <[email protected]>
+
Drop UnsafeVectorOverflow on ElementDescendantConstIterator::m_ancestorSiblingStack
https://bugs.webkit.org/show_bug.cgi?id=154477
Modified: trunk/Source/WebCore/html/HTMLFormControlElement.cpp (196845 => 196846)
--- trunk/Source/WebCore/html/HTMLFormControlElement.cpp 2016-02-20 00:03:56 UTC (rev 196845)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.cpp 2016-02-20 00:09:11 UTC (rev 196846)
@@ -713,10 +713,15 @@
// https://html.spec.whatwg.org/multipage/forms.html#processing-model-3
String HTMLFormControlElement::autocomplete() const
{
+ bool wearingAutofillAnchorMantle = is<HTMLInputElement>(*this) && downcast<HTMLInputElement>(this)->isInputTypeHidden();
+
const AtomicString& attributeValue = fastGetAttribute(autocompleteAttr);
SpaceSplitString tokens(attributeValue, true);
- if (tokens.isEmpty())
- return String();
+ if (tokens.isEmpty()) {
+ if (wearingAutofillAnchorMantle)
+ return String();
+ return form() ? form()->autocomplete() : ASCIILiteral("on");
+ }
size_t currentTokenIndex = tokens.size() - 1;
const auto& fieldToken = tokens[currentTokenIndex];
@@ -727,7 +732,6 @@
if (tokens.size() > maxTokensForAutofillFieldCategory(category))
return String();
- bool wearingAutofillAnchorMantle = is<HTMLInputElement>(*this) && downcast<HTMLInputElement>(this)->isInputTypeHidden();
if ((category == AutofillCategory::Off || category == AutofillCategory::Automatic) && wearingAutofillAnchorMantle)
return String();
Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (196845 => 196846)
--- trunk/Source/WebCore/html/HTMLFormElement.cpp 2016-02-20 00:03:56 UTC (rev 196845)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp 2016-02-20 00:09:11 UTC (rev 196846)
@@ -860,4 +860,17 @@
return const_cast<HTMLFormElement*>(ancestorsOfType<HTMLFormElement>(startElement).first());
}
+void HTMLFormElement::setAutocomplete(const AtomicString& value)
+{
+ setAttributeWithoutSynchronization(autocompleteAttr, value);
+}
+
+const String& HTMLFormElement::autocomplete() const
+{
+ static NeverDestroyed<const String> on("on", String::ConstructFromLiteral);
+ static NeverDestroyed<const String> off("off", String::ConstructFromLiteral);
+
+ return equalIgnoringASCIICase(fastGetAttribute(autocompleteAttr), off) ? off : on;
+}
+
} // namespace
Modified: trunk/Source/WebCore/html/HTMLFormElement.h (196845 => 196846)
--- trunk/Source/WebCore/html/HTMLFormElement.h 2016-02-20 00:03:56 UTC (rev 196845)
+++ trunk/Source/WebCore/html/HTMLFormElement.h 2016-02-20 00:09:11 UTC (rev 196846)
@@ -66,6 +66,9 @@
bool shouldAutocomplete() const;
+ void setAutocomplete(const AtomicString&);
+ const String& autocomplete() const;
+
#if ENABLE(IOS_AUTOCORRECT_AND_AUTOCAPITALIZE)
WEBCORE_EXPORT bool autocorrect() const;
void setAutocorrect(bool);
Modified: trunk/Source/WebCore/html/HTMLFormElement.idl (196845 => 196846)
--- trunk/Source/WebCore/html/HTMLFormElement.idl 2016-02-20 00:03:56 UTC (rev 196845)
+++ trunk/Source/WebCore/html/HTMLFormElement.idl 2016-02-20 00:09:11 UTC (rev 196846)
@@ -24,7 +24,7 @@
] interface HTMLFormElement : HTMLElement {
[Reflect=accept_charset] attribute DOMString acceptCharset;
[Reflect, URL] attribute DOMString action;
- [Reflect] attribute DOMString autocomplete;
+ attribute DOMString autocomplete;
[TreatNullAs=NullString] attribute DOMString enctype;
[TreatNullAs=NullString] attribute DOMString encoding;
[TreatNullAs=NullString] attribute DOMString method;