From 694d00eb5e0e9f8db72ad14a76e5a90693009c98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 30 Jul 2018 17:32:17 +0200 Subject: [PATCH] style: Implement nsCSSProps::LookupProperty using Rust. Always assume allowed-for-all-content. There are a couple callers which weren't doing that: * A unit test -> removed. * ComputeAnimationDistance: Used for testing (in transitions_per_property), and for the animation inspector. The animation inspector shouldn't show non-enabled properties. The transitions_per_property test already relies on getComputedStyle stuff which only uses eForAllContent. * GetCSSImageURLs: I added this API for the context menu page and such. It doesn't rely on non-enabled-everywhere properties, it was only using eInChrome because it was a ChromeOnly API, but it doesn't really need this. Differential Revision: https://phabricator.services.mozilla.com/D2514 --- components/style/properties/properties.mako.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 5e341e82d6d..27458cf67c4 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -1870,6 +1870,18 @@ impl PropertyId { id.enabled_for_all_content() } + /// Converts this PropertyId in nsCSSPropertyID, resolving aliases to the + /// resolved property, and returning eCSSPropertyExtra_variable for custom + /// properties. + #[cfg(feature = "gecko")] + #[inline] + pub fn to_nscsspropertyid_resolving_aliases(&self) -> nsCSSPropertyID { + match self.non_custom_non_alias_id() { + Some(id) => id.to_nscsspropertyid(), + None => nsCSSPropertyID::eCSSPropertyExtra_variable, + } + } + fn allowed_in(&self, context: &ParserContext) -> bool { let id = match self.non_custom_id() { // Custom properties are allowed everywhere