Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Side by Side Diff: WebKit/chromium/src/WebSearchableFormData.cpp

Issue 1769002: BlobBuilder/FormData refactor attempt (Closed)
Patch Set: back to simple FormData Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « WebKit/chromium/ChangeLog ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 default: 180 default:
181 // All other input types are indexable. 181 // All other input types are indexable.
182 break; 182 break;
183 } 183 }
184 } 184 }
185 185
186 FormDataList dataList(encoding); 186 FormDataList dataList(encoding);
187 if (!formElement->appendFormData(dataList, false)) 187 if (!formElement->appendFormData(dataList, false))
188 continue; 188 continue;
189 189
190 const Vector<FormDataList::Item>& itemList = dataList.list(); 190 const BlobItemList& items = dataList.items();
191 if (isTextElement && !itemList.isEmpty()) { 191 if (isTextElement && !items.isEmpty()) {
192 if (textElement) { 192 if (textElement) {
193 // The auto-complete bar only knows how to fill in one value. 193 // The auto-complete bar only knows how to fill in one value.
194 // This form has multiple fields; don't treat it as searchable. 194 // This form has multiple fields; don't treat it as searchable.
195 return false; 195 return false;
196 } 196 }
197 textElement = static_cast<HTMLInputElement*>(formElement); 197 textElement = static_cast<HTMLInputElement*>(formElement);
198 } 198 }
199 for (Vector<FormDataList::Item>::const_iterator j(itemList.begin()); j != itemList.end(); ++j) { 199 for (BlobItemList::const_iterator j(items.begin()); j != items.end(); ++j) {
200 const StringBlobItem* item = (*j)->toStringBlobItem();
201 if (!item)
202 continue;
200 // Handle ISINDEX / <input name=isindex> specially, but only if it's 203 // Handle ISINDEX / <input name=isindex> specially, but only if it's
201 // the first entry. 204 // the first entry.
202 if (!encodedString->isEmpty() || j->data() != "isindex") { 205 if (!encodedString->isEmpty() || item->cstr() != "isindex") {
203 if (!encodedString->isEmpty()) 206 if (!encodedString->isEmpty())
204 encodedString->append('&'); 207 encodedString->append('&');
205 FormDataBuilder::encodeStringAsFormData(*encodedString, j->data()) ; 208 FormDataBuilder::encodeStringAsFormData(*encodedString, item->cstr ());
206 encodedString->append('='); 209 encodedString->append('=');
207 } 210 }
208 ++j; 211 ++j;
209 if (formElement == textElement) 212 if (formElement == textElement)
210 encodedString->append("{searchTerms}", 13); 213 encodedString->append("{searchTerms}", 13);
211 else 214 else
212 FormDataBuilder::encodeStringAsFormData(*encodedString, j->data()) ; 215 FormDataBuilder::encodeStringAsFormData(*encodedString, item->cstr ());
213 } 216 }
214 } 217 }
215 218
216 return textElement; 219 return textElement;
217 } 220 }
218 221
219 } // namespace 222 } // namespace
220 223
221 namespace WebKit { 224 namespace WebKit {
222 225
(...skipping 27 matching lines...) Expand all
250 253
251 String action(formElement->action()); 254 String action(formElement->action());
252 KURL url(frame->loader()->completeURL(action.isNull() ? "" : action)); 255 KURL url(frame->loader()->completeURL(action.isNull() ? "" : action));
253 RefPtr<FormData> formData = FormData::create(encodedString); 256 RefPtr<FormData> formData = FormData::create(encodedString);
254 url.setQuery(formData->flattenToString()); 257 url.setQuery(formData->flattenToString());
255 m_url = url; 258 m_url = url;
256 m_encoding = encoding; 259 m_encoding = encoding;
257 } 260 }
258 261
259 } // namespace WebKit 262 } // namespace WebKit
OLDNEW
« no previous file with comments | « WebKit/chromium/ChangeLog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698