From 17eba0d4d6a92d6dee1a3939760ea13c51a64f9d Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Wed, 9 Aug 2017 16:25:08 +0900 Subject: [PATCH] Drop AnimatedProperty for stylo. set_list_style_type() for gecko needs an additional argument 'Device' [1], and making list-style-type animtable makes AnimatedProperty::update() call the set_list_style_type(). To avoid introducing the Device argument to the setter in servo, this patch makes simply PropertyAnimation conditional build. (Whereas in stylo, we don't use the setter for animation, we use clone_xx() instead.) [1] https://hg.mozilla.org/mozilla-central/file/1d042bcb2632/servo/components/style/properties/properties.mako.rs#l2667 --- components/style/context.rs | 14 +++++++++++++- components/style/lib.rs | 2 +- .../properties/helpers/animated_properties.mako.rs | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/components/style/context.rs b/components/style/context.rs index 675fff06cc7..7ae849d0728 100644 --- a/components/style/context.rs +++ b/components/style/context.rs @@ -5,7 +5,7 @@ //! The context within which style is calculated. #[cfg(feature = "servo")] use animation::Animation; -use animation::PropertyAnimation; +#[cfg(feature = "servo")] use animation::PropertyAnimation; use app_units::Au; use bloom::StyleBloom; use cache::LRUCache; @@ -293,6 +293,7 @@ pub struct CurrentElementInfo { is_initial_style: bool, /// A Vec of possibly expired animations. Used only by Servo. #[allow(dead_code)] + #[cfg(feature = "servo")] pub possibly_expired_animations: Vec, } @@ -668,6 +669,17 @@ impl ThreadLocalStyleContext { } } + #[cfg(feature = "gecko")] + /// Notes when the style system starts traversing an element. + pub fn begin_element(&mut self, element: E, data: &ElementData) { + debug_assert!(self.current_element_info.is_none()); + self.current_element_info = Some(CurrentElementInfo { + element: element.as_node().opaque(), + is_initial_style: !data.has_styles(), + }); + } + + #[cfg(feature = "servo")] /// Notes when the style system starts traversing an element. pub fn begin_element(&mut self, element: E, data: &ElementData) { debug_assert!(self.current_element_info.is_none()); diff --git a/components/style/lib.rs b/components/style/lib.rs index fcf48752530..7216b9c51e1 100644 --- a/components/style/lib.rs +++ b/components/style/lib.rs @@ -92,7 +92,7 @@ extern crate unicode_segmentation; #[macro_use] mod macros; -pub mod animation; +#[cfg(feature = "servo")] pub mod animation; pub mod applicable_declarations; #[allow(missing_docs)] // TODO. #[cfg(feature = "servo")] pub mod attr; diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 8dbb8a268d4..88dc2272f00 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -387,6 +387,7 @@ pub fn nscsspropertyid_is_transitionable(property: nsCSSPropertyID) -> bool { /// An animated property interpolation between two computed values for that /// property. +#[cfg(feature = "servo")] #[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum AnimatedProperty { @@ -404,6 +405,7 @@ pub enum AnimatedProperty { % endfor } +#[cfg(feature = "servo")] impl AnimatedProperty { /// Get the name of this property. pub fn name(&self) -> &'static str {