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

Side by Side Diff: Source/web/WebSearchableFormData.cpp

Issue 19096009: Use isHTMLTextAreaElement and toHTMLTextAreaElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 years, 5 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 | « Source/web/WebFrameImpl.cpp ('k') | Source/web/WebViewImpl.cpp » ('j') | 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 24 matching lines...) Expand all
35 #include "WebFormElement.h" 35 #include "WebFormElement.h"
36 #include "WebInputElement.h" 36 #include "WebInputElement.h"
37 #include "core/dom/Document.h" 37 #include "core/dom/Document.h"
38 #include "core/html/FormDataList.h" 38 #include "core/html/FormDataList.h"
39 #include "core/html/HTMLFormControlElement.h" 39 #include "core/html/HTMLFormControlElement.h"
40 #include "core/html/HTMLFormElement.h" 40 #include "core/html/HTMLFormElement.h"
41 #include "core/html/HTMLInputElement.h" 41 #include "core/html/HTMLInputElement.h"
42 #include "core/html/HTMLOptionElement.h" 42 #include "core/html/HTMLOptionElement.h"
43 #include "core/html/HTMLOptionsCollection.h" 43 #include "core/html/HTMLOptionsCollection.h"
44 #include "core/html/HTMLSelectElement.h" 44 #include "core/html/HTMLSelectElement.h"
45 #include "core/html/HTMLTextAreaElement.h"
45 #include "core/loader/DocumentLoader.h" 46 #include "core/loader/DocumentLoader.h"
46 #include "core/page/Frame.h" 47 #include "core/page/Frame.h"
47 #include "core/platform/network/FormDataBuilder.h" 48 #include "core/platform/network/FormDataBuilder.h"
48 #include "wtf/text/TextEncoding.h" 49 #include "wtf/text/TextEncoding.h"
49 50
50 using namespace WebCore; 51 using namespace WebCore;
51 using namespace HTMLNames; 52 using namespace HTMLNames;
52 53
53 namespace { 54 namespace {
54 55
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // FIXME: Consider refactoring this code so that we don't call form->associa tedElements() twice. 160 // FIXME: Consider refactoring this code so that we don't call form->associa tedElements() twice.
160 for (Vector<FormAssociatedElement*>::const_iterator i(form->associatedElemen ts().begin()); i != form->associatedElements().end(); ++i) { 161 for (Vector<FormAssociatedElement*>::const_iterator i(form->associatedElemen ts().begin()); i != form->associatedElements().end(); ++i) {
161 if (!(*i)->isFormControlElement()) 162 if (!(*i)->isFormControlElement())
162 continue; 163 continue;
163 164
164 HTMLFormControlElement* control = toHTMLFormControlElement(*i); 165 HTMLFormControlElement* control = toHTMLFormControlElement(*i);
165 166
166 if (control->isDisabledFormControl() || control->name().isNull()) 167 if (control->isDisabledFormControl() || control->name().isNull())
167 continue; 168 continue;
168 169
169 if (!IsInDefaultState(control) || control->hasTagName(HTMLNames::textare aTag)) 170 if (!IsInDefaultState(control) || isHTMLTextAreaElement(control))
170 return 0; 171 return 0;
171 172
172 if (control->hasTagName(HTMLNames::inputTag) && control->willValidate()) { 173 if (control->hasTagName(HTMLNames::inputTag) && control->willValidate()) {
173 const HTMLInputElement* input = toHTMLInputElement(control); 174 const HTMLInputElement* input = toHTMLInputElement(control);
174 175
175 // Return nothing if a file upload field or a password field are fou nd. 176 // Return nothing if a file upload field or a password field are fou nd.
176 if (input->isFileUpload() || input->isPasswordField()) 177 if (input->isFileUpload() || input->isPasswordField())
177 return 0; 178 return 0;
178 179
179 if (input->isTextField()) { 180 if (input->isTextField()) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 290
290 String action(formElement->action()); 291 String action(formElement->action());
291 KURL url(formElement->document()->completeURL(action.isNull() ? "" : action) ); 292 KURL url(formElement->document()->completeURL(action.isNull() ? "" : action) );
292 RefPtr<FormData> formData = FormData::create(encodedString); 293 RefPtr<FormData> formData = FormData::create(encodedString);
293 url.setQuery(formData->flattenToString()); 294 url.setQuery(formData->flattenToString());
294 m_url = url; 295 m_url = url;
295 m_encoding = String(encoding.name()); 296 m_encoding = String(encoding.name());
296 } 297 }
297 298
298 } // namespace WebKit 299 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/web/WebFrameImpl.cpp ('k') | Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698