From bc685fde6890f676fb094342f599bdd9d8dec8d7 Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Fri, 12 May 2017 17:02:02 +0800 Subject: [PATCH] style: Support :-moz-autofill and :-moz-autofill-preview in Gecko. --- components/style/element_state.rs | 4 ++++ components/style/gecko/non_ts_pseudo_class_list.rs | 2 ++ components/style/gecko/wrapper.rs | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/components/style/element_state.rs b/components/style/element_state.rs index 1c94580554b..30e67060f3f 100644 --- a/components/style/element_state.rs +++ b/components/style/element_state.rs @@ -115,5 +115,9 @@ bitflags! { const IN_HANDLER_VULNERABLE_NO_UPDATE_STATE = 1 << 42, /// https://drafts.csswg.org/selectors-4/#the-focus-within-pseudo const IN_FOCUS_WITHIN_STATE = 1 << 43, + /// Non-standard & undocumented. + const IN_AUTOFILL_STATE = 1 << 50, + /// Non-standard & undocumented. + const IN_AUTOFILL_PREVIEW_STATE = 1 << 51, } } diff --git a/components/style/gecko/non_ts_pseudo_class_list.rs b/components/style/gecko/non_ts_pseudo_class_list.rs index 4d9b91384a1..160bc5b1615 100644 --- a/components/style/gecko/non_ts_pseudo_class_list.rs +++ b/components/style/gecko/non_ts_pseudo_class_list.rs @@ -73,6 +73,8 @@ macro_rules! apply_non_ts_list { ("-moz-broken", MozBroken, mozBroken, IN_BROKEN_STATE, _), ("-moz-loading", MozLoading, mozLoading, IN_LOADING_STATE, _), ("-moz-suppressed", MozSuppressed, mozSuppressed, IN_SUPPRESSED_STATE, PSEUDO_CLASS_INTERNAL), + ("-moz-autofill", MozAutofill, mozAutofill, IN_AUTOFILL_STATE, PSEUDO_CLASS_INTERNAL), + ("-moz-autofill-preview", MozAutofillPreview, mozAutofillPreview, IN_AUTOFILL_PREVIEW_STATE, PSEUDO_CLASS_INTERNAL), ("-moz-handler-clicktoplay", MozHandlerClickToPlay, mozHandlerClickToPlay, IN_HANDLER_CLICK_TO_PLAY_STATE, PSEUDO_CLASS_INTERNAL), ("-moz-handler-vulnerable-updatable", MozHandlerVulnerableUpdatable, mozHandlerVulnerableUpdatable, IN_HANDLER_VULNERABLE_UPDATABLE_STATE, PSEUDO_CLASS_INTERNAL), diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 1aef3e325f7..746fc12567d 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -1148,7 +1148,9 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { NonTSPseudoClass::MozUIInvalid | NonTSPseudoClass::MozMeterOptimum | NonTSPseudoClass::MozMeterSubOptimum | - NonTSPseudoClass::MozMeterSubSubOptimum => { + NonTSPseudoClass::MozMeterSubSubOptimum | + NonTSPseudoClass::MozAutofill | + NonTSPseudoClass::MozAutofillPreview => { // NB: It's important to use `intersect` instead of `contains` // here, to handle `:any-link` correctly. self.get_state().intersects(pseudo_class.state_flag())