style: Support offset-anchor.

Differential Revision: https://phabricator.services.mozilla.com/D39432
This commit is contained in:
Boris Chiou 2019-08-02 20:12:38 +00:00 committed by Emilio Cobos Álvarez
parent e04273a4d9
commit 33690b9eaf
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
6 changed files with 57 additions and 2 deletions

View file

@ -41,6 +41,40 @@ impl<H, V> Position<H, V> {
}
}
/// A generic type for representing an `Auto | <position>`.
/// This is used by <offset-anchor> for now.
/// https://drafts.fxtf.org/motion-1/#offset-anchor-property
#[derive(
Clone,
Copy,
Debug,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToResolvedValue,
ToShmem,
)]
#[repr(C, u8)]
pub enum GenericPositionOrAuto<Pos> {
/// The <position> value.
Position(Pos),
/// The keyword `auto`.
Auto,
}
pub use self::GenericPositionOrAuto as PositionOrAuto;
impl<Pos> PositionOrAuto<Pos> {
/// Return `auto`.
#[inline]
pub fn auto() -> Self {
PositionOrAuto::Auto
}
}
/// A generic value for the `z-index` property.
#[derive(
Animate,