OLD | NEW |
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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 return element.formControlType() == kSelectOne; | 573 return element.formControlType() == kSelectOne; |
574 } | 574 } |
575 | 575 |
576 bool IsCheckableElement(const WebInputElement* element) { | 576 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 |
577 if (!element) | 581 if (!element) |
578 return false; | 582 return false; |
579 | 583 |
580 return element->isCheckbox() || element->isRadioButton(); | 584 WebString formControlType = element->formControlType(); |
| 585 return formControlType == kCheckbox || formControlType == kRadio; |
581 } | 586 } |
582 | 587 |
583 bool IsAutofillableInputElement(const WebInputElement* element) { | 588 bool IsAutofillableInputElement(const WebInputElement* element) { |
584 return IsTextInput(element) || IsCheckableElement(element); | 589 // TODO(ramankk): Uncomment IsCheckableElement part once we have solution |
| 590 // for the observed performance regression. |
| 591 return IsTextInput(element); // || IsCheckableElement(element); |
585 } | 592 } |
586 | 593 |
587 const string16 GetFormIdentifier(const WebFormElement& form) { | 594 const string16 GetFormIdentifier(const WebFormElement& form) { |
588 string16 identifier = form.name(); | 595 string16 identifier = form.name(); |
589 if (identifier.empty()) | 596 if (identifier.empty()) |
590 identifier = form.getAttribute(WebString("id")); | 597 identifier = form.getAttribute(WebString("id")); |
591 | 598 |
592 return identifier; | 599 return identifier; |
593 } | 600 } |
594 | 601 |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 continue; | 987 continue; |
981 | 988 |
982 if (input_element->isAutofilled()) | 989 if (input_element->isAutofilled()) |
983 return true; | 990 return true; |
984 } | 991 } |
985 | 992 |
986 return false; | 993 return false; |
987 } | 994 } |
988 | 995 |
989 } // namespace autofill | 996 } // namespace autofill |
OLD | NEW |