Auto merge of #16451 - mantaroh:animate_perspective_origin, r=hiro,emilio

Make perspective origin animatable

This is a PR for https://bugzilla.mozilla.org/show_bug.cgi?id=1355344

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [X] There are tests for these changes, a test case will be landed in web-platform-tests in https://bugzilla.mozilla.org/show_bug.cgi?id=1355344

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16451)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-04-16 18:53:10 -05:00 committed by GitHub
commit 533853fdce
2 changed files with 15 additions and 16 deletions

View file

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

View file

@ -1868,8 +1868,7 @@ ${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;
@ -1877,22 +1876,11 @@ ${helpers.predefined_type("perspective",
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 {