OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 16 matching lines...) Expand all Loading... |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "public/web/WebSearchableFormData.h" | 32 #include "public/web/WebSearchableFormData.h" |
33 | 33 |
34 #include "core/HTMLNames.h" | 34 #include "core/HTMLNames.h" |
35 #include "core/InputTypeNames.h" | 35 #include "core/InputTypeNames.h" |
36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
37 #include "core/html/DOMFormData.h" | 37 #include "core/html/FormData.h" |
38 #include "core/html/HTMLFormControlElement.h" | 38 #include "core/html/HTMLFormControlElement.h" |
39 #include "core/html/HTMLFormElement.h" | 39 #include "core/html/HTMLFormElement.h" |
40 #include "core/html/HTMLInputElement.h" | 40 #include "core/html/HTMLInputElement.h" |
41 #include "core/html/HTMLOptionElement.h" | 41 #include "core/html/HTMLOptionElement.h" |
42 #include "core/html/HTMLSelectElement.h" | 42 #include "core/html/HTMLSelectElement.h" |
43 #include "platform/network/FormDataEncoder.h" | 43 #include "platform/network/FormDataEncoder.h" |
44 #include "public/web/WebFormElement.h" | 44 #include "public/web/WebFormElement.h" |
45 #include "public/web/WebInputElement.h" | 45 #include "public/web/WebInputElement.h" |
46 #include "wtf/text/TextEncoding.h" | 46 #include "wtf/text/TextEncoding.h" |
47 | 47 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 { | 203 { |
204 bool isElementFound = false; | 204 bool isElementFound = false; |
205 for (const auto& item : form.associatedElements()) { | 205 for (const auto& item : form.associatedElements()) { |
206 if (!item->isFormControlElement()) | 206 if (!item->isFormControlElement()) |
207 continue; | 207 continue; |
208 | 208 |
209 HTMLFormControlElement& control = toHTMLFormControlElement(*item); | 209 HTMLFormControlElement& control = toHTMLFormControlElement(*item); |
210 if (control.isDisabledFormControl() || control.name().isNull()) | 210 if (control.isDisabledFormControl() || control.name().isNull()) |
211 continue; | 211 continue; |
212 | 212 |
213 DOMFormData* formData = DOMFormData::create(encoding); | 213 FormData* formData = FormData::create(encoding); |
214 if (!control.appendFormData(*formData, false)) | 214 if (!control.appendFormData(*formData, false)) |
215 continue; | 215 continue; |
216 | 216 |
217 for (const FormDataList::Item& item : formData->items()) { | 217 for (const FormDataList::Item& item : formData->items()) { |
218 if (!encodedString->isEmpty()) | 218 if (!encodedString->isEmpty()) |
219 encodedString->append('&'); | 219 encodedString->append('&'); |
220 FormDataEncoder::encodeStringAsFormData(*encodedString, item.key()); | 220 FormDataEncoder::encodeStringAsFormData(*encodedString, item.key()); |
221 encodedString->append('='); | 221 encodedString->append('='); |
222 if (&control == textElement) { | 222 if (&control == textElement) { |
223 encodedString->append("{searchTerms}", 13); | 223 encodedString->append("{searchTerms}", 13); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 282 |
283 String action(formElement->action()); | 283 String action(formElement->action()); |
284 KURL url(formElement->document().completeURL(action.isNull() ? "" : action))
; | 284 KURL url(formElement->document().completeURL(action.isNull() ? "" : action))
; |
285 RefPtr<EncodedFormData> formData = EncodedFormData::create(encodedString); | 285 RefPtr<EncodedFormData> formData = EncodedFormData::create(encodedString); |
286 url.setQuery(formData->flattenToString()); | 286 url.setQuery(formData->flattenToString()); |
287 m_url = url; | 287 m_url = url; |
288 m_encoding = String(encoding.name()); | 288 m_encoding = String(encoding.name()); |
289 } | 289 } |
290 | 290 |
291 } // namespace blink | 291 } // namespace blink |
OLD | NEW |