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
This commit is contained in:
Emilio Cobos Álvarez 2018-07-30 17:32:17 +02:00
parent c3289ad46e
commit 694d00eb5e
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -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