Auto merge of #16555 - mantaroh:animate_clip, r=hiro

Make clip property animatable.

<!-- Please describe your changes on the following line: -->
This is a PR for https://bugzilla.mozilla.org/show_bug.cgi?id=1356162.
---
<!-- 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=1356162
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/16555)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-04-23 18:59:20 -05:00 committed by GitHub
commit e357ea44bb
2 changed files with 45 additions and 2 deletions

View file

@ -2994,6 +2994,50 @@ fn static_assert() {
self.gecko.mClipFlags = other.gecko.mClipFlags; self.gecko.mClipFlags = other.gecko.mClipFlags;
} }
pub fn clone_clip(&self) -> longhands::clip::computed_value::T {
use gecko_bindings::structs::NS_STYLE_CLIP_AUTO;
use gecko_bindings::structs::NS_STYLE_CLIP_BOTTOM_AUTO;
use gecko_bindings::structs::NS_STYLE_CLIP_LEFT_AUTO;
use gecko_bindings::structs::NS_STYLE_CLIP_RIGHT_AUTO;
use gecko_bindings::structs::NS_STYLE_CLIP_TOP_AUTO;
use values::computed::{ClipRect, ClipRectOrAuto};
use values::Either;
if self.gecko.mClipFlags == NS_STYLE_CLIP_AUTO as u8 {
ClipRectOrAuto::auto()
} else {
let left = if self.gecko.mClipFlags & NS_STYLE_CLIP_LEFT_AUTO as u8 != 0 {
debug_assert!(self.gecko.mClip.x == 0);
None
} else {
Some(Au(self.gecko.mClip.x))
};
let top = if self.gecko.mClipFlags & NS_STYLE_CLIP_TOP_AUTO as u8 != 0 {
debug_assert!(self.gecko.mClip.y == 0);
None
} else {
Some(Au(self.gecko.mClip.y))
};
let bottom = if self.gecko.mClipFlags & NS_STYLE_CLIP_BOTTOM_AUTO as u8 != 0 {
debug_assert!(self.gecko.mClip.height == 1 << 30); // NS_MAXSIZE
None
} else {
Some(Au(self.gecko.mClip.y + self.gecko.mClip.height))
};
let right = if self.gecko.mClipFlags & NS_STYLE_CLIP_RIGHT_AUTO as u8 != 0 {
debug_assert!(self.gecko.mClip.width == 1 << 30); // NS_MAXSIZE
None
} else {
Some(Au(self.gecko.mClip.x + self.gecko.mClip.width))
};
Either::First(ClipRect { top: top, right: right, bottom: bottom, left: left, })
}
}
pub fn set_filter(&mut self, v: longhands::filter::computed_value::T) { pub fn set_filter(&mut self, v: longhands::filter::computed_value::T) {
use properties::longhands::filter::computed_value::Filter::*; use properties::longhands::filter::computed_value::Filter::*;
use gecko_bindings::structs::nsCSSShadowArray; use gecko_bindings::structs::nsCSSShadowArray;

View file

@ -77,11 +77,10 @@ ${helpers.predefined_type("opacity",
} }
</%helpers:vector_longhand> </%helpers:vector_longhand>
// FIXME: This prop should be animatable
${helpers.predefined_type("clip", ${helpers.predefined_type("clip",
"ClipRectOrAuto", "ClipRectOrAuto",
"computed::ClipRectOrAuto::auto()", "computed::ClipRectOrAuto::auto()",
animation_type="none", animation_type="normal",
boxed="True", boxed="True",
spec="https://drafts.fxtf.org/css-masking/#clip-property")} spec="https://drafts.fxtf.org/css-masking/#clip-property")}