mirror of
https://github.com/servo/servo.git
synced 2025-06-29 03:23:41 +01:00
style: Use derive(Parse) for X and Y.
This commit is contained in:
parent
4abd1dc819
commit
8fbdbc8f95
1 changed files with 12 additions and 8 deletions
|
@ -42,17 +42,21 @@ pub enum PositionComponent<S> {
|
||||||
Side(S, Option<LengthOrPercentage>),
|
Side(S, Option<LengthOrPercentage>),
|
||||||
}
|
}
|
||||||
|
|
||||||
define_css_keyword_enum! { X:
|
/// A keyword for the X direction.
|
||||||
"left" => Left,
|
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
|
||||||
"right" => Right,
|
#[allow(missing_docs)]
|
||||||
|
pub enum X {
|
||||||
|
Left,
|
||||||
|
Right,
|
||||||
}
|
}
|
||||||
add_impls_for_keyword_enum!(X);
|
|
||||||
|
|
||||||
define_css_keyword_enum! { Y:
|
/// A keyword for the Y direction.
|
||||||
"top" => Top,
|
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
|
||||||
"bottom" => Bottom,
|
#[allow(missing_docs)]
|
||||||
|
pub enum Y {
|
||||||
|
Top,
|
||||||
|
Bottom,
|
||||||
}
|
}
|
||||||
add_impls_for_keyword_enum!(Y);
|
|
||||||
|
|
||||||
impl Parse for Position {
|
impl Parse for Position {
|
||||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue