mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Make clip property animatable.
This commit is contained in:
parent
85aba7ab14
commit
ba34eacee0
2 changed files with 45 additions and 2 deletions
|
@ -2986,6 +2986,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;
|
||||||
|
|
|
@ -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")}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue