style: Use cbindgen for clip / -moz-image-region.

This also fixes some of the issues with -moz-image-region, where we just minted
an auto out of the blue.

Differential Revision: https://phabricator.services.mozilla.com/D43474
This commit is contained in:
Emilio Cobos Álvarez 2019-08-26 23:09:47 +00:00
parent 53cd37ce39
commit b238698691
5 changed files with 52 additions and 194 deletions

View file

@ -272,9 +272,47 @@ pub struct ZeroToOne<T>(pub T);
ToShmem,
)]
#[css(function = "rect", comma)]
pub struct ClipRect<LengthOrAuto> {
#[repr(C)]
pub struct GenericClipRect<LengthOrAuto> {
pub top: LengthOrAuto,
pub right: LengthOrAuto,
pub bottom: LengthOrAuto,
pub left: LengthOrAuto,
}
pub use self::GenericClipRect as ClipRect;
/// Either a clip-rect or `auto`.
#[allow(missing_docs)]
#[derive(
Animate,
Clone,
ComputeSquaredDistance,
Copy,
Debug,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToAnimatedValue,
ToAnimatedZero,
ToComputedValue,
ToCss,
ToResolvedValue,
ToShmem,
)]
#[repr(C, u8)]
pub enum GenericClipRectOrAuto<R> {
Auto,
Rect(R),
}
pub use self::GenericClipRectOrAuto as ClipRectOrAuto;
impl<L> ClipRectOrAuto<L> {
/// Returns the `auto` value.
#[inline]
pub fn auto() -> Self {
ClipRectOrAuto::Auto
}
}