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 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1612 FormFieldData* field) { | 1612 FormFieldData* field) { |
1613 return UnownedFormElementsAndFieldSetsToFormData( | 1613 return UnownedFormElementsAndFieldSetsToFormData( |
1614 fieldsets, control_elements, element, document, | 1614 fieldsets, control_elements, element, document, |
1615 field_value_and_properties_map, extract_mask, form, field); | 1615 field_value_and_properties_map, extract_mask, form, field); |
1616 } | 1616 } |
1617 | 1617 |
1618 | 1618 |
1619 bool FindFormAndFieldForFormControlElement(const WebFormControlElement& element, | 1619 bool FindFormAndFieldForFormControlElement(const WebFormControlElement& element, |
1620 FormData* form, | 1620 FormData* form, |
1621 FormFieldData* field) { | 1621 FormFieldData* field) { |
| 1622 DCHECK(!element.isNull()); |
| 1623 |
1622 if (!IsAutofillableElement(element)) | 1624 if (!IsAutofillableElement(element)) |
1623 return false; | 1625 return false; |
1624 | 1626 |
1625 ExtractMask extract_mask = | 1627 ExtractMask extract_mask = |
1626 static_cast<ExtractMask>(EXTRACT_VALUE | EXTRACT_OPTIONS); | 1628 static_cast<ExtractMask>(EXTRACT_VALUE | EXTRACT_OPTIONS); |
1627 const WebFormElement form_element = element.form(); | 1629 const WebFormElement form_element = element.form(); |
1628 if (form_element.isNull()) { | 1630 if (form_element.isNull()) { |
1629 // No associated form, try the synthetic form for unowned form elements. | 1631 // No associated form, try the synthetic form for unowned form elements. |
1630 WebDocument document = element.document(); | 1632 WebDocument document = element.document(); |
1631 std::vector<WebElement> fieldsets; | 1633 std::vector<WebElement> fieldsets; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1804 // Zero selection start is for password manager, which can show usernames | 1806 // Zero selection start is for password manager, which can show usernames |
1805 // that do not begin with the user input value. | 1807 // that do not begin with the user input value. |
1806 selection_start = (offset == base::string16::npos) ? 0 : offset; | 1808 selection_start = (offset == base::string16::npos) ? 0 : offset; |
1807 } | 1809 } |
1808 | 1810 |
1809 input_element->setSelectionRange(selection_start, suggestion.length()); | 1811 input_element->setSelectionRange(selection_start, suggestion.length()); |
1810 } | 1812 } |
1811 | 1813 |
1812 } // namespace form_util | 1814 } // namespace form_util |
1813 } // namespace autofill | 1815 } // namespace autofill |
OLD | NEW |