aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/style/animation.rs18
-rw-r--r--components/style/properties.mako.rs15
2 files changed, 16 insertions, 17 deletions
diff --git a/components/style/animation.rs b/components/style/animation.rs
index 5f286e3f866..a7622c90f34 100644
--- a/components/style/animation.rs
+++ b/components/style/animation.rs
@@ -24,7 +24,7 @@ use properties::longhands::transition_timing_function::computed_value::{Transiti
use properties::longhands::vertical_align::computed_value::T as VerticalAlign;
use properties::longhands::visibility::computed_value::T as Visibility;
use properties::longhands::z_index::computed_value::T as ZIndex;
-use properties::style_struct_traits::TAnimation;
+use properties::style_struct_traits::TBox;
use properties::{ComputedValues, ServoComputedValues};
use std::cmp::Ordering;
use std::iter::repeat;
@@ -74,7 +74,7 @@ impl PropertyAnimation {
-> Vec<PropertyAnimation> {
let mut result = Vec::new();
let transition_property =
- new_style.as_servo().get_animation().transition_property.0[transition_index];
+ new_style.as_servo().get_box().transition_property.0[transition_index];
if transition_property != TransitionProperty::All {
if let Some(property_animation) =
PropertyAnimation::from_transition_property(transition_property,
@@ -105,7 +105,7 @@ impl PropertyAnimation {
old_style: &ServoComputedValues,
new_style: &mut ServoComputedValues)
-> Option<PropertyAnimation> {
- let animation_style = new_style.get_animation();
+ let box_style = new_style.get_box();
macro_rules! match_transition {
( $( [$name:ident; $structname:ident; $field:ident] ),* ) => {
match transition_property {
@@ -187,8 +187,8 @@ impl PropertyAnimation {
let property_animation = PropertyAnimation {
property: animated_property,
timing_function:
- *animation_style.transition_timing_function.0.get_mod(transition_index),
- duration: *animation_style.transition_duration.0.get_mod(transition_index),
+ *box_style.transition_timing_function.0.get_mod(transition_index),
+ duration: *box_style.transition_duration.0.get_mod(transition_index),
};
if property_animation.does_not_animate() {
None
@@ -936,7 +936,7 @@ pub fn start_transitions_if_applicable<C: ComputedValues>(new_animations_sender:
new_style: &mut C)
-> bool {
let mut had_animations = false;
- for i in 0..new_style.get_animation().transition_count() {
+ for i in 0..new_style.get_box().transition_count() {
// Create any property animations, if applicable.
let property_animations = PropertyAnimation::from_transition(i, old_style.as_servo(), new_style.as_servo_mut());
for property_animation in property_animations {
@@ -945,15 +945,15 @@ pub fn start_transitions_if_applicable<C: ComputedValues>(new_animations_sender:
// Kick off the animation.
let now = time::precise_time_s();
- let animation_style = new_style.as_servo().get_animation();
+ let box_style = new_style.as_servo().get_box();
let start_time =
- now + (animation_style.transition_delay.0.get_mod(i).seconds() as f64);
+ now + (box_style.transition_delay.0.get_mod(i).seconds() as f64);
new_animations_sender.lock().unwrap().send(Animation {
node: node,
property_animation: property_animation,
start_time: start_time,
end_time: start_time +
- (animation_style.transition_duration.0.get_mod(i).seconds() as f64),
+ (box_style.transition_duration.0.get_mod(i).seconds() as f64),
}).unwrap();
had_animations = true
diff --git a/components/style/properties.mako.rs b/components/style/properties.mako.rs
index 5bad634a665..0bb938e1d69 100644
--- a/components/style/properties.mako.rs
+++ b/components/style/properties.mako.rs
@@ -476,7 +476,8 @@ pub mod longhands {
"longhands::position::computed_value::T"),
Method("is_floated", "bool"),
Method("overflow_x_is_visible", "bool"),
- Method("overflow_y_is_visible", "bool")])}
+ Method("overflow_y_is_visible", "bool"),
+ Method("transition_count", "usize")])}
// TODO(SimonSapin): don't parse `inline-table`, since we don't support it
<%self:longhand name="display" custom_cascade="True">
@@ -4333,8 +4334,7 @@ pub mod longhands {
}
</%self:longhand>
- ${new_style_struct("Animation", is_inherited=False,
- additional_methods=[Method("transition_count", return_type="usize")])}
+ ${switch_to_style_struct("Box")}
// TODO(pcwalton): Multiple transitions.
<%self:longhand name="transition-duration">
@@ -6180,11 +6180,7 @@ pub mod style_structs {
self.${longhand.ident} = other.${longhand.ident}.clone();
}
% endfor
- % if style_struct.name == "Animation":
- fn transition_count(&self) -> usize {
- self.transition_property.0.len()
- }
- % elif style_struct.name == "Border":
+ % if style_struct.name == "Border":
% for side in ["top", "right", "bottom", "left"]:
fn border_${side}_is_none_or_hidden_and_has_nonzero_width(&self) -> bool {
self.border_${side}_style.none_or_hidden() &&
@@ -6207,6 +6203,9 @@ pub mod style_structs {
fn overflow_y_is_visible(&self) -> bool {
self.overflow_y.0 == longhands::overflow_x::computed_value::T::visible
}
+ fn transition_count(&self) -> usize {
+ self.transition_property.0.len()
+ }
% elif style_struct.name == "Color":
fn clone_color(&self) -> longhands::color::computed_value::T {
self.color.clone()