Add more css

This commit is contained in:
Adrian Wozniak 2020-04-30 23:32:47 +02:00
parent 6eb56f9d7d
commit f2cc69bcdd

View File

@ -328,7 +328,7 @@ impl CssParser {
"background-clip" => Property::BackgroundClip(self.parse_full_token()?), "background-clip" => Property::BackgroundClip(self.parse_full_token()?),
"background-color" => Property::BackgroundColor(self.parse_full_token()?), "background-color" => Property::BackgroundColor(self.parse_full_token()?),
// "background-image" => Property::BackgroundImage, // "background-image" => Property::BackgroundImage,
// "background-origin" => Property::BackgroundOrigin, "background-origin" => Property::BackgroundOrigin(self.parse_full_token()?),
// "background-position" => Property::BackgroundPosition, // "background-position" => Property::BackgroundPosition,
// "background-repeat" => Property::BackgroundRepeat, // "background-repeat" => Property::BackgroundRepeat,
// "background-size" => Property::BackgroundSize, // "background-size" => Property::BackgroundSize,
@ -1103,7 +1103,7 @@ impl ParseToken<ClearProperty> for CssParser {
} }
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
pub enum BackgroundClipProperty { pub enum ClipProperty {
BorderBox, BorderBox,
PaddingBox, PaddingBox,
ContentBox, ContentBox,
@ -1111,16 +1111,16 @@ pub enum BackgroundClipProperty {
Inherit, Inherit,
} }
impl Token for BackgroundClipProperty {} impl Token for ClipProperty {}
impl ParseToken<BackgroundClipProperty> for CssParser { impl ParseToken<ClipProperty> for CssParser {
fn parse_token(&mut self) -> ValueResult<BackgroundClipProperty> { fn parse_token(&mut self) -> ValueResult<ClipProperty> {
let p = match self.expect_consume()?.as_str() { let p = match self.expect_consume()?.as_str() {
"border-box" => BackgroundClipProperty::BorderBox, "border-box" => ClipProperty::BorderBox,
"padding-box" => BackgroundClipProperty::PaddingBox, "padding-box" => ClipProperty::PaddingBox,
"content-box" => BackgroundClipProperty::ContentBox, "content-box" => ClipProperty::ContentBox,
"initial" => BackgroundClipProperty::Initial, "initial" => ClipProperty::Initial,
"inherit" => BackgroundClipProperty::Inherit, "inherit" => ClipProperty::Inherit,
_ => return Err(format!("invalid background clip {:?}", self.current)), _ => return Err(format!("invalid background clip {:?}", self.current)),
}; };
Ok(PropertyValue::Other(p)) Ok(PropertyValue::Other(p))
@ -1588,10 +1588,10 @@ pub enum Property {
Background(String), Background(String),
BackgroundAttachment(PropertyValue<BackgroundAttachmentProperty>), BackgroundAttachment(PropertyValue<BackgroundAttachmentProperty>),
BackgroundBlendMode(PropertyValue<BackgroundBlendModeProperty>), BackgroundBlendMode(PropertyValue<BackgroundBlendModeProperty>),
BackgroundClip(PropertyValue<BackgroundClipProperty>), BackgroundClip(PropertyValue<ClipProperty>),
BackgroundColor(PropertyValue<ColorProperty>), BackgroundColor(PropertyValue<ColorProperty>),
BackgroundImage(String), BackgroundImage(String),
BackgroundOrigin(String), BackgroundOrigin(PropertyValue<ClipProperty>),
BackgroundPosition(String), BackgroundPosition(String),
BackgroundRepeat(String), BackgroundRepeat(String),
BackgroundSize(String), BackgroundSize(String),
@ -2334,7 +2334,7 @@ mod tests {
BackfaceVisibility(Other(BackfaceVisibilityProperty::Visible)), BackfaceVisibility(Other(BackfaceVisibilityProperty::Visible)),
BackgroundAttachment(Other(BackgroundAttachmentProperty::Local)), BackgroundAttachment(Other(BackgroundAttachmentProperty::Local)),
BackgroundBlendMode(Other(BackgroundBlendModeProperty::Darken)), BackgroundBlendMode(Other(BackgroundBlendModeProperty::Darken)),
BackgroundClip(Other(BackgroundClipProperty::ContentBox)), BackgroundClip(Other(ClipProperty::ContentBox)),
BackgroundColor(Other(ColorProperty::Rgba( BackgroundColor(Other(ColorProperty::Rgba(
Other(12), Other(12),
Other(34), Other(34),