Bug 1639905 - Derive parse for TextOverflowSide. r=boris

Depends on D76330

Differential Revision: https://phabricator.services.mozilla.com/D76331
This commit is contained in:
Emilio Cobos Álvarez 2020-05-21 18:44:19 +00:00
Родитель 5786fe2012
Коммит 5b0a85dfc3
2 изменённых файлов: 7 добавлений и 24 удалений

Просмотреть файл

@ -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)?)

Просмотреть файл

@ -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 {