mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Simplify values of CSSWideKeyword
This commit is contained in:
parent
67638bdcf2
commit
29fd30601e
2 changed files with 15 additions and 15 deletions
|
@ -324,9 +324,9 @@
|
||||||
-> Result<DeclaredValue<SpecifiedValue>, ()> {
|
-> Result<DeclaredValue<SpecifiedValue>, ()> {
|
||||||
% endif
|
% endif
|
||||||
match input.try(|i| CSSWideKeyword::parse(context, i)) {
|
match input.try(|i| CSSWideKeyword::parse(context, i)) {
|
||||||
Ok(CSSWideKeyword::InheritKeyword) => Ok(DeclaredValue::Inherit),
|
Ok(CSSWideKeyword::Inherit) => Ok(DeclaredValue::Inherit),
|
||||||
Ok(CSSWideKeyword::InitialKeyword) => Ok(DeclaredValue::Initial),
|
Ok(CSSWideKeyword::Initial) => Ok(DeclaredValue::Initial),
|
||||||
Ok(CSSWideKeyword::UnsetKeyword) => Ok(DeclaredValue::Unset),
|
Ok(CSSWideKeyword::Unset) => Ok(DeclaredValue::Unset),
|
||||||
Err(()) => {
|
Err(()) => {
|
||||||
input.look_for_var_functions();
|
input.look_for_var_functions();
|
||||||
let start = input.position();
|
let start = input.position();
|
||||||
|
|
|
@ -376,11 +376,11 @@ impl PropertyDeclarationIdSet {
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||||
pub enum CSSWideKeyword {
|
pub enum CSSWideKeyword {
|
||||||
/// The `initial` keyword.
|
/// The `initial` keyword.
|
||||||
InitialKeyword,
|
Initial,
|
||||||
/// The `inherit` keyword.
|
/// The `inherit` keyword.
|
||||||
InheritKeyword,
|
Inherit,
|
||||||
/// The `unset` keyword.
|
/// The `unset` keyword.
|
||||||
UnsetKeyword,
|
Unset,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Parse for CSSWideKeyword {
|
impl Parse for CSSWideKeyword {
|
||||||
|
@ -388,9 +388,9 @@ impl Parse for CSSWideKeyword {
|
||||||
let ident = input.expect_ident()?;
|
let ident = input.expect_ident()?;
|
||||||
input.expect_exhausted()?;
|
input.expect_exhausted()?;
|
||||||
match_ignore_ascii_case! { &ident,
|
match_ignore_ascii_case! { &ident,
|
||||||
"initial" => Ok(CSSWideKeyword::InitialKeyword),
|
"initial" => Ok(CSSWideKeyword::Initial),
|
||||||
"inherit" => Ok(CSSWideKeyword::InheritKeyword),
|
"inherit" => Ok(CSSWideKeyword::Inherit),
|
||||||
"unset" => Ok(CSSWideKeyword::UnsetKeyword),
|
"unset" => Ok(CSSWideKeyword::Unset),
|
||||||
_ => Err(())
|
_ => Err(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -969,9 +969,9 @@ impl PropertyDeclaration {
|
||||||
match id {
|
match id {
|
||||||
PropertyId::Custom(name) => {
|
PropertyId::Custom(name) => {
|
||||||
let value = match input.try(|i| CSSWideKeyword::parse(context, i)) {
|
let value = match input.try(|i| CSSWideKeyword::parse(context, i)) {
|
||||||
Ok(CSSWideKeyword::UnsetKeyword) => DeclaredValue::Unset,
|
Ok(CSSWideKeyword::Unset) => DeclaredValue::Unset,
|
||||||
Ok(CSSWideKeyword::InheritKeyword) => DeclaredValue::Inherit,
|
Ok(CSSWideKeyword::Inherit) => DeclaredValue::Inherit,
|
||||||
Ok(CSSWideKeyword::InitialKeyword) => DeclaredValue::Initial,
|
Ok(CSSWideKeyword::Initial) => DeclaredValue::Initial,
|
||||||
Err(()) => match ::custom_properties::SpecifiedValue::parse(context, input) {
|
Err(()) => match ::custom_properties::SpecifiedValue::parse(context, input) {
|
||||||
Ok(value) => DeclaredValue::Value(value),
|
Ok(value) => DeclaredValue::Value(value),
|
||||||
Err(()) => return PropertyDeclarationParseResult::InvalidValue,
|
Err(()) => return PropertyDeclarationParseResult::InvalidValue,
|
||||||
|
@ -1029,7 +1029,7 @@ impl PropertyDeclaration {
|
||||||
${property_pref_check(shorthand)}
|
${property_pref_check(shorthand)}
|
||||||
|
|
||||||
match input.try(|i| CSSWideKeyword::parse(context, i)) {
|
match input.try(|i| CSSWideKeyword::parse(context, i)) {
|
||||||
Ok(CSSWideKeyword::InheritKeyword) => {
|
Ok(CSSWideKeyword::Inherit) => {
|
||||||
% for sub_property in shorthand.sub_properties:
|
% for sub_property in shorthand.sub_properties:
|
||||||
result_list.push((
|
result_list.push((
|
||||||
PropertyDeclaration::${sub_property.camel_case}(
|
PropertyDeclaration::${sub_property.camel_case}(
|
||||||
|
@ -1037,7 +1037,7 @@ impl PropertyDeclaration {
|
||||||
% endfor
|
% endfor
|
||||||
PropertyDeclarationParseResult::ValidOrIgnoredDeclaration
|
PropertyDeclarationParseResult::ValidOrIgnoredDeclaration
|
||||||
},
|
},
|
||||||
Ok(CSSWideKeyword::InitialKeyword) => {
|
Ok(CSSWideKeyword::Initial) => {
|
||||||
% for sub_property in shorthand.sub_properties:
|
% for sub_property in shorthand.sub_properties:
|
||||||
result_list.push((
|
result_list.push((
|
||||||
PropertyDeclaration::${sub_property.camel_case}(
|
PropertyDeclaration::${sub_property.camel_case}(
|
||||||
|
@ -1045,7 +1045,7 @@ impl PropertyDeclaration {
|
||||||
% endfor
|
% endfor
|
||||||
PropertyDeclarationParseResult::ValidOrIgnoredDeclaration
|
PropertyDeclarationParseResult::ValidOrIgnoredDeclaration
|
||||||
},
|
},
|
||||||
Ok(CSSWideKeyword::UnsetKeyword) => {
|
Ok(CSSWideKeyword::Unset) => {
|
||||||
% for sub_property in shorthand.sub_properties:
|
% for sub_property in shorthand.sub_properties:
|
||||||
result_list.push((PropertyDeclaration::${sub_property.camel_case}(
|
result_list.push((PropertyDeclaration::${sub_property.camel_case}(
|
||||||
DeclaredValue::Unset), Importance::Normal));
|
DeclaredValue::Unset), Importance::Normal));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue