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

Side by Side Diff: chrome/renderer/autofill/form_autofill_util.cc

Issue 12084024: Use WebInputElement.isCheckbox() and isRadioButton() API being exposed by https://bugs.webkit.org/s… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added TODO for select. Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/test/data/autofill/heuristics/output/02_checkout_advanceautoparts.com.out » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/autofill/form_autofill_util.h" 5 #include "chrome/renderer/autofill/form_autofill_util.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 bool IsTextInput(const WebInputElement* element) { 563 bool IsTextInput(const WebInputElement* element) {
564 if (!element) 564 if (!element)
565 return false; 565 return false;
566 566
567 return element->isTextField() && !element->isPasswordField(); 567 return element->isTextField() && !element->isPasswordField();
568 } 568 }
569 569
570 bool IsSelectElement(const WebFormControlElement& element) { 570 bool IsSelectElement(const WebFormControlElement& element) {
571 // Is static for improving performance. 571 // Is static for improving performance.
572 CR_DEFINE_STATIC_LOCAL(WebString, kSelectOne, ("select-one")); 572 CR_DEFINE_STATIC_LOCAL(WebString, kSelectOne, ("select-one"));
573 // TODO: Fix issue 172665 by avoiding string comparision.
Ilya Sherman 2013/01/28 21:14:53 TODO's should have names associated with them, e.g
Raman Kakilate 2013/01/29 21:49:27 Removed the comment as issue is filed.
573 return element.formControlType() == kSelectOne; 574 return element.formControlType() == kSelectOne;
574 } 575 }
575 576
576 bool IsCheckableElement(const WebInputElement* element) { 577 bool IsCheckableElement(const WebInputElement* element) {
577 // Is static for improving performance.
578 CR_DEFINE_STATIC_LOCAL(WebString, kRadio, ("radio"));
579 CR_DEFINE_STATIC_LOCAL(WebString, kCheckbox, ("checkbox"));
580
581 if (!element) 578 if (!element)
582 return false; 579 return false;
583 580
584 WebString formControlType = element->formControlType(); 581 return element->isCheckbox() || element->isRadioButton();
585 return formControlType == kCheckbox || formControlType == kRadio;
586 } 582 }
587 583
588 bool IsAutofillableInputElement(const WebInputElement* element) { 584 bool IsAutofillableInputElement(const WebInputElement* element) {
589 // TODO(ramankk): Uncomment IsCheckableElement part once we have solution 585 return IsTextInput(element) || IsCheckableElement(element);
590 // for the observed performance regression.
591 return IsTextInput(element); // || IsCheckableElement(element);
592 } 586 }
593 587
594 const string16 GetFormIdentifier(const WebFormElement& form) { 588 const string16 GetFormIdentifier(const WebFormElement& form) {
595 string16 identifier = form.name(); 589 string16 identifier = form.name();
596 if (identifier.empty()) 590 if (identifier.empty())
597 identifier = form.getAttribute(WebString("id")); 591 identifier = form.getAttribute(WebString("id"));
598 592
599 return identifier; 593 return identifier;
600 } 594 }
601 595
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 continue; 981 continue;
988 982
989 if (input_element->isAutofilled()) 983 if (input_element->isAutofilled())
990 return true; 984 return true;
991 } 985 }
992 986
993 return false; 987 return false;
994 } 988 }
995 989
996 } // namespace autofill 990 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/autofill/heuristics/output/02_checkout_advanceautoparts.com.out » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698