mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
style: Move :-moz-locale-dir matching to rust.
This commit is contained in:
parent
1a4df8f876
commit
b6a2bff032
4 changed files with 55 additions and 66 deletions
|
@ -183,9 +183,23 @@ pub enum Direction {
|
|||
/// right-to-left semantic directionality
|
||||
Rtl,
|
||||
/// Some other provided directionality value
|
||||
///
|
||||
/// TODO(emilio): If we atomize we can then unbox in NonTSPseudoClass.
|
||||
Other(Box<str>),
|
||||
}
|
||||
|
||||
impl Direction {
|
||||
/// Parse a direction value.
|
||||
pub fn parse<'i, 't>(parser: &mut CssParser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
let ident = parser.expect_ident()?;
|
||||
Ok(match_ignore_ascii_case! { &ident,
|
||||
"rtl" => Direction::Rtl,
|
||||
"ltr" => Direction::Ltr,
|
||||
_ => Direction::Other(Box::from(ident.as_ref())),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl ToCss for Direction {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: Write {
|
||||
let dir_str = match *self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue