Bug 1504536 - Remove nscsspropertyid_is_{animatable,transitionable}. r=hiro

There are better ways, plus the existing code didn't handle aliases at
all (not that it needed to, but it's better if it does).

Differential Revision: https://phabricator.services.mozilla.com/D10838
This commit is contained in:
Emilio Cobos Álvarez 2018-11-04 14:01:19 +01:00
Родитель 4516fa52fe
Коммит 53dca96aa3
4 изменённых файлов: 21 добавлений и 36 удалений

Просмотреть файл

@ -432,6 +432,8 @@ class Alias(object):
self.original = original
self.enabled_in = original.enabled_in
self.servo_pref = original.servo_pref
self.animatable = original.animatable
self.transitionable = original.transitionable
self.gecko_pref = gecko_pref
self.allowed_in_page_rule = original.allowed_in_page_rule
self.allowed_in_keyframe_block = original.allowed_in_keyframe_block

Просмотреть файл

@ -50,20 +50,6 @@ use values::generics::svg::{SVGLength, SvgLengthOrPercentageOrNumber, SVGPaint}
use values::generics::svg::{SVGPaintKind, SVGStrokeDashArray, SVGOpacity};
use void::{self, Void};
/// Returns true if this nsCSSPropertyID is one of the animatable properties.
#[cfg(feature = "gecko")]
pub fn nscsspropertyid_is_animatable(property: nsCSSPropertyID) -> bool {
match property {
% for prop in data.longhands + data.shorthands_except_all():
% if prop.animatable:
${prop.nscsspropertyid()} => true,
% endif
% endfor
_ => false
}
}
/// Convert nsCSSPropertyID to TransitionProperty
#[cfg(feature = "gecko")]
#[allow(non_upper_case_globals)]
@ -90,19 +76,6 @@ impl From<nsCSSPropertyID> for TransitionProperty {
}
}
/// Returns true if this nsCSSPropertyID is one of the transitionable properties.
#[cfg(feature = "gecko")]
pub fn nscsspropertyid_is_transitionable(property: nsCSSPropertyID) -> bool {
match property {
% for prop in data.longhands + data.shorthands_except_all():
% if prop.transitionable:
${prop.nscsspropertyid()} => true,
% endif
% endfor
_ => false
}
}
/// An animated property interpolation between two computed values for that
/// property.
#[derive(Clone, Debug, PartialEq)]

Просмотреть файл

@ -471,6 +471,20 @@ impl NonCustomPropertyId {
MAP[self.0]
}
/// Returns whether this property is transitionable.
#[inline]
pub fn is_transitionable(self) -> bool {
${static_non_custom_property_id_set("TRANSITIONABLE", lambda p: p.transitionable)}
TRANSITIONABLE.contains(self)
}
/// Returns whether this property is animatable.
#[inline]
pub fn is_animatable(self) -> bool {
${static_non_custom_property_id_set("ANIMATABLE", lambda p: p.animatable)}
ANIMATABLE.contains(self)
}
#[inline]
fn enabled_for_all_content(self) -> bool {
${static_non_custom_property_id_set(

Просмотреть файл

@ -130,7 +130,7 @@ use style::gecko_properties;
use style::invalidation::element::restyle_hints;
use style::media_queries::MediaList;
use style::parser::{Parse, ParserContext, self};
use style::properties::{ComputedValues, Importance};
use style::properties::{ComputedValues, Importance, NonCustomPropertyId};
use style::properties::{LonghandId, LonghandIdSet, PropertyDeclarationBlock, PropertyId};
use style::properties::{PropertyDeclarationId, ShorthandId};
use style::properties::{SourcePropertyDeclaration, StyleBuilder};
@ -943,8 +943,6 @@ pub unsafe extern "C" fn Servo_Property_GetName(
prop: nsCSSPropertyID,
out_length: *mut u32,
) -> *const u8 {
use style::properties::NonCustomPropertyId;
let (ptr, len) = match NonCustomPropertyId::from_nscsspropertyid(prop) {
Ok(p) => {
let name = p.name();
@ -1049,15 +1047,13 @@ pub unsafe extern "C" fn Servo_Property_GetCSSValuesForProperty(
}
#[no_mangle]
pub extern "C" fn Servo_Property_IsAnimatable(property: nsCSSPropertyID) -> bool {
use style::properties::animated_properties;
animated_properties::nscsspropertyid_is_animatable(property)
pub extern "C" fn Servo_Property_IsAnimatable(prop: nsCSSPropertyID) -> bool {
NonCustomPropertyId::from_nscsspropertyid(prop).ok().map_or(false, |p| p.is_animatable())
}
#[no_mangle]
pub extern "C" fn Servo_Property_IsTransitionable(property: nsCSSPropertyID) -> bool {
use style::properties::animated_properties;
animated_properties::nscsspropertyid_is_transitionable(property)
pub extern "C" fn Servo_Property_IsTransitionable(prop: nsCSSPropertyID) -> bool {
NonCustomPropertyId::from_nscsspropertyid(prop).ok().map_or(false, |p| p.is_transitionable())
}
#[no_mangle]