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

Unified Diff: components/autofill/content/renderer/form_autofill_util.cc

Issue 140903004: Add autofill preview support for <month> input fields (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reabase to revision 254451 Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/autofill/form_autofill_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/content/renderer/form_autofill_util.cc
diff --git a/components/autofill/content/renderer/form_autofill_util.cc b/components/autofill/content/renderer/form_autofill_util.cc
index 0657f78a4f64bdd7ba7056470281269ed797bb4a..66ceaf653e8f69d94f9d85f131854ef447b92456 100644
--- a/components/autofill/content/renderer/form_autofill_util.cc
+++ b/components/autofill/content/renderer/form_autofill_util.cc
@@ -576,7 +576,7 @@ void PreviewFormField(const FormFieldData& data,
// and radio buttons, as there is no provision for setSuggestedCheckedValue
// in WebInputElement.
WebInputElement* input_element = toWebInputElement(field);
- if (IsTextInput(input_element)) {
+ if (IsTextInput(input_element) || IsMonthInput(input_element)) {
// If the maxlength attribute contains a negative value, maxLength()
// returns the default maxlength value.
input_element->setSuggestedValue(
@@ -1064,7 +1064,9 @@ bool ClearPreviewedFormWithElement(const WebInputElement& element,
// Only text input and textarea elements can be previewed.
WebInputElement* input_element = toWebInputElement(&control_element);
- if (!IsTextInput(input_element) && !IsTextAreaElement(control_element))
+ if (!IsTextInput(input_element) &&
+ !IsMonthInput(input_element) &&
+ !IsTextAreaElement(control_element))
continue;
// If the element is not auto-filled, we did not preview it,
@@ -1074,13 +1076,15 @@ bool ClearPreviewedFormWithElement(const WebInputElement& element,
if ((IsTextInput(input_element) &&
input_element->suggestedValue().isEmpty()) ||
+ (IsMonthInput(input_element) &&
+ input_element->suggestedValue().isEmpty()) ||
(IsTextAreaElement(control_element) &&
control_element.to<WebTextAreaElement>().suggestedValue().isEmpty()))
continue;
// Clear the suggested value. For the initiating node, also restore the
// original value.
- if (IsTextInput(input_element)) {
+ if (IsTextInput(input_element) || IsMonthInput(input_element)) {
input_element->setSuggestedValue(WebString());
bool is_initiating_node = (element == *input_element);
if (is_initiating_node)
« no previous file with comments | « chrome/renderer/autofill/form_autofill_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698