Changeset 96484 in webkit
- Timestamp:
- Oct 2, 2011 11:59:23 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r96479 r96484 1 2011-10-02 Kent Tamura <tkent@chromium.org> 2 3 method/enctype/formMethod/formEnctype properties should be limited to known values. 4 https://bugs.webkit.org/show_bug.cgi?id=68887 5 6 Reviewed by Hajime Morita. 7 8 * fast/dom/element-attribute-js-null-expected.txt: 9 * fast/dom/element-attribute-js-null.html: Correct an expectation for HTMLFormElement::method. 10 * fast/forms/enctype-attribute-expected.txt: Added. 11 * fast/forms/enctype-attribute.html: Added. 12 * fast/forms/method-attribute-expected.txt: Added. 13 * fast/forms/method-attribute.html: Added. 14 * fast/forms/script-tests/submit-form-attributes.js: Correct expectations. 15 * fast/forms/submit-form-attributes-expected.txt: ditto. 16 1 17 2011-10-02 Gavin Barraclough <barraclough@apple.com> 2 18 -
trunk/LayoutTests/fast/dom/element-attribute-js-null-expected.txt
r76301 r96484 82 82 TEST SUCCEEDED: The value was the string 'application/x-www-form-urlencoded'. [tested HTMLFormElement.encoding] 83 83 TEST SUCCEEDED: The value was the string 'application/x-www-form-urlencoded'. [tested HTMLFormElement.enctype] 84 TEST SUCCEEDED: The value was the empty string. [tested HTMLFormElement.method]84 TEST SUCCEEDED: The value was the string 'get'. [tested HTMLFormElement.method] 85 85 TEST SUCCEEDED: The value was the empty string. [tested HTMLFormElement.target] 86 86 -
trunk/LayoutTests/fast/dom/element-attribute-js-null.html
r76301 r96484 233 233 {name: 'encoding', expectedNull: 'application/x-www-form-urlencoded'}, 234 234 {name: 'enctype', expectedNull: 'application/x-www-form-urlencoded'}, 235 {name: 'method', expectedNull: ' '},235 {name: 'method', expectedNull: 'get'}, 236 236 {name: 'target', expectedNull: ''} 237 237 ] -
trunk/LayoutTests/fast/forms/script-tests/submit-form-attributes.js
r72003 r96484 6 6 input.type = "submit"; 7 7 shouldBe('input.formAction', '""'); 8 shouldBe('input.formEnctype', '" "');9 shouldBe('input.formMethod', '" "');8 shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"'); 9 shouldBe('input.formMethod', '"get"'); 10 10 shouldBe('input.formTarget', '""'); 11 11 … … 17 17 shouldBe('input.formEnctype', '"text/plain"'); 18 18 input.setAttribute('formEnctype', 'na'); 19 shouldBe('input.formEnctype', '" na"');19 shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"'); 20 20 input.setAttribute('formMethod', 'GET'); 21 shouldBe('input.formMethod', '" GET"');21 shouldBe('input.formMethod', '"get"'); 22 22 input.setAttribute('formMethod', 'ni'); 23 shouldBe('input.formMethod', '" ni"');23 shouldBe('input.formMethod', '"get"'); 24 24 input.setAttribute('formTarget', '_blank'); 25 25 shouldBe('input.formTarget', '"_blank"'); … … 34 34 shouldBe('input.formEnctype', '"text/plain"'); 35 35 input.formEnctype = 'nota'; 36 shouldBe('input.formEnctype', '" nota"');36 shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"'); 37 37 input.formMethod = 'POST'; 38 shouldBe('input.formMethod', '" POST"');38 shouldBe('input.formMethod', '"post"'); 39 39 input.formMethod = 'neta'; 40 shouldBe('input.formMethod', '" neta"');40 shouldBe('input.formMethod', '"get"'); 41 41 input.formTarget = 'http://example.com'; 42 42 shouldBe('input.formTarget', '"http://example.com"'); … … 44 44 shouldBe('input.formTarget', '"nta"'); 45 45 46 debug(''); 46 47 debug('Setting null for input:'); 47 48 input.formEnctype = null; 48 shouldBe('input.formEnctype', '" "');49 shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"'); 49 50 shouldBe('input.getAttribute("formEnctype")', 'null'); 50 51 input.setAttribute('formEnctype', null); 51 shouldBe('input.formEnctype', '" null"');52 shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"'); 52 53 input.formMethod = null; 53 shouldBe('input.formMethod', '" "');54 shouldBe('input.formMethod', '"get"'); 54 55 shouldBe('input.getAttribute("formMethod")', 'null'); 55 56 input.setAttribute('formMethod', null); 56 shouldBe('input.formMethod', '" null"');57 shouldBe('input.formMethod', '"get"'); 57 58 input.formTarget = null; 58 59 shouldBe('input.formTarget', '""'); … … 61 62 shouldBe('input.formTarget', '"null"'); 62 63 64 debug(''); 63 65 debug('Setting undefined for input:'); 64 66 input.formEnctype = undefined; 65 shouldBe('input.formEnctype', '" undefined"');67 shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"'); 66 68 shouldBe('input.getAttribute("formEnctype")', '"undefined"'); 67 69 input.setAttribute('formEnctype', undefined); 68 shouldBe('input.formEnctype', '" undefined"');70 shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"'); 69 71 input.formMethod = undefined; 70 shouldBe('input.formMethod', '" undefined"');72 shouldBe('input.formMethod', '"get"'); 71 73 shouldBe('input.getAttribute("formMethod")', '"undefined"'); 72 74 input.setAttribute('formMethod', undefined); 73 shouldBe('input.formMethod', '" undefined"');75 shouldBe('input.formMethod', '"get"'); 74 76 input.formTarget = undefined; 75 77 shouldBe('input.formTarget', '"undefined"'); … … 78 80 shouldBe('input.formTarget', '"undefined"'); 79 81 82 debug(''); 80 83 debug('Setting non-string for input:'); 81 84 input.formEnctype = 256; 82 shouldBe('input.formEnctype', '" 256"');85 shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"'); 83 86 shouldBe('input.getAttribute("formEnctype")', '"256"'); 84 87 input.setAttribute('formEnctype', 256); 85 shouldBe('input.formEnctype', '" 256"');88 shouldBe('input.formEnctype', '"application/x-www-form-urlencoded"'); 86 89 input.formMethod = 256; 87 shouldBe('input.formMethod', '" 256"');90 shouldBe('input.formMethod', '"get"'); 88 91 shouldBe('input.getAttribute("formMethod")', '"256"'); 89 92 input.setAttribute('formMethod', 256); 90 shouldBe('input.formMethod', '" 256"');93 shouldBe('input.formMethod', '"get"'); 91 94 input.formTarget = 256; 92 95 shouldBe('input.formTarget', '"256"'); … … 96 99 97 100 var button = document.createElement('button'); 98 101 debug(''); 99 102 debug('Ordinary values for button:'); 100 103 button.type = "submit"; 101 104 shouldBe('button.formAction', '""'); 102 shouldBe('button.formEnctype', '" "');103 shouldBe('button.formMethod', '" "');105 shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"'); 106 shouldBe('button.formMethod', '"get"'); 104 107 shouldBe('button.formTarget', '""'); 105 108 … … 111 114 shouldBe('button.formEnctype', '"text/plain"'); 112 115 button.setAttribute('formEnctype', 'na'); 113 shouldBe('button.formEnctype', '" na"');116 shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"'); 114 117 button.setAttribute('formMethod', 'GET'); 115 shouldBe('button.formMethod', '" GET"');118 shouldBe('button.formMethod', '"get"'); 116 119 button.setAttribute('formMethod', 'na'); 117 shouldBe('button.formMethod', '" na"');120 shouldBe('button.formMethod', '"get"'); 118 121 button.setAttribute('formTarget', '_blank'); 119 122 shouldBe('button.formTarget', '"_blank"'); … … 128 131 shouldBe('button.formEnctype', '"text/plain"'); 129 132 button.formEnctype = 'nota'; 130 shouldBe('button.formEnctype', '" nota"');133 shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"'); 131 134 button.formMethod = 'POST'; 132 shouldBe('button.formMethod', '" POST"');135 shouldBe('button.formMethod', '"post"'); 133 136 button.formMethod = 'nota'; 134 shouldBe('button.formMethod', '" nota"');137 shouldBe('button.formMethod', '"get"'); 135 138 button.formTarget = 'http://example.com'; 136 139 shouldBe('button.formTarget', '"http://example.com"'); … … 138 141 shouldBe('button.formTarget', '"nota"'); 139 142 143 debug(''); 140 144 debug('Setting null for button:'); 141 145 button.formEnctype = null; 142 shouldBe('button.formEnctype', '" "');146 shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"'); 143 147 shouldBe('button.getAttribute("formEnctype")', 'null'); 144 148 button.setAttribute('formEnctype', null); 145 shouldBe('button.formEnctype', '" null"');149 shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"'); 146 150 button.formMethod = null; 147 shouldBe('button.formMethod', '" "');151 shouldBe('button.formMethod', '"get"'); 148 152 shouldBe('button.getAttribute("formMethod")', 'null'); 149 153 button.setAttribute('formMethod', null); 150 shouldBe('button.formMethod', '" null"');154 shouldBe('button.formMethod', '"get"'); 151 155 button.formTarget = null; 152 156 shouldBe('button.formTarget', '""'); … … 155 159 shouldBe('button.formTarget', '"null"'); 156 160 161 debug(''); 157 162 debug('Setting undefined for button:'); 158 163 button.formEnctype = undefined; 159 shouldBe('button.formEnctype', '" undefined"');164 shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"'); 160 165 shouldBe('button.getAttribute("formEnctype")', '"undefined"'); 161 166 button.setAttribute('formEnctype', undefined); 162 shouldBe('button.formEnctype', '" undefined"');167 shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"'); 163 168 button.formMethod = undefined; 164 shouldBe('button.formMethod', '" undefined"');169 shouldBe('button.formMethod', '"get"'); 165 170 shouldBe('button.getAttribute("formMethod")', '"undefined"'); 166 171 button.setAttribute('formMethod', undefined); 167 shouldBe('button.formMethod', '" undefined"');172 shouldBe('button.formMethod', '"get"'); 168 173 button.formTarget = undefined; 169 174 shouldBe('button.formTarget', '"undefined"'); … … 172 177 shouldBe('button.formTarget', '"undefined"'); 173 178 179 debug(''); 174 180 debug('Setting non-string for button:'); 175 181 button.formEnctype = 256; 176 shouldBe('button.formEnctype', '" 256"');182 shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"'); 177 183 shouldBe('button.getAttribute("formEnctype")', '"256"'); 178 184 button.setAttribute('formEnctype', 512); 179 shouldBe('button.formEnctype', '" 512"');185 shouldBe('button.formEnctype', '"application/x-www-form-urlencoded"'); 180 186 button.formMethod = 128; 181 shouldBe('button.formMethod', '" 128"');187 shouldBe('button.formMethod', '"get"'); 182 188 shouldBe('button.getAttribute("formMethod")', '"128"'); 183 189 button.setAttribute('formMethod', 17); 184 shouldBe('button.formMethod', '" 17"');190 shouldBe('button.formMethod', '"get"'); 185 191 button.formTarget = 100; 186 192 shouldBe('button.formTarget', '"100"'); -
trunk/LayoutTests/fast/forms/submit-form-attributes-expected.txt
r72003 r96484 6 6 Ordinary values for input: 7 7 PASS input.formAction is "" 8 PASS input.formEnctype is " "9 PASS input.formMethod is " "8 PASS input.formEnctype is "application/x-www-form-urlencoded" 9 PASS input.formMethod is "get" 10 10 PASS input.formTarget is "" 11 11 PASS input.formAction is "http://localhost/" 12 12 PASS input.formAction is "http://localhost/" 13 13 PASS input.formEnctype is "text/plain" 14 PASS input.formEnctype is " na"15 PASS input.formMethod is " GET"16 PASS input.formMethod is " ni"14 PASS input.formEnctype is "application/x-www-form-urlencoded" 15 PASS input.formMethod is "get" 16 PASS input.formMethod is "get" 17 17 PASS input.formTarget is "_blank" 18 18 PASS input.formTarget is "nu" … … 20 20 PASS input.formAction is "http://example.com/" 21 21 PASS input.formEnctype is "text/plain" 22 PASS input.formEnctype is " nota"23 PASS input.formMethod is " POST"24 PASS input.formMethod is " neta"22 PASS input.formEnctype is "application/x-www-form-urlencoded" 23 PASS input.formMethod is "post" 24 PASS input.formMethod is "get" 25 25 PASS input.formTarget is "http://example.com" 26 26 PASS input.formTarget is "nta" 27 27 28 Setting null for input: 28 PASS input.formEnctype is " "29 PASS input.formEnctype is "application/x-www-form-urlencoded" 29 30 PASS input.getAttribute("formEnctype") is null 30 PASS input.formEnctype is " null"31 PASS input.formMethod is " "31 PASS input.formEnctype is "application/x-www-form-urlencoded" 32 PASS input.formMethod is "get" 32 33 PASS input.getAttribute("formMethod") is null 33 PASS input.formMethod is " null"34 PASS input.formMethod is "get" 34 35 PASS input.formTarget is "" 35 36 PASS input.getAttribute("formTarget") is null 36 37 PASS input.formTarget is "null" 38 37 39 Setting undefined for input: 38 PASS input.formEnctype is " undefined"40 PASS input.formEnctype is "application/x-www-form-urlencoded" 39 41 PASS input.getAttribute("formEnctype") is "undefined" 40 PASS input.formEnctype is " undefined"41 PASS input.formMethod is " undefined"42 PASS input.formEnctype is "application/x-www-form-urlencoded" 43 PASS input.formMethod is "get" 42 44 PASS input.getAttribute("formMethod") is "undefined" 43 PASS input.formMethod is " undefined"45 PASS input.formMethod is "get" 44 46 PASS input.formTarget is "undefined" 45 47 PASS input.getAttribute("formTarget") is "undefined" 46 48 PASS input.formTarget is "undefined" 49 47 50 Setting non-string for input: 48 PASS input.formEnctype is " 256"51 PASS input.formEnctype is "application/x-www-form-urlencoded" 49 52 PASS input.getAttribute("formEnctype") is "256" 50 PASS input.formEnctype is " 256"51 PASS input.formMethod is " 256"53 PASS input.formEnctype is "application/x-www-form-urlencoded" 54 PASS input.formMethod is "get" 52 55 PASS input.getAttribute("formMethod") is "256" 53 PASS input.formMethod is " 256"56 PASS input.formMethod is "get" 54 57 PASS input.formTarget is "256" 55 58 PASS input.getAttribute("formTarget") is "256" 56 59 PASS input.formTarget is "256" 60 57 61 Ordinary values for button: 58 62 PASS button.formAction is "" 59 PASS button.formEnctype is " "60 PASS button.formMethod is " "63 PASS button.formEnctype is "application/x-www-form-urlencoded" 64 PASS button.formMethod is "get" 61 65 PASS button.formTarget is "" 62 66 PASS button.formAction is "http://localhost/" 63 67 PASS button.formAction is "http://localhost/" 64 68 PASS button.formEnctype is "text/plain" 65 PASS button.formEnctype is " na"66 PASS button.formMethod is " GET"67 PASS button.formMethod is " na"69 PASS button.formEnctype is "application/x-www-form-urlencoded" 70 PASS button.formMethod is "get" 71 PASS button.formMethod is "get" 68 72 PASS button.formTarget is "_blank" 69 73 PASS button.formTarget is "na" … … 71 75 PASS button.formAction is "http://example.com/" 72 76 PASS button.formEnctype is "text/plain" 73 PASS button.formEnctype is " nota"74 PASS button.formMethod is " POST"75 PASS button.formMethod is " nota"77 PASS button.formEnctype is "application/x-www-form-urlencoded" 78 PASS button.formMethod is "post" 79 PASS button.formMethod is "get" 76 80 PASS button.formTarget is "http://example.com" 77 81 PASS button.formTarget is "nota" 82 78 83 Setting null for button: 79 PASS button.formEnctype is " "84 PASS button.formEnctype is "application/x-www-form-urlencoded" 80 85 PASS button.getAttribute("formEnctype") is null 81 PASS button.formEnctype is " null"82 PASS button.formMethod is " "86 PASS button.formEnctype is "application/x-www-form-urlencoded" 87 PASS button.formMethod is "get" 83 88 PASS button.getAttribute("formMethod") is null 84 PASS button.formMethod is " null"89 PASS button.formMethod is "get" 85 90 PASS button.formTarget is "" 86 91 PASS button.getAttribute("formTarget") is null 87 92 PASS button.formTarget is "null" 93 88 94 Setting undefined for button: 89 PASS button.formEnctype is " undefined"95 PASS button.formEnctype is "application/x-www-form-urlencoded" 90 96 PASS button.getAttribute("formEnctype") is "undefined" 91 PASS button.formEnctype is " undefined"92 PASS button.formMethod is " undefined"97 PASS button.formEnctype is "application/x-www-form-urlencoded" 98 PASS button.formMethod is "get" 93 99 PASS button.getAttribute("formMethod") is "undefined" 94 PASS button.formMethod is " undefined"100 PASS button.formMethod is "get" 95 101 PASS button.formTarget is "undefined" 96 102 PASS button.getAttribute("formTarget") is "undefined" 97 103 PASS button.formTarget is "undefined" 104 98 105 Setting non-string for button: 99 PASS button.formEnctype is " 256"106 PASS button.formEnctype is "application/x-www-form-urlencoded" 100 107 PASS button.getAttribute("formEnctype") is "256" 101 PASS button.formEnctype is " 512"102 PASS button.formMethod is " 128"108 PASS button.formEnctype is "application/x-www-form-urlencoded" 109 PASS button.formMethod is "get" 103 110 PASS button.getAttribute("formMethod") is "128" 104 PASS button.formMethod is " 17"111 PASS button.formMethod is "get" 105 112 PASS button.formTarget is "100" 106 113 PASS button.getAttribute("formTarget") is "100" -
trunk/Source/WebCore/ChangeLog
r96480 r96484 1 2011-10-02 Kent Tamura <tkent@chromium.org> 2 3 method/enctype/formMethod/formEnctype properties should be limited to known values. 4 https://bugs.webkit.org/show_bug.cgi?id=68887 5 6 Reviewed by Hajime Morita. 7 8 According to the standard and other browser behaviors, the 9 following IDL properties should be reflected to the corresponding 10 HTML attributes on setting, but should return normalized values on 11 getting. 12 - HTMLFormElement::method 13 - HTMLFormElement::enctype 14 - HTMLInputElement::formMethod 15 - HTMLInputElement::formEnctype 16 - HTMLButtonElement::formMethod 17 - HTMLButtonElement::formEnctype 18 19 Tests: fast/forms/enctype-attribute.html 20 fast/forms/method-attribute.html 21 22 * html/HTMLButtonElement.idl: 23 Replace 'Reflect' with 'ConvertNullToNullString' in order to use a 24 getter function. 25 * html/HTMLFormControlElement.cpp: 26 (WebCore::HTMLFormControlElement::formEnctype): 27 Normalizes the value by parseEncodingType(). 28 (WebCore::HTMLFormControlElement::setFormEnctype): 29 Simply calls setAttribute() 30 (WebCore::HTMLFormControlElement::formMethod): 31 Normalizes the value by parseMethodType(). 32 (WebCore::HTMLFormControlElement::setFormMethod): 33 Simply calls setAttribute() 34 * html/HTMLFormControlElement.h: 35 * html/HTMLFormElement.cpp: 36 (WebCore::HTMLFormElement::parseMappedAttribute): 37 Follow the Attributes function renaming. 38 (WebCore::HTMLFormElement::method): 39 Normalizes the value by parseMethodType(). 40 * html/HTMLFormElement.idl: 41 Replace 'Reflect' with 'ConvertNullToNullString' in order to use a 42 getter function. 43 * html/HTMLInputElement.idl: ditto. 44 * loader/FormSubmission.cpp: 45 (WebCore::FormSubmission::Attributes::parseEncodingType): 46 New function made from a part of old parseEncodingType(). 47 (WebCore::FormSubmission::Attributes::updateEncodingType): 48 Renamed from parseEncodingType(). 49 (WebCore::FormSubmission::Attributes::parseMethodType): 50 New function made from a part of old parseMethodType(). 51 (WebCore::FormSubmission::Attributes::updateMethodType): 52 Renamed from parseMethodType(). 53 (WebCore::FormSubmission::create): 54 Follow the Attributes function renaming. 55 * loader/FormSubmission.h: 56 (WebCore::FormSubmission::Attributes::methodString): 57 A helper function to provide normalized strings for FormSubmission::Method. 58 1 59 2011-10-02 Sam Weinig <sam@webkit.org> 2 60 -
trunk/Source/WebCore/html/HTMLButtonElement.idl
r92327 r96484 25 25 26 26 attribute [Reflect, URL] DOMString formAction; 27 attribute [ Reflect] DOMString formEnctype;28 attribute [ Reflect] DOMString formMethod;27 attribute [ConvertNullToNullString] DOMString formEnctype; 28 attribute [ConvertNullToNullString] DOMString formMethod; 29 29 attribute [Reflect] boolean formNoValidate; 30 30 attribute [Reflect] DOMString formTarget; -
trunk/Source/WebCore/html/HTMLFormControlElement.cpp
r96134 r96484 80 80 m_validationMessage = nullptr; 81 81 HTMLElement::detach(); 82 } 83 84 String HTMLFormControlElement::formEnctype() const 85 { 86 return FormSubmission::Attributes::parseEncodingType(fastGetAttribute(formenctypeAttr)); 87 } 88 89 void HTMLFormControlElement::setFormEnctype(const String& value) 90 { 91 setAttribute(formenctypeAttr, value); 92 } 93 94 String HTMLFormControlElement::formMethod() const 95 { 96 return FormSubmission::Attributes::methodString(FormSubmission::Attributes::parseMethodType(fastGetAttribute(formmethodAttr))); 97 } 98 99 void HTMLFormControlElement::setFormMethod(const String& value) 100 { 101 setAttribute(formmethodAttr, value); 82 102 } 83 103 -
trunk/Source/WebCore/html/HTMLFormControlElement.h
r96078 r96484 44 44 HTMLFormElement* form() const { return FormAssociatedElement::form(); } 45 45 46 String formEnctype() const; 47 void setFormEnctype(const String&); 48 String formMethod() const; 49 void setFormMethod(const String&); 46 50 bool formNoValidate() const; 47 51 -
trunk/Source/WebCore/html/HTMLFormElement.cpp
r94427 r96484 371 371 m_attributes.setTarget(attr->value()); 372 372 else if (attr->name() == methodAttr) 373 m_attributes. parseMethodType(attr->value());373 m_attributes.updateMethodType(attr->value()); 374 374 else if (attr->name() == enctypeAttr) 375 m_attributes. parseEncodingType(attr->value());375 m_attributes.updateEncodingType(attr->value()); 376 376 else if (attr->name() == accept_charsetAttr) 377 377 m_attributes.setAcceptCharset(attr->value()); … … 548 548 String HTMLFormElement::method() const 549 549 { 550 return getAttribute(methodAttr);550 return FormSubmission::Attributes::methodString(m_attributes.method()); 551 551 } 552 552 -
trunk/Source/WebCore/html/HTMLFormElement.idl
r89991 r96484 34 34 attribute [ConvertNullToNullString] DOMString encoding; 35 35 attribute [ConvertNullToNullString] DOMString enctype; 36 attribute [ Reflect] DOMString method;36 attribute [ConvertNullToNullString] DOMString method; 37 37 attribute [Reflect] DOMString target; 38 38 attribute [Reflect] DOMString autocomplete; -
trunk/Source/WebCore/html/HTMLInputElement.idl
r92327 r96484 26 26 readonly attribute HTMLFormElement form; 27 27 attribute [Reflect, URL] DOMString formAction; 28 attribute [ Reflect] DOMString formEnctype;29 attribute [ Reflect] DOMString formMethod;28 attribute [ConvertNullToNullString] DOMString formEnctype; 29 attribute [ConvertNullToNullString] DOMString formMethod; 30 30 attribute [Reflect] boolean formNoValidate; 31 31 attribute [Reflect] DOMString formTarget; -
trunk/Source/WebCore/loader/FormSubmission.cpp
r95901 r96484 89 89 } 90 90 91 void FormSubmission::Attributes::parseEncodingType(const String& type) 92 { 93 if (type.contains("multipart", false) || type.contains("form-data", false)) { 94 m_encodingType = "multipart/form-data"; 95 m_isMultiPartForm = true; 96 } else if (type.contains("text", false) || type.contains("plain", false)) { 97 m_encodingType = "text/plain"; 98 m_isMultiPartForm = false; 99 } else { 100 m_encodingType = "application/x-www-form-urlencoded"; 101 m_isMultiPartForm = false; 102 } 103 } 104 105 void FormSubmission::Attributes::parseMethodType(const String& type) 106 { 107 if (equalIgnoringCase(type, "post")) 108 m_method = FormSubmission::PostMethod; 109 else if (equalIgnoringCase(type, "get")) 110 m_method = FormSubmission::GetMethod; 91 String FormSubmission::Attributes::parseEncodingType(const String& type) 92 { 93 if (type.contains("multipart", false) || type.contains("form-data", false)) 94 return "multipart/form-data"; 95 if (type.contains("text", false) || type.contains("plain", false)) 96 return "text/plain"; 97 return "application/x-www-form-urlencoded"; 98 } 99 100 void FormSubmission::Attributes::updateEncodingType(const String& type) 101 { 102 m_encodingType = parseEncodingType(type); 103 m_isMultiPartForm = (m_encodingType == "multipart/form-data"); 104 } 105 106 FormSubmission::Method FormSubmission::Attributes::parseMethodType(const String& type) 107 { 108 return equalIgnoringCase(type, "post") ? FormSubmission::PostMethod : FormSubmission::GetMethod; 109 } 110 111 void FormSubmission::Attributes::updateMethodType(const String& type) 112 { 113 m_method = parseMethodType(type); 111 114 } 112 115 … … 150 153 copiedAttributes.parseAction(attributeValue); 151 154 if (!(attributeValue = submitButton->getAttribute(formenctypeAttr)).isNull()) 152 copiedAttributes. parseEncodingType(attributeValue);155 copiedAttributes.updateEncodingType(attributeValue); 153 156 if (!(attributeValue = submitButton->getAttribute(formmethodAttr)).isNull()) 154 copiedAttributes. parseMethodType(attributeValue);157 copiedAttributes.updateMethodType(attributeValue); 155 158 if (!(attributeValue = submitButton->getAttribute(formtargetAttr)).isNull()) 156 159 copiedAttributes.setTarget(attributeValue); -
trunk/Source/WebCore/loader/FormSubmission.h
r95901 r96484 59 59 60 60 Method method() const { return m_method; } 61 void parseMethodType(const String&); 61 static Method parseMethodType(const String&); 62 void updateMethodType(const String&); 63 static String methodString(Method method) { return method == PostMethod ? "post" : "get"; } 62 64 63 65 const String& action() const { return m_action; } … … 68 70 69 71 const String& encodingType() const { return m_encodingType; } 70 void parseEncodingType(const String&); 72 static String parseEncodingType(const String&); 73 void updateEncodingType(const String&); 71 74 bool isMultiPartForm() const { return m_isMultiPartForm; } 72 75
Note: See TracChangeset
for help on using the changeset viewer.