OLD | NEW |
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 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 // If we failed to extract any fields, give up. Also, to avoid overly | 901 // If we failed to extract any fields, give up. Also, to avoid overly |
902 // expensive computation, we impose a maximum number of allowable fields. | 902 // expensive computation, we impose a maximum number of allowable fields. |
903 if (form_fields.empty() || form_fields.size() > kMaxParseableFields) | 903 if (form_fields.empty() || form_fields.size() > kMaxParseableFields) |
904 return false; | 904 return false; |
905 | 905 |
906 // Loop through the label elements inside the form element. For each label | 906 // Loop through the label elements inside the form element. For each label |
907 // element, get the corresponding form control element, use the form control | 907 // element, get the corresponding form control element, use the form control |
908 // element's name as a key into the <name, FormFieldData> map to find the | 908 // element's name as a key into the <name, FormFieldData> map to find the |
909 // previously created FormFieldData and set the FormFieldData's label to the | 909 // previously created FormFieldData and set the FormFieldData's label to the |
910 // label.firstChild().nodeValue() of the label element. | 910 // label.firstChild().nodeValue() of the label element. |
911 WebElementCollection labels = form_element.getElementsByTagName(kLabel); | 911 WebElementCollection labels = form_element.getElementsByHTMLTagName(kLabel); |
912 DCHECK(!labels.isNull()); | 912 DCHECK(!labels.isNull()); |
913 for (WebElement item = labels.firstItem(); !item.isNull(); | 913 for (WebElement item = labels.firstItem(); !item.isNull(); |
914 item = labels.nextItem()) { | 914 item = labels.nextItem()) { |
915 WebLabelElement label = item.to<WebLabelElement>(); | 915 WebLabelElement label = item.to<WebLabelElement>(); |
916 WebFormControlElement field_element = | 916 WebFormControlElement field_element = |
917 label.correspondingControl().to<WebFormControlElement>(); | 917 label.correspondingControl().to<WebFormControlElement>(); |
918 | 918 |
919 base::string16 element_name; | 919 base::string16 element_name; |
920 if (field_element.isNull()) { | 920 if (field_element.isNull()) { |
921 // Sometimes site authors will incorrectly specify the corresponding | 921 // Sometimes site authors will incorrectly specify the corresponding |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 | 1181 |
1182 gfx::RectF GetScaledBoundingBox(float scale, WebFormControlElement* element) { | 1182 gfx::RectF GetScaledBoundingBox(float scale, WebFormControlElement* element) { |
1183 gfx::Rect bounding_box(element->boundsInViewportSpace()); | 1183 gfx::Rect bounding_box(element->boundsInViewportSpace()); |
1184 return gfx::RectF(bounding_box.x() * scale, | 1184 return gfx::RectF(bounding_box.x() * scale, |
1185 bounding_box.y() * scale, | 1185 bounding_box.y() * scale, |
1186 bounding_box.width() * scale, | 1186 bounding_box.width() * scale, |
1187 bounding_box.height() * scale); | 1187 bounding_box.height() * scale); |
1188 } | 1188 } |
1189 | 1189 |
1190 } // namespace autofill | 1190 } // namespace autofill |
OLD | NEW |