From 178e627500b8050b4ca574d4dd3d9233b142791d Mon Sep 17 00:00:00 2001 From: David Parks Date: Wed, 18 Nov 2020 15:55:34 +0000 Subject: [PATCH] style: Replace plugin behavior with a basic fallback The browser currently only enables plugin behavior for Flash and our internal test plugins. This patch replaces support for those plugins with a simple fallback that shows a transparent region where the plugin would have been. It removes the file system search(es) for the plugin dynamic libraries and short-circuits the logic to determine if plugins should do something special -- all implementations now behave the same in the presence of plugin elements. The new behavior is: 1. If the or element lists a type of something other than "x-shockwave-flash" or "x-test" then the behavior is unchanged. This means that non-plugin types behave properly and unknown types (for example, typos) are also unaffected (they reduce to 0x0 elements). 2. If the element has an HTML fallback in the DOM (see spec for elements) then the fallback is always shown. 3. Otherwise, the element is shown as a transparent region with the size specified in attributes. Differential Revision: https://phabricator.services.mozilla.com/D95902 --- components/style/element_state.rs | 2 ++ components/style/gecko/non_ts_pseudo_class_list.rs | 2 ++ components/style/gecko/wrapper.rs | 1 + 3 files changed, 5 insertions(+) diff --git a/components/style/element_state.rs b/components/style/element_state.rs index 2e3ccb3b31b..5dc3cc0c25d 100644 --- a/components/style/element_state.rs +++ b/components/style/element_state.rs @@ -144,6 +144,8 @@ bitflags! { const IN_MOZINERT_STATE = 1 << 54; /// State for the topmost dialog element in top layer const IN_TOPMOST_MODAL_DIALOG_STATE = 1 << 55; + /// Non-standard & undocumented. + const IN_HANDLER_NOPLUGINS = 1 << 56; } } diff --git a/components/style/gecko/non_ts_pseudo_class_list.rs b/components/style/gecko/non_ts_pseudo_class_list.rs index 0b34cd8d966..d1e49036d90 100644 --- a/components/style/gecko/non_ts_pseudo_class_list.rs +++ b/components/style/gecko/non_ts_pseudo_class_list.rs @@ -72,6 +72,8 @@ macro_rules! apply_non_ts_list { ("-moz-handler-disabled", MozHandlerDisabled, IN_HANDLER_DISABLED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME), ("-moz-handler-blocked", MozHandlerBlocked, IN_HANDLER_BLOCKED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME), ("-moz-handler-crashed", MozHandlerCrashed, IN_HANDLER_CRASHED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME), + ("-moz-handler-noplugins", MozHandlerNoPlugins, IN_HANDLER_NOPLUGINS, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME), + ("-moz-math-increment-script-level", MozMathIncrementScriptLevel, IN_INCREMENT_SCRIPT_LEVEL_STATE, _), ("required", Required, IN_REQUIRED_STATE, _), diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 932685ea3c1..847b822b28d 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -2046,6 +2046,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { NonTSPseudoClass::MozHandlerClickToPlay | NonTSPseudoClass::MozHandlerVulnerableUpdatable | NonTSPseudoClass::MozHandlerVulnerableNoUpdate | + NonTSPseudoClass::MozHandlerNoPlugins | NonTSPseudoClass::MozMathIncrementScriptLevel | NonTSPseudoClass::InRange | NonTSPseudoClass::OutOfRange |