| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 String FormSubmission::Attributes::methodString(SubmitMethod method) | 122 String FormSubmission::Attributes::methodString(SubmitMethod method) |
| 123 { | 123 { |
| 124 switch (method) { | 124 switch (method) { |
| 125 case GetMethod: | 125 case GetMethod: |
| 126 return "get"; | 126 return "get"; |
| 127 case PostMethod: | 127 case PostMethod: |
| 128 return "post"; | 128 return "post"; |
| 129 case DialogMethod: | 129 case DialogMethod: |
| 130 return "dialog"; | 130 return "dialog"; |
| 131 } | 131 } |
| 132 ASSERT_NOT_REACHED(); | 132 NOTREACHED(); |
| 133 return emptyString(); | 133 return emptyString(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void FormSubmission::Attributes::copyFrom(const Attributes& other) | 136 void FormSubmission::Attributes::copyFrom(const Attributes& other) |
| 137 { | 137 { |
| 138 m_method = other.m_method; | 138 m_method = other.m_method; |
| 139 m_isMultiPartForm = other.m_isMultiPartForm; | 139 m_isMultiPartForm = other.m_isMultiPartForm; |
| 140 | 140 |
| 141 m_action = other.m_action; | 141 m_action = other.m_action; |
| 142 m_target = other.m_target; | 142 m_target = other.m_target; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 157 } | 157 } |
| 158 | 158 |
| 159 inline FormSubmission::FormSubmission(const String& result) | 159 inline FormSubmission::FormSubmission(const String& result) |
| 160 : m_method(DialogMethod) | 160 : m_method(DialogMethod) |
| 161 , m_result(result) | 161 , m_result(result) |
| 162 { | 162 { |
| 163 } | 163 } |
| 164 | 164 |
| 165 FormSubmission* FormSubmission::create(HTMLFormElement* form, const Attributes&
attributes, Event* event) | 165 FormSubmission* FormSubmission::create(HTMLFormElement* form, const Attributes&
attributes, Event* event) |
| 166 { | 166 { |
| 167 ASSERT(form); | 167 DCHECK(form); |
| 168 | 168 |
| 169 HTMLFormControlElement* submitButton = 0; | 169 HTMLFormControlElement* submitButton = 0; |
| 170 if (event && event->target()) { | 170 if (event && event->target()) { |
| 171 for (Node* node = event->target()->toNode(); node; node = node->parentOr
ShadowHostNode()) { | 171 for (Node* node = event->target()->toNode(); node; node = node->parentOr
ShadowHostNode()) { |
| 172 if (node->isElementNode() && toElement(node)->isFormControlElement()
) { | 172 if (node->isElementNode() && toElement(node)->isFormControlElement()
) { |
| 173 submitButton = toHTMLFormControlElement(node); | 173 submitButton = toHTMLFormControlElement(node); |
| 174 break; | 174 break; |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 } | 177 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 encodingType = AtomicString("application/x-www-form-urlencoded"); | 216 encodingType = AtomicString("application/x-www-form-urlencoded"); |
| 217 isMultiPartForm = false; | 217 isMultiPartForm = false; |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 WTF::TextEncoding dataEncoding = isMailtoForm ? UTF8Encoding() : FormDataEnc
oder::encodingFromAcceptCharset(copiedAttributes.acceptCharset(), document.encod
ing()); | 220 WTF::TextEncoding dataEncoding = isMailtoForm ? UTF8Encoding() : FormDataEnc
oder::encodingFromAcceptCharset(copiedAttributes.acceptCharset(), document.encod
ing()); |
| 221 FormData* domFormData = FormData::create(dataEncoding.encodingForFormSubmiss
ion()); | 221 FormData* domFormData = FormData::create(dataEncoding.encodingForFormSubmiss
ion()); |
| 222 | 222 |
| 223 bool containsPasswordData = false; | 223 bool containsPasswordData = false; |
| 224 for (unsigned i = 0; i < form->associatedElements().size(); ++i) { | 224 for (unsigned i = 0; i < form->associatedElements().size(); ++i) { |
| 225 FormAssociatedElement* control = form->associatedElements()[i]; | 225 FormAssociatedElement* control = form->associatedElements()[i]; |
| 226 ASSERT(control); | 226 DCHECK(control); |
| 227 HTMLElement& element = toHTMLElement(*control); | 227 HTMLElement& element = toHTMLElement(*control); |
| 228 if (!element.isDisabledFormControl()) | 228 if (!element.isDisabledFormControl()) |
| 229 control->appendToFormData(*domFormData); | 229 control->appendToFormData(*domFormData); |
| 230 if (isHTMLInputElement(element)) { | 230 if (isHTMLInputElement(element)) { |
| 231 HTMLInputElement& input = toHTMLInputElement(element); | 231 HTMLInputElement& input = toHTMLInputElement(element); |
| 232 if (input.type() == InputTypeNames::password && !input.value().isEmp
ty()) | 232 if (input.type() == InputTypeNames::password && !input.value().isEmp
ty()) |
| 233 containsPasswordData = true; | 233 containsPasswordData = true; |
| 234 } | 234 } |
| 235 } | 235 } |
| 236 | 236 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 291 |
| 292 frameRequest.resourceRequest().setURL(requestURL()); | 292 frameRequest.resourceRequest().setURL(requestURL()); |
| 293 | 293 |
| 294 frameRequest.setTriggeringEvent(m_event); | 294 frameRequest.setTriggeringEvent(m_event); |
| 295 frameRequest.setForm(m_form); | 295 frameRequest.setForm(m_form); |
| 296 | 296 |
| 297 return frameRequest; | 297 return frameRequest; |
| 298 } | 298 } |
| 299 | 299 |
| 300 } // namespace blink | 300 } // namespace blink |
| OLD | NEW |