Changeset 72003 in webkit
- Timestamp:
- Nov 15, 2010 4:43:05 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 17 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r72000 r72003 1 2010-11-15 Dai Mikurube <dmikurube@google.com> 2 3 Reviewed by Kent Tamura. 4 5 Implement formaction, formenctype, formmethod and formtarget attributes for input and button tags 6 https://bugs.webkit.org/show_bug.cgi?id=49240 7 8 * fast/forms/formaction-attribute-expected.txt: Added. 9 * fast/forms/formaction-attribute.html: Added. 10 * fast/forms/formmethod-attribute-button-html-expected.txt: Added. 11 * fast/forms/formmethod-attribute-button-html.html: Added. 12 * fast/forms/formmethod-attribute-input-html-expected.txt: Added. 13 * fast/forms/formmethod-attribute-input-html.html: Added. 14 * fast/forms/formtarget-attribute-button-html-expected.txt: Added. 15 * fast/forms/formtarget-attribute-button-html.html: Added. 16 * fast/forms/formtarget-attribute-input-html-expected.txt: Added. 17 * fast/forms/formtarget-attribute-input-html.html: Added. 18 * fast/forms/mailto/formenctype-attribute-button-html-expected.txt: Added. 19 * fast/forms/mailto/formenctype-attribute-button-html.html: Added. 20 * fast/forms/mailto/formenctype-attribute-input-html-expected.txt: Added. 21 * fast/forms/mailto/formenctype-attribute-input-html.html: Added. 22 * fast/forms/script-tests/submit-form-attributes.js: Added. 23 * fast/forms/submit-form-attributes-expected.txt: Added. 24 * fast/forms/submit-form-attributes.html: Added. 25 1 26 2010-11-15 Alejandro G. Castro <alex@igalia.com> 2 27 -
trunk/WebCore/ChangeLog
r72002 r72003 1 2010-11-15 Dai Mikurube <dmikurube@google.com> 2 3 Reviewed by Kent Tamura. 4 5 Implement formaction, formenctype, formmethod and formtarget attributes for input and button tags 6 https://bugs.webkit.org/show_bug.cgi?id=49240 7 8 Tests: fast/forms/formaction-attribute.html 9 fast/forms/formmethod-attribute-button-html.html 10 fast/forms/formmethod-attribute-input-html.html 11 fast/forms/formtarget-attribute-button-html.html 12 fast/forms/formtarget-attribute-input-html.html 13 fast/forms/mailto/formenctype-attribute-button-html.html 14 fast/forms/mailto/formenctype-attribute-input-html.html 15 fast/forms/submit-form-attributes.html 16 17 * html/HTMLAttributeNames.in: Added formaction, formmethod, formtarget and formenctype attributes 18 * html/HTMLButtonElement.idl: 19 * html/HTMLInputElement.idl: 20 * loader/FormSubmission.cpp: Modified to check the pressed button and its attributes 21 (WebCore::FormSubmission::Attributes::copyFrom): 22 (WebCore::FormSubmission::create): 23 * loader/FormSubmission.h: 24 1 25 2010-11-15 Pavel Feldman <pfeldman@chromium.org> 2 26 -
trunk/WebCore/html/HTMLAttributeNames.in
r71994 r72003 96 96 for 97 97 form 98 formaction 99 formenctype 100 formmethod 98 101 formnovalidate 102 formtarget 99 103 frame 100 104 frameborder -
trunk/WebCore/html/HTMLButtonElement.idl
r61413 r72003 24 24 readonly attribute HTMLFormElement form; 25 25 26 attribute [Reflect, URL] DOMString formAction; 27 attribute [Reflect] DOMString formEnctype; 28 attribute [Reflect] DOMString formMethod; 26 29 attribute [Reflect] boolean formNoValidate; 30 attribute [Reflect] DOMString formTarget; 27 31 readonly attribute ValidityState validity; 28 32 -
trunk/WebCore/html/HTMLInputElement.idl
r71880 r72003 25 25 attribute [Reflect=checked] boolean defaultChecked; 26 26 readonly attribute HTMLFormElement form; 27 attribute [Reflect, URL] DOMString formAction; 28 attribute [Reflect] DOMString formEnctype; 29 attribute [Reflect] DOMString formMethod; 27 30 attribute [Reflect] boolean formNoValidate; 31 attribute [Reflect] DOMString formTarget; 28 32 readonly attribute ValidityState validity; 29 33 attribute [Reflect] DOMString accept; -
trunk/WebCore/loader/FormSubmission.cpp
r68854 r72003 111 111 } 112 112 113 void FormSubmission::Attributes::copyFrom(const Attributes& other) 114 { 115 m_method = other.m_method; 116 m_isMultiPartForm = other.m_isMultiPartForm; 117 118 m_action = other.m_action; 119 m_target = other.m_target; 120 m_encodingType = other.m_encodingType; 121 m_acceptCharset = other.m_acceptCharset; 122 } 123 113 124 inline FormSubmission::FormSubmission(Method method, const KURL& action, const String& target, const String& contentType, PassRefPtr<FormState> state, PassRefPtr<FormData> data, const String& boundary, bool lockHistory, PassRefPtr<Event> event) 114 125 : m_method(method) … … 127 138 { 128 139 ASSERT(form); 140 141 HTMLFormControlElement* submitButton = 0; 142 if (event && event->target() && event->target()->toNode()) 143 submitButton = static_cast<HTMLFormControlElement*>(event->target()->toNode()); 144 145 FormSubmission::Attributes copiedAttributes; 146 copiedAttributes.copyFrom(attributes); 147 if (submitButton) { 148 String attributeValue; 149 if (!(attributeValue = submitButton->getAttribute(formactionAttr)).isNull()) 150 copiedAttributes.parseAction(attributeValue); 151 if (!(attributeValue = submitButton->getAttribute(formenctypeAttr)).isNull()) 152 copiedAttributes.parseEncodingType(attributeValue); 153 if (!(attributeValue = submitButton->getAttribute(formmethodAttr)).isNull()) 154 copiedAttributes.parseMethodType(attributeValue); 155 if (!(attributeValue = submitButton->getAttribute(formtargetAttr)).isNull()) 156 copiedAttributes.setTarget(attributeValue); 157 } 158 129 159 Document* document = form->document(); 130 KURL actionURL = document->completeURL( attributes.action().isEmpty() ? document->url().string() : attributes.action());160 KURL actionURL = document->completeURL(copiedAttributes.action().isEmpty() ? document->url().string() : copiedAttributes.action()); 131 161 bool isMailtoForm = actionURL.protocolIs("mailto"); 132 162 bool isMultiPartForm = false; 133 String encodingType = attributes.encodingType();134 135 if ( attributes.method() == PostMethod) {136 isMultiPartForm = attributes.isMultiPartForm();163 String encodingType = copiedAttributes.encodingType(); 164 165 if (copiedAttributes.method() == PostMethod) { 166 isMultiPartForm = copiedAttributes.isMultiPartForm(); 137 167 if (isMultiPartForm && isMailtoForm) { 138 168 encodingType = "application/x-www-form-urlencoded"; … … 141 171 } 142 172 143 TextEncoding dataEncoding = isMailtoForm ? UTF8Encoding() : FormDataBuilder::encodingFromAcceptCharset( attributes.acceptCharset(), document);173 TextEncoding dataEncoding = isMailtoForm ? UTF8Encoding() : FormDataBuilder::encodingFromAcceptCharset(copiedAttributes.acceptCharset(), document); 144 174 RefPtr<DOMFormData> domFormData = DOMFormData::create(dataEncoding.encodingForFormSubmission()); 145 175 Vector<pair<String, String> > formValues; … … 167 197 } else { 168 198 formData = FormData::create(*(static_cast<FormDataList*>(domFormData.get())), domFormData->encoding()); 169 if ( attributes.method() == PostMethod && isMailtoForm) {199 if (copiedAttributes.method() == PostMethod && isMailtoForm) { 170 200 // Convert the form data into a string that we put into the URL. 171 201 appendMailtoPostFormDataToURL(actionURL, *formData, encodingType); … … 175 205 176 206 formData->setIdentifier(generateFormDataIdentifier()); 177 String targetOrBaseTarget = attributes.target().isEmpty() ? document->baseTarget() : attributes.target();207 String targetOrBaseTarget = copiedAttributes.target().isEmpty() ? document->baseTarget() : copiedAttributes.target(); 178 208 RefPtr<FormState> formState = FormState::create(form, formValues, document->frame(), trigger); 179 return adoptRef(new FormSubmission( attributes.method(), actionURL, targetOrBaseTarget, encodingType, formState.release(), formData.release(), boundary, lockHistory, event));209 return adoptRef(new FormSubmission(copiedAttributes.method(), actionURL, targetOrBaseTarget, encodingType, formState.release(), formData.release(), boundary, lockHistory, event)); 180 210 } 181 211 -
trunk/WebCore/loader/FormSubmission.h
r65340 r72003 73 73 void setAcceptCharset(const String& value) { m_acceptCharset = value; } 74 74 75 void copyFrom(const Attributes&); 76 75 77 private: 76 78 Method m_method;
Note: See TracChangeset
for help on using the changeset viewer.