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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 , m_boundary(boundary) | 134 , m_boundary(boundary) |
135 , m_lockHistory(lockHistory) | 135 , m_lockHistory(lockHistory) |
136 , m_event(event) | 136 , m_event(event) |
137 { | 137 { |
138 } | 138 } |
139 | 139 |
140 PassRefPtr<FormSubmission> FormSubmission::create(HTMLFormElement* form, const A
ttributes& attributes, PassRefPtr<Event> event, bool lockHistory, FormSubmission
Trigger trigger) | 140 PassRefPtr<FormSubmission> FormSubmission::create(HTMLFormElement* form, const A
ttributes& attributes, PassRefPtr<Event> event, bool lockHistory, FormSubmission
Trigger trigger) |
141 { | 141 { |
142 ASSERT(form); | 142 ASSERT(form); |
143 | 143 |
144 HTMLFormControlElement* submitButton = 0; | 144 Handle<HTMLFormControlElement> submitButton; |
145 if (event && event->target()) { | 145 if (event && event->target()) { |
146 for (Node* node = event->target()->toNode(); node; node = node->parentNo
de()) { | 146 for (Node* node = event->target()->toNode(); node; node = node->parentNo
de()) { |
147 if (node->isElementNode() && toElement(node)->isFormControlElement()
) { | 147 if (node->isElementNode() && toElement(node)->isFormControlElement()
) { |
148 submitButton = static_cast<HTMLFormControlElement*>(node); | 148 submitButton = Handle<HTMLFormControlElement>(static_cast<HTMLFo
rmControlElement*>(node)); |
149 break; | 149 break; |
150 } | 150 } |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 FormSubmission::Attributes copiedAttributes; | 154 FormSubmission::Attributes copiedAttributes; |
155 copiedAttributes.copyFrom(attributes); | 155 copiedAttributes.copyFrom(attributes); |
156 if (submitButton) { | 156 if (submitButton) { |
157 String attributeValue; | 157 String attributeValue; |
158 if (!(attributeValue = submitButton->getAttribute(formactionAttr)).isNul
l()) | 158 if (!(attributeValue = submitButton->getAttribute(formactionAttr)).isNul
l()) |
(...skipping 24 matching lines...) Expand all Loading... |
183 RefPtr<DOMFormData> domFormData = DOMFormData::create(dataEncoding.encodingF
orFormSubmission()); | 183 RefPtr<DOMFormData> domFormData = DOMFormData::create(dataEncoding.encodingF
orFormSubmission()); |
184 Vector<pair<String, String> > formValues; | 184 Vector<pair<String, String> > formValues; |
185 | 185 |
186 bool containsPasswordData = false; | 186 bool containsPasswordData = false; |
187 for (unsigned i = 0; i < form->associatedElements().size(); ++i) { | 187 for (unsigned i = 0; i < form->associatedElements().size(); ++i) { |
188 FormAssociatedElement* control = form->associatedElements()[i]; | 188 FormAssociatedElement* control = form->associatedElements()[i]; |
189 HTMLElement* element = toHTMLElement(control); | 189 HTMLElement* element = toHTMLElement(control); |
190 if (!element->isDisabledFormControl()) | 190 if (!element->isDisabledFormControl()) |
191 control->appendFormData(*domFormData, isMultiPartForm); | 191 control->appendFormData(*domFormData, isMultiPartForm); |
192 if (element->hasLocalName(inputTag)) { | 192 if (element->hasLocalName(inputTag)) { |
193 HTMLInputElement* input = static_cast<HTMLInputElement*>(control); | 193 Handle<HTMLInputElement> input(static_cast<HTMLInputElement*>(contro
l)); |
194 if (input->isTextField()) { | 194 if (input->isTextField()) { |
195 formValues.append(pair<String, String>(input->name().string(), i
nput->value())); | 195 formValues.append(pair<String, String>(input->name().string(), i
nput->value())); |
196 input->addSearchResult(); | 196 input->addSearchResult(); |
197 } | 197 } |
198 if (input->isPasswordField() && !input->value().isEmpty()) | 198 if (input->isPasswordField() && !input->value().isEmpty()) |
199 containsPasswordData = true; | 199 containsPasswordData = true; |
200 } | 200 } |
201 } | 201 } |
202 | 202 |
203 RefPtr<FormData> formData; | 203 RefPtr<FormData> formData; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 frameRequest.resourceRequest().setHTTPContentType(m_contentType); | 249 frameRequest.resourceRequest().setHTTPContentType(m_contentType); |
250 else | 250 else |
251 frameRequest.resourceRequest().setHTTPContentType(m_contentType + ";
boundary=" + m_boundary); | 251 frameRequest.resourceRequest().setHTTPContentType(m_contentType + ";
boundary=" + m_boundary); |
252 } | 252 } |
253 | 253 |
254 frameRequest.resourceRequest().setURL(requestURL()); | 254 frameRequest.resourceRequest().setURL(requestURL()); |
255 FrameLoader::addHTTPOriginIfNeeded(frameRequest.resourceRequest(), m_origin)
; | 255 FrameLoader::addHTTPOriginIfNeeded(frameRequest.resourceRequest(), m_origin)
; |
256 } | 256 } |
257 | 257 |
258 } | 258 } |
OLD | NEW |