diff options
-rw-r--r-- | components/style/parser.rs | 6 | ||||
-rw-r--r-- | components/style/values/specified/text.rs | 25 |
2 files changed, 7 insertions, 24 deletions
diff --git a/components/style/parser.rs b/components/style/parser.rs index d1afc2e96c8..f506b809955 100644 --- a/components/style/parser.rs +++ b/components/style/parser.rs @@ -207,6 +207,12 @@ where } } +impl Parse for crate::OwnedStr { + fn parse<'i, 't>(_: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> { + Ok(input.expect_string()?.as_ref().to_owned().into()) + } +} + impl Parse for UnicodeRange { fn parse<'i, 't>(_: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> { Ok(UnicodeRange::parse(input)?) diff --git a/components/style/values/specified/text.rs b/components/style/values/specified/text.rs index 703e51a5248..bee3c665840 100644 --- a/components/style/values/specified/text.rs +++ b/components/style/values/specified/text.rs @@ -128,6 +128,7 @@ impl ToComputedValue for LineHeight { Eq, MallocSizeOf, PartialEq, + Parse, SpecifiedValueInfo, ToComputedValue, ToCss, @@ -144,30 +145,6 @@ pub enum TextOverflowSide { String(crate::OwnedStr), } -impl Parse for TextOverflowSide { - fn parse<'i, 't>( - _context: &ParserContext, - input: &mut Parser<'i, 't>, - ) -> Result<TextOverflowSide, ParseError<'i>> { - let location = input.current_source_location(); - match *input.next()? { - Token::Ident(ref ident) => { - match_ignore_ascii_case! { ident, - "clip" => Ok(TextOverflowSide::Clip), - "ellipsis" => Ok(TextOverflowSide::Ellipsis), - _ => Err(location.new_custom_error( - SelectorParseErrorKind::UnexpectedIdent(ident.clone()) - )) - } - }, - Token::QuotedString(ref v) => { - Ok(TextOverflowSide::String(v.as_ref().to_owned().into())) - }, - ref t => Err(location.new_unexpected_token_error(t.clone())), - } - } -} - #[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] /// text-overflow. Specifies rendering when inline content overflows its line box edge. pub struct TextOverflow { |