Commit 35dd154a authored by Dominic Battre's avatar Dominic Battre Committed by Commit Bot

Replicate autofill data into a different attribute

If you enable chrome://flags/#show-autofill-type-predictions, Chrome will put
information about the autofill state for a specific <input> field into the
field's titel attribute. This is convenient for debugging because you can hover
over the field to read the information. Unfortunately, this is brittle if you
also use Google Translate for the site as Translate will try to translate the
titel value. This breaks automated processing of the data. This CL replicates
the annotations into a second attribute 'autofill-information' that should not
be touched by Google Translate.

Bug: 773186
Change-Id: I1716b8d78e360ec67f20578cf07444018b989653
Reviewed-on: https://chromium-review.googlesource.com/c/1346050
Commit-Queue: Sebastien Seguin-Gagnon <sebsg@chromium.org>
Reviewed-by: default avatarSebastien Seguin-Gagnon <sebsg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610066}
parent d037907c
...@@ -472,8 +472,15 @@ bool FormCache::ShowPredictions(const FormDataPredictions& form, ...@@ -472,8 +472,15 @@ bool FormCache::ShowPredictions(const FormDataPredictions& form,
title += "\nform signature: "; title += "\nform signature: ";
title += form.signature; title += form.signature;
// Set this debug string to the title so that a developer can easily debug
// by hovering the mouse over the input field.
element.SetAttribute("title", WebString::FromUTF8(title)); element.SetAttribute("title", WebString::FromUTF8(title));
// Set the same debug string to an attribute that does not get mangled if
// Google Translate is triggered for the site. This is useful for
// automated processing of the data.
element.SetAttribute("autofill-information", WebString::FromUTF8(title));
element.SetAttribute("autofill-prediction", element.SetAttribute("autofill-prediction",
WebString::FromUTF8(field.overall_type)); WebString::FromUTF8(field.overall_type));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment