mirror of
https://github.com/servo/servo.git
synced 2025-08-12 00:45:33 +01:00
style: Use cbindgen for border-style and outline-style.
I'm pretty sure the FIXME I left in the outline-style code is a bug, but I want to clean this up further and I didn't want to fix it without adding a test. Differential Revision: https://phabricator.services.mozilla.com/D12859
This commit is contained in:
parent
fd73f1665a
commit
efecd06a28
5 changed files with 80 additions and 95 deletions
|
@ -23,19 +23,20 @@ use style_traits::ParseError;
|
|||
ToComputedValue,
|
||||
ToCss,
|
||||
)]
|
||||
#[repr(C, u8)]
|
||||
/// <https://drafts.csswg.org/css-ui/#propdef-outline-style>
|
||||
pub enum OutlineStyle {
|
||||
/// auto
|
||||
Auto,
|
||||
/// <border-style>
|
||||
Other(BorderStyle),
|
||||
BorderStyle(BorderStyle),
|
||||
}
|
||||
|
||||
impl OutlineStyle {
|
||||
#[inline]
|
||||
/// Get default value as None
|
||||
pub fn none() -> OutlineStyle {
|
||||
OutlineStyle::Other(BorderStyle::None)
|
||||
OutlineStyle::BorderStyle(BorderStyle::None)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -43,7 +44,7 @@ impl OutlineStyle {
|
|||
pub fn none_or_hidden(&self) -> bool {
|
||||
match *self {
|
||||
OutlineStyle::Auto => false,
|
||||
OutlineStyle::Other(ref border_style) => border_style.none_or_hidden(),
|
||||
OutlineStyle::BorderStyle(ref style) => style.none_or_hidden(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +60,7 @@ impl Parse for OutlineStyle {
|
|||
.new_custom_error(SelectorParseErrorKind::UnexpectedIdent("hidden".into())));
|
||||
}
|
||||
|
||||
return Ok(OutlineStyle::Other(border_style));
|
||||
return Ok(OutlineStyle::BorderStyle(border_style));
|
||||
}
|
||||
|
||||
input.expect_ident_matching("auto")?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue