method/enctype/formMethod/formEnctype properties should be limited to known values.
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Oct 2011 06:59:23 +0000 (06:59 +0000)
committertkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Oct 2011 06:59:23 +0000 (06:59 +0000)
commit656ba062bddcf7d7664da1e5ed844ad6136788c6
tree34561c5bcf4af421001c819a77b750bad1127a0b
parentdd31c6f0a5434ab67c89471102afbc9524455aad
method/enctype/formMethod/formEnctype properties should be limited to known values.
https://bugs.webkit.org/show_bug.cgi?id=68887

Reviewed by Hajime Morita.

Source/WebCore:

According to the standard and other browser behaviors, the
following IDL properties should be reflected to the corresponding
HTML attributes on setting, but should return normalized values on
getting.
- HTMLFormElement::method
- HTMLFormElement::enctype
- HTMLInputElement::formMethod
- HTMLInputElement::formEnctype
- HTMLButtonElement::formMethod
- HTMLButtonElement::formEnctype

Tests: fast/forms/enctype-attribute.html
       fast/forms/method-attribute.html

* html/HTMLButtonElement.idl:
Replace 'Reflect' with 'ConvertNullToNullString' in order to use a
getter function.
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::formEnctype):
Normalizes the value by parseEncodingType().
(WebCore::HTMLFormControlElement::setFormEnctype):
Simply calls setAttribute()
(WebCore::HTMLFormControlElement::formMethod):
Normalizes the value by parseMethodType().
(WebCore::HTMLFormControlElement::setFormMethod):
Simply calls setAttribute()
* html/HTMLFormControlElement.h:
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::parseMappedAttribute):
Follow the Attributes function renaming.
(WebCore::HTMLFormElement::method):
Normalizes the value by parseMethodType().
* html/HTMLFormElement.idl:
Replace 'Reflect' with 'ConvertNullToNullString' in order to use a
getter function.
* html/HTMLInputElement.idl: ditto.
* loader/FormSubmission.cpp:
(WebCore::FormSubmission::Attributes::parseEncodingType):
New function made from a part of old parseEncodingType().
(WebCore::FormSubmission::Attributes::updateEncodingType):
Renamed from parseEncodingType().
(WebCore::FormSubmission::Attributes::parseMethodType):
New function made from a part of old parseMethodType().
(WebCore::FormSubmission::Attributes::updateMethodType):
Renamed from parseMethodType().
(WebCore::FormSubmission::create):
Follow the Attributes function renaming.
* loader/FormSubmission.h:
(WebCore::FormSubmission::Attributes::methodString):
A helper function to provide normalized strings for FormSubmission::Method.

LayoutTests:

* fast/dom/element-attribute-js-null-expected.txt:
* fast/dom/element-attribute-js-null.html: Correct an expectation for HTMLFormElement::method.
* fast/forms/enctype-attribute-expected.txt: Added.
* fast/forms/enctype-attribute.html: Added.
* fast/forms/method-attribute-expected.txt: Added.
* fast/forms/method-attribute.html: Added.
* fast/forms/script-tests/submit-form-attributes.js: Correct expectations.
* fast/forms/submit-form-attributes-expected.txt: ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@96484 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/element-attribute-js-null-expected.txt
LayoutTests/fast/dom/element-attribute-js-null.html
LayoutTests/fast/forms/enctype-attribute-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/enctype-attribute.html [new file with mode: 0644]
LayoutTests/fast/forms/method-attribute-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/method-attribute.html [new file with mode: 0644]
LayoutTests/fast/forms/script-tests/submit-form-attributes.js
LayoutTests/fast/forms/submit-form-attributes-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLButtonElement.idl
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLFormControlElement.h
Source/WebCore/html/HTMLFormElement.cpp
Source/WebCore/html/HTMLFormElement.idl
Source/WebCore/html/HTMLInputElement.idl
Source/WebCore/loader/FormSubmission.cpp
Source/WebCore/loader/FormSubmission.h