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

Side by Side Diff: components/autofill/content/renderer/form_autofill_util.cc

Issue 621503003: Exclude readonly and disabled elements from autofill form. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update test expectations for FormStructure browser_tests. Created 6 years, 2 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 | « chrome/test/data/autofill/heuristics/output/15_crbug_40687.out ('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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/autofill/content/renderer/form_autofill_util.h" 5 #include "components/autofill/content/renderer/form_autofill_util.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 void ExtractAutofillableElements( 718 void ExtractAutofillableElements(
719 const WebFormElement& form_element, 719 const WebFormElement& form_element,
720 RequirementsMask requirements, 720 RequirementsMask requirements,
721 std::vector<WebFormControlElement>* autofillable_elements) { 721 std::vector<WebFormControlElement>* autofillable_elements) {
722 WebVector<WebFormControlElement> control_elements; 722 WebVector<WebFormControlElement> control_elements;
723 form_element.getFormControlElements(control_elements); 723 form_element.getFormControlElements(control_elements);
724 724
725 autofillable_elements->clear(); 725 autofillable_elements->clear();
726 for (size_t i = 0; i < control_elements.size(); ++i) { 726 for (size_t i = 0; i < control_elements.size(); ++i) {
727 WebFormControlElement element = control_elements[i]; 727 WebFormControlElement element = control_elements[i];
728 if (!IsAutofillableElement(element)) 728 if (!IsAutofillableElement(element) ||
729 element.isReadOnly() ||
730 !element.isEnabled())
Mike West 2014/10/02 12:49:57 Why not fold this into IsAutofillable{Input?}Eleme
729 continue; 731 continue;
730 732
731 if (requirements & REQUIRE_AUTOCOMPLETE) { 733 if (requirements & REQUIRE_AUTOCOMPLETE) {
732 // TODO(isherman): WebKit currently doesn't handle the autocomplete 734 // TODO(isherman): WebKit currently doesn't handle the autocomplete
733 // attribute for select or textarea elements, but it probably should. 735 // attribute for select or textarea elements, but it probably should.
734 WebInputElement* input_element = toWebInputElement(&control_elements[i]); 736 WebInputElement* input_element = toWebInputElement(&control_elements[i]);
735 if (IsAutofillableInputElement(input_element) && 737 if (IsAutofillableInputElement(input_element) &&
736 !SatisfiesRequireAutocomplete(*input_element)) 738 !SatisfiesRequireAutocomplete(*input_element))
737 continue; 739 continue;
738 } 740 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 WebVector<WebFormControlElement> control_elements; 861 WebVector<WebFormControlElement> control_elements;
860 form_element.getFormControlElements(control_elements); 862 form_element.getFormControlElements(control_elements);
861 863
862 // A vector of bools that indicate whether each field in the form meets the 864 // A vector of bools that indicate whether each field in the form meets the
863 // requirements and thus will be in the resulting |form|. 865 // requirements and thus will be in the resulting |form|.
864 std::vector<bool> fields_extracted(control_elements.size(), false); 866 std::vector<bool> fields_extracted(control_elements.size(), false);
865 867
866 for (size_t i = 0; i < control_elements.size(); ++i) { 868 for (size_t i = 0; i < control_elements.size(); ++i) {
867 const WebFormControlElement& control_element = control_elements[i]; 869 const WebFormControlElement& control_element = control_elements[i];
868 870
869 if (!IsAutofillableElement(control_element)) 871 if (!IsAutofillableElement(control_element) ||
872 control_element.isReadOnly() ||
873 !control_element.isEnabled())
870 continue; 874 continue;
871 875
872 const WebInputElement* input_element = toWebInputElement(&control_element); 876 const WebInputElement* input_element = toWebInputElement(&control_element);
873 if (requirements & REQUIRE_AUTOCOMPLETE && 877 if (requirements & REQUIRE_AUTOCOMPLETE &&
874 IsAutofillableInputElement(input_element) && 878 IsAutofillableInputElement(input_element) &&
875 !SatisfiesRequireAutocomplete(*input_element)) 879 !SatisfiesRequireAutocomplete(*input_element))
876 continue; 880 continue;
877 881
878 // Create a new FormFieldData, fill it out and map it to the field's name. 882 // Create a new FormFieldData, fill it out and map it to the field's name.
879 FormFieldData* form_field = new FormFieldData; 883 FormFieldData* form_field = new FormFieldData;
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 1158
1155 gfx::RectF GetScaledBoundingBox(float scale, WebFormControlElement* element) { 1159 gfx::RectF GetScaledBoundingBox(float scale, WebFormControlElement* element) {
1156 gfx::Rect bounding_box(element->boundsInViewportSpace()); 1160 gfx::Rect bounding_box(element->boundsInViewportSpace());
1157 return gfx::RectF(bounding_box.x() * scale, 1161 return gfx::RectF(bounding_box.x() * scale,
1158 bounding_box.y() * scale, 1162 bounding_box.y() * scale,
1159 bounding_box.width() * scale, 1163 bounding_box.width() * scale,
1160 bounding_box.height() * scale); 1164 bounding_box.height() * scale);
1161 } 1165 }
1162 1166
1163 } // namespace autofill 1167 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/test/data/autofill/heuristics/output/15_crbug_40687.out ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698