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/FormDataList.h" | 37 #include "core/html/DOMFormData.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/FormDataBuilder.h" | 43 #include "platform/network/FormDataBuilder.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 const FormAssociatedElement::List& elements = form->associatedElements(); | 203 const FormAssociatedElement::List& elements = form->associatedElements(); |
204 for (FormAssociatedElement::List::const_iterator i(elements.begin()); i != e
lements.end(); ++i) { | 204 for (FormAssociatedElement::List::const_iterator i(elements.begin()); i != e
lements.end(); ++i) { |
205 if (!(*i)->isFormControlElement()) | 205 if (!(*i)->isFormControlElement()) |
206 continue; | 206 continue; |
207 | 207 |
208 HTMLFormControlElement* control = toHTMLFormControlElement(*i); | 208 HTMLFormControlElement* control = toHTMLFormControlElement(*i); |
209 | 209 |
210 if (control->isDisabledFormControl() || control->name().isNull()) | 210 if (control->isDisabledFormControl() || control->name().isNull()) |
211 continue; | 211 continue; |
212 | 212 |
213 FormDataList* dataList = FormDataList::create(*encoding); | 213 DOMFormData* formData = DOMFormData::create(*encoding); |
214 if (!control->appendFormData(*dataList, false)) | 214 if (!control->appendFormData(*formData, false)) |
215 continue; | 215 continue; |
216 | 216 |
217 for (const FormDataList::Item& item : dataList->items()) { | 217 for (const FormDataList::Item& item : formData->items()) { |
218 if (!encodedString->isEmpty()) | 218 if (!encodedString->isEmpty()) |
219 encodedString->append('&'); | 219 encodedString->append('&'); |
220 FormDataBuilder::encodeStringAsFormData(*encodedString, item.key()); | 220 FormDataBuilder::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); |
224 isElementFound = true; | 224 isElementFound = true; |
225 } else { | 225 } else { |
226 FormDataBuilder::encodeStringAsFormData(*encodedString, item.dat
a()); | 226 FormDataBuilder::encodeStringAsFormData(*encodedString, item.dat
a()); |
227 } | 227 } |
(...skipping 54 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<FormData> formData = FormData::create(encodedString); | 285 RefPtr<FormData> formData = FormData::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 |