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

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

Issue 1955963002: [Autofill] Send events to fields being autofilled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added focus check Created 4 years, 7 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
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 #include <set> 8 #include <set>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 WebInputElement* input_element = toWebInputElement(field); 883 WebInputElement* input_element = toWebInputElement(field);
884 if (IsCheckableElement(input_element)) { 884 if (IsCheckableElement(input_element)) {
885 input_element->setChecked(data.is_checked, true); 885 input_element->setChecked(data.is_checked, true);
886 } else { 886 } else {
887 base::string16 value = data.value; 887 base::string16 value = data.value;
888 if (IsTextInput(input_element) || IsMonthInput(input_element)) { 888 if (IsTextInput(input_element) || IsMonthInput(input_element)) {
889 // If the maxlength attribute contains a negative value, maxLength() 889 // If the maxlength attribute contains a negative value, maxLength()
890 // returns the default maxlength value. 890 // returns the default maxlength value.
891 TruncateString(&value, input_element->maxLength()); 891 TruncateString(&value, input_element->maxLength());
892 } 892 }
893 field->setValue(value, true); 893 field->setAutofillValue(value);
894 } 894 }
895 // Setting the form might trigger JavaScript, which is capable of 895 // Setting the form might trigger JavaScript, which is capable of
896 // destroying the frame. 896 // destroying the frame.
897 if (!field->document().frame()) 897 if (!field->document().frame())
898 return; 898 return;
899 899
900 field->setAutofilled(true); 900 field->setAutofilled(true);
901 901
902 if (is_initiating_node && 902 if (is_initiating_node &&
903 ((IsTextInput(input_element) || IsMonthInput(input_element)) || 903 ((IsTextInput(input_element) || IsMonthInput(input_element)) ||
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
1766 // Zero selection start is for password manager, which can show usernames 1766 // Zero selection start is for password manager, which can show usernames
1767 // that do not begin with the user input value. 1767 // that do not begin with the user input value.
1768 selection_start = (offset == base::string16::npos) ? 0 : offset; 1768 selection_start = (offset == base::string16::npos) ? 0 : offset;
1769 } 1769 }
1770 1770
1771 input_element->setSelectionRange(selection_start, suggestion.length()); 1771 input_element->setSelectionRange(selection_start, suggestion.length());
1772 } 1772 }
1773 1773
1774 } // namespace form_util 1774 } // namespace form_util
1775 } // namespace autofill 1775 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_interactive_uitest.cc ('k') | third_party/WebKit/Source/web/WebFormControlElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698