From 92c6fb3495cd7a6a4ac22f5b332f8ba77cc9ccd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 15 Dec 2020 19:39:59 +0000 Subject: [PATCH] Bug 1475316 - Rename -moz-autofill to just autofill. r=geckoview-reviewers,esawin,boris No compat impact, as this remains an internal pseudo-class for the time being. Differential Revision: https://phabricator.services.mozilla.com/D99295 --- browser/extensions/formautofill/FormAutofillHandler.jsm | 2 +- dom/base/nsDOMWindowUtils.cpp | 2 +- layout/style/res/forms.css | 2 +- layout/style/test/test_non_content_accessible_pseudos.html | 2 +- mobile/android/modules/geckoview/GeckoViewAutofill.jsm | 2 +- servo/components/style/gecko/non_ts_pseudo_class_list.rs | 3 ++- servo/components/style/gecko/wrapper.rs | 2 +- toolkit/components/passwordmgr/LoginManagerChild.jsm | 2 +- 8 files changed, 9 insertions(+), 8 deletions(-) diff --git a/browser/extensions/formautofill/FormAutofillHandler.jsm b/browser/extensions/formautofill/FormAutofillHandler.jsm index 70b549d30672..0bf6dfa4962d 100644 --- a/browser/extensions/formautofill/FormAutofillHandler.jsm +++ b/browser/extensions/formautofill/FormAutofillHandler.jsm @@ -80,7 +80,7 @@ class FormAutofillSection { // not themed [FIELD_STATES.NORMAL]: null, // highlighted - [FIELD_STATES.AUTO_FILLED]: "-moz-autofill", + [FIELD_STATES.AUTO_FILLED]: "autofill", // highlighted && grey color text [FIELD_STATES.PREVIEW]: "-moz-autofill-preview", }; diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index ba1e420e9b5f..262c334deb2c 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -4156,7 +4156,7 @@ struct StateTableEntry { }; static constexpr StateTableEntry kManuallyManagedStates[] = { - {"-moz-autofill", NS_EVENT_STATE_AUTOFILL}, + {"autofill", NS_EVENT_STATE_AUTOFILL}, {"-moz-autofill-preview", NS_EVENT_STATE_AUTOFILL_PREVIEW}, {nullptr, EventStates()}, }; diff --git a/layout/style/res/forms.css b/layout/style/res/forms.css index 8a1f09a4a31d..1839aa68948f 100644 --- a/layout/style/res/forms.css +++ b/layout/style/res/forms.css @@ -1022,7 +1022,7 @@ input:is([type="date"], [type="time"]):is(:disabled, :read-only) { color: GrayText; } -input:-moz-autofill, input:-moz-autofill-preview { +input:autofill, input:-moz-autofill-preview { filter: grayscale(21%) brightness(88%) contrast(161%) invert(10%) sepia(40%) saturate(206%); } diff --git a/layout/style/test/test_non_content_accessible_pseudos.html b/layout/style/test/test_non_content_accessible_pseudos.html index fe0842730950..8d1cb709f0ad 100644 --- a/layout/style/test/test_non_content_accessible_pseudos.html +++ b/layout/style/test/test_non_content_accessible_pseudos.html @@ -14,6 +14,7 @@ const NON_CONTENT_ACCESIBLE_PSEUDOS = [ "::-moz-number-spin-box", "::-moz-search-clear-button", + ":autofill", ":-moz-native-anonymous", ":-moz-use-shadow-tree-root", ":-moz-table-border-nonzero", @@ -30,7 +31,6 @@ const NON_CONTENT_ACCESIBLE_PSEUDOS = [ ":-moz-dir-attr-ltr", ":-moz-dir-attr-rtl", ":-moz-dir-attr-like-auto", - ":-moz-autofill", ":-moz-autofill-preview", "::-moz-tree-row", diff --git a/mobile/android/modules/geckoview/GeckoViewAutofill.jsm b/mobile/android/modules/geckoview/GeckoViewAutofill.jsm index ac6f1e8a01d0..ee8f3d25edd5 100644 --- a/mobile/android/modules/geckoview/GeckoViewAutofill.jsm +++ b/mobile/android/modules/geckoview/GeckoViewAutofill.jsm @@ -220,7 +220,7 @@ class GeckoViewAutofill { // `responses` is an object with IDs as keys. debug`Performing auto-fill ${Object.keys(responses)}`; - const AUTOFILL_STATE = "-moz-autofill"; + const AUTOFILL_STATE = "autofill"; const winUtils = window.windowUtils; for (const id in responses) { diff --git a/servo/components/style/gecko/non_ts_pseudo_class_list.rs b/servo/components/style/gecko/non_ts_pseudo_class_list.rs index d1e49036d902..d927e886bc77 100644 --- a/servo/components/style/gecko/non_ts_pseudo_class_list.rs +++ b/servo/components/style/gecko/non_ts_pseudo_class_list.rs @@ -37,6 +37,7 @@ macro_rules! apply_non_ts_list { ("any-link", AnyLink, IN_VISITED_OR_UNVISITED_STATE, _), ("visited", Visited, IN_VISITED_STATE, _), ("active", Active, IN_ACTIVE_STATE, _), + ("autofill", Autofill, IN_AUTOFILL_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME), ("checked", Checked, IN_CHECKED_STATE, _), ("defined", Defined, IN_DEFINED_STATE, _), ("disabled", Disabled, IN_DISABLED_STATE, _), @@ -62,7 +63,7 @@ macro_rules! apply_non_ts_list { ("-moz-dir-attr-ltr", MozDirAttrLTR, IN_HAS_DIR_ATTR_LTR_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS), ("-moz-dir-attr-rtl", MozDirAttrRTL, IN_HAS_DIR_ATTR_RTL_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS), ("-moz-dir-attr-like-auto", MozDirAttrLikeAuto, IN_HAS_DIR_ATTR_LIKE_AUTO_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS), - ("-moz-autofill", MozAutofill, IN_AUTOFILL_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME), + ("-moz-autofill-preview", MozAutofillPreview, IN_AUTOFILL_PREVIEW_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME), ("-moz-handler-clicktoplay", MozHandlerClickToPlay, IN_HANDLER_CLICK_TO_PLAY_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME), diff --git a/servo/components/style/gecko/wrapper.rs b/servo/components/style/gecko/wrapper.rs index 4773bd89997d..0e0486133a91 100644 --- a/servo/components/style/gecko/wrapper.rs +++ b/servo/components/style/gecko/wrapper.rs @@ -2017,6 +2017,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { { use selectors::matching::*; match *pseudo_class { + NonTSPseudoClass::Autofill | NonTSPseudoClass::Defined | NonTSPseudoClass::Focus | NonTSPseudoClass::Enabled | @@ -2062,7 +2063,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { NonTSPseudoClass::MozDirAttrLTR | NonTSPseudoClass::MozDirAttrRTL | NonTSPseudoClass::MozDirAttrLikeAuto | - NonTSPseudoClass::MozAutofill | NonTSPseudoClass::MozModalDialog | NonTSPseudoClass::MozTopmostModalDialog | NonTSPseudoClass::Active | diff --git a/toolkit/components/passwordmgr/LoginManagerChild.jsm b/toolkit/components/passwordmgr/LoginManagerChild.jsm index 49852844906e..4159f7802eda 100644 --- a/toolkit/components/passwordmgr/LoginManagerChild.jsm +++ b/toolkit/components/passwordmgr/LoginManagerChild.jsm @@ -18,7 +18,7 @@ const PASSWORD_INPUT_ADDED_COALESCING_THRESHOLD_MS = 1; // popup from a focus event in ms. This matches the threshold in // toolkit/components/satchel/nsFormFillController.cpp const AUTOCOMPLETE_AFTER_RIGHT_CLICK_THRESHOLD_MS = 400; -const AUTOFILL_STATE = "-moz-autofill"; +const AUTOFILL_STATE = "autofill"; const { XPCOMUtils } = ChromeUtils.import( "resource://gre/modules/XPCOMUtils.jsm"