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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 FormDataList* dataList = FormDataList::create(*encoding); |
214 if (!control->appendFormData(*dataList, false)) | 214 if (!control->appendFormData(*dataList, false)) |
215 continue; | 215 continue; |
216 | 216 |
217 const FormDataList::FormDataListItems& items = dataList->items(); | 217 for (const FormDataList::Item& item : dataList->items()) { |
218 for (FormDataList::FormDataListItems::const_iterator j(items.begin()); j
!= items.end(); ++j) { | |
219 if (!encodedString->isEmpty()) | 218 if (!encodedString->isEmpty()) |
220 encodedString->append('&'); | 219 encodedString->append('&'); |
221 FormDataBuilder::encodeStringAsFormData(*encodedString, j->data()); | 220 FormDataBuilder::encodeStringAsFormData(*encodedString, item.key()); |
222 encodedString->append('='); | 221 encodedString->append('='); |
223 ++j; | |
224 if (control == textElement) { | 222 if (control == textElement) { |
225 encodedString->append("{searchTerms}", 13); | 223 encodedString->append("{searchTerms}", 13); |
226 isElementFound = true; | 224 isElementFound = true; |
227 } else | 225 } else { |
228 FormDataBuilder::encodeStringAsFormData(*encodedString, j->data(
)); | 226 FormDataBuilder::encodeStringAsFormData(*encodedString, item.dat
a()); |
| 227 } |
229 } | 228 } |
230 } | 229 } |
231 return isElementFound; | 230 return isElementFound; |
232 } | 231 } |
233 } // namespace | 232 } // namespace |
234 | 233 |
235 WebSearchableFormData::WebSearchableFormData(const WebFormElement& form, const W
ebInputElement& selectedInputElement) | 234 WebSearchableFormData::WebSearchableFormData(const WebFormElement& form, const W
ebInputElement& selectedInputElement) |
236 { | 235 { |
237 RefPtrWillBeRawPtr<HTMLFormElement> formElement = static_cast<PassRefPtrWill
BeRawPtr<HTMLFormElement>>(form); | 236 RefPtrWillBeRawPtr<HTMLFormElement> formElement = static_cast<PassRefPtrWill
BeRawPtr<HTMLFormElement>>(form); |
238 HTMLInputElement* inputElement = static_cast<PassRefPtrWillBeRawPtr<HTMLInpu
tElement>>(selectedInputElement).get(); | 237 HTMLInputElement* inputElement = static_cast<PassRefPtrWillBeRawPtr<HTMLInpu
tElement>>(selectedInputElement).get(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 282 |
284 String action(formElement->action()); | 283 String action(formElement->action()); |
285 KURL url(formElement->document().completeURL(action.isNull() ? "" : action))
; | 284 KURL url(formElement->document().completeURL(action.isNull() ? "" : action))
; |
286 RefPtr<FormData> formData = FormData::create(encodedString); | 285 RefPtr<FormData> formData = FormData::create(encodedString); |
287 url.setQuery(formData->flattenToString()); | 286 url.setQuery(formData->flattenToString()); |
288 m_url = url; | 287 m_url = url; |
289 m_encoding = String(encoding.name()); | 288 m_encoding = String(encoding.name()); |
290 } | 289 } |
291 | 290 |
292 } // namespace blink | 291 } // namespace blink |
OLD | NEW |