Skip to content

Commit

Permalink
Make perspective origin animatable
Browse files Browse the repository at this point in the history
  • Loading branch information
mantaroh committed Apr 14, 2017
1 parent 6f7db7c commit 799cbcb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
11 changes: 11 additions & 0 deletions components/style/properties/gecko.mako.rs
Expand Up @@ -2123,6 +2123,17 @@ fn static_assert() {
self.gecko.mPerspectiveOrigin[1].copy_from(&other.gecko.mPerspectiveOrigin[1]);
}

pub fn clone_perspective_origin(&self) -> longhands::perspective_origin::computed_value::T {
use properties::longhands::perspective_origin::computed_value::T;
use values::computed::LengthOrPercentage;
T {
horizontal: LengthOrPercentage::from_gecko_style_coord(&self.gecko.mPerspectiveOrigin[0])
.expect("Expected length or percentage for horizontal value of perspective-origin"),
vertical: LengthOrPercentage::from_gecko_style_coord(&self.gecko.mPerspectiveOrigin[1])
.expect("Expected length or percentage for vertical value of perspective-origin"),
}
}

pub fn set_transform_origin(&mut self, v: longhands::transform_origin::computed_value::T) {
self.gecko.mTransformOrigin[0].set(v.horizontal);
self.gecko.mTransformOrigin[1].set(v.vertical);
Expand Down
20 changes: 4 additions & 16 deletions components/style/properties/longhand/box.mako.rs
Expand Up @@ -1869,31 +1869,19 @@ ${helpers.predefined_type("perspective",
fixpos_cb=True,
animation_type="normal")}

// FIXME: This prop should be animatable
<%helpers:longhand name="perspective-origin" boxed="True" animation_type="none" extra_prefixes="moz webkit"
<%helpers:longhand name="perspective-origin" boxed="True" animation_type="normal" extra_prefixes="moz webkit"
spec="https://drafts.csswg.org/css-transforms/#perspective-origin-property">
use std::fmt;
use style_traits::ToCss;
use values::HasViewportPercentage;
use values::specified::{LengthOrPercentage, Percentage};

pub mod computed_value {
use properties::animated_properties::Interpolate;
use values::computed::LengthOrPercentage;
use values::computed::Position;

#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T {
pub horizontal: LengthOrPercentage,
pub vertical: LengthOrPercentage,
}
}

impl ToCss for computed_value::T {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
try!(self.horizontal.to_css(dest));
try!(dest.write_str(" "));
self.vertical.to_css(dest)
}
pub type T = Position;
}

impl HasViewportPercentage for SpecifiedValue {
Expand Down

0 comments on commit 799cbcb

Please sign in to comment.