| Index: components/autofill/ios/browser/resources/autofill_controller.js
|
| diff --git a/components/autofill/ios/browser/resources/autofill_controller.js b/components/autofill/ios/browser/resources/autofill_controller.js
|
| index 9e53e2d5b4ef067e456b4bc41bdb206519489152..1ae5a7b6e18d92c9a78aa8c55284c9272daf985f 100644
|
| --- a/components/autofill/ios/browser/resources/autofill_controller.js
|
| +++ b/components/autofill/ios/browser/resources/autofill_controller.js
|
| @@ -8,7 +8,8 @@
|
| // representing an array of objects, each of which represents an Autofill form
|
| // with information about a form to be filled and/or submitted and it can be
|
| // translated to struct FormData
|
| -// (chromium/src/components/autofill/common/form_data.h) for further processing.
|
| +// (chromium/src/components/autofill/core/common/form_data.h) for further
|
| +// processing.
|
|
|
| /**
|
| * Namespace for this file. It depends on |__gCrWeb| having already been
|
| @@ -98,6 +99,11 @@ __gCrWeb.autofill.EXTRACT_MASK_OPTIONS = 1 << 2;
|
| __gCrWeb.autofill.lastAutoFilledElement = null;
|
|
|
| /**
|
| + * The last element that was active (used to restore focus if necessary).
|
| + */
|
| +__gCrWeb.autofill.lastActiveElement = null;
|
| +
|
| +/**
|
| * Scans DOM and returns a JSON string representation of forms and form
|
| * extraction results.
|
| * @param {int} requiredFields The minimum number of fields forms must have to
|
| @@ -126,12 +132,25 @@ __gCrWeb.autofill['extractForms'] = function(requiredFields, requirements) {
|
| };
|
|
|
| /**
|
| + * Stores the current active element. This is used to make the element active
|
| + * again in case the web view loses focus when a dialog is presented over it.
|
| + */
|
| +__gCrWeb.autofill['storeActiveElement'] = function() {
|
| + __gCrWeb.autofill.lastActiveElement = document.activeElement;
|
| +}
|
| +
|
| +/**
|
| * Fills data into the active form field.
|
| *
|
| * @param {Object} data The data to fill in.
|
| */
|
| __gCrWeb.autofill['fillActiveFormField'] = function(data) {
|
| var activeElement = document.activeElement;
|
| + if (__gCrWeb.autofill.lastActiveElement) {
|
| + activeElement = __gCrWeb.autofill.lastActiveElement;
|
| + activeElement.focus();
|
| + __gCrWeb.autofill.lastActiveElement = null;
|
| + }
|
| if (data['name'] !== __gCrWeb['common'].nameForAutofill(activeElement)) {
|
| return;
|
| }
|
|
|