From cf496e47277b250938249549de876e19bc03d202 Mon Sep 17 00:00:00 2001 From: Sean Feng Date: Mon, 17 Aug 2020 15:41:19 +0000 Subject: [PATCH] style: Make the document blocked by the topmost element in the top layer. Spec: https://html.spec.whatwg.org/multipage/#blocked-by-a-modal-dialog Depends on D86392 Differential Revision: https://phabricator.services.mozilla.com/D86227 --- components/style/element_state.rs | 2 ++ components/style/gecko/non_ts_pseudo_class_list.rs | 1 + components/style/gecko/wrapper.rs | 1 + components/style/style_adjuster.rs | 3 +++ 4 files changed, 7 insertions(+) diff --git a/components/style/element_state.rs b/components/style/element_state.rs index da44186b44b..a3d001a2fab 100644 --- a/components/style/element_state.rs +++ b/components/style/element_state.rs @@ -148,6 +148,8 @@ bitflags! { /// https://html.spec.whatwg.org/multipage/interaction.html#inert-subtrees const IN_MOZINERT_STATE = 1 << 54; + /// State for the topmost dialog element in top layer + const IN_TOPMOST_MODAL_DIALOG_STATE = 1 << 55; } } diff --git a/components/style/gecko/non_ts_pseudo_class_list.rs b/components/style/gecko/non_ts_pseudo_class_list.rs index bdd994c7095..fedbed331f0 100644 --- a/components/style/gecko/non_ts_pseudo_class_list.rs +++ b/components/style/gecko/non_ts_pseudo_class_list.rs @@ -53,6 +53,7 @@ macro_rules! apply_non_ts_list { ("-moz-styleeditor-transitioning", MozStyleeditorTransitioning, IN_STYLEEDITOR_TRANSITIONING_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS), ("fullscreen", Fullscreen, IN_FULLSCREEN_STATE, _), ("-moz-modal-dialog", MozModalDialog, IN_MODAL_DIALOG_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS), + ("-moz-topmost-modal-dialog", MozTopmostModalDialog, IN_TOPMOST_MODAL_DIALOG_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS), // TODO(emilio): This is inconsistently named (the capital R). ("-moz-focusring", MozFocusRing, IN_FOCUSRING_STATE, _), ("-moz-broken", MozBroken, IN_BROKEN_STATE, _), diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 3d4f186fcc3..ef6ce3df4f3 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -2063,6 +2063,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { NonTSPseudoClass::MozDirAttrLikeAuto | NonTSPseudoClass::MozAutofill | NonTSPseudoClass::MozModalDialog | + NonTSPseudoClass::MozTopmostModalDialog | NonTSPseudoClass::Active | NonTSPseudoClass::Hover | NonTSPseudoClass::MozAutofillPreview => { diff --git a/components/style/style_adjuster.rs b/components/style/style_adjuster.rs index a23f97d578a..db950397c37 100644 --- a/components/style/style_adjuster.rs +++ b/components/style/style_adjuster.rs @@ -163,6 +163,9 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> { /// pointer-events: none; /// cursor: default; /// + /// NOTE: dialog:-moz-topmost-modal-dialog is used to override above + /// rules to remove the inertness for the topmost modal dialog. + /// /// NOTE: If this or the pointer-events tweak is removed, then /// minimal-xul.css and the scrollbar style caching need to be tweaked. fn adjust_for_inert(&mut self) {