mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Avoid dropping a parse error on the floor when checking whether a prop is enabled.
This commit is contained in:
parent
3b11145ef7
commit
8a0a690384
1 changed files with 11 additions and 8 deletions
|
@ -1073,7 +1073,7 @@ impl PropertyId {
|
|||
},
|
||||
None => return Err(()),
|
||||
};
|
||||
id.check_allowed_in(alias, context).map_err(|_| ())?;
|
||||
id.check_allowed_in(alias, context)?;
|
||||
Ok(id)
|
||||
}
|
||||
|
||||
|
@ -1156,8 +1156,11 @@ impl PropertyId {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_allowed_in(&self, alias: Option<AliasId>, context: &PropertyParserContext)
|
||||
-> Result<(), PropertyDeclarationParseError<'static>> {
|
||||
fn check_allowed_in(
|
||||
&self,
|
||||
alias: Option<AliasId>,
|
||||
context: &PropertyParserContext,
|
||||
) -> Result<(), ()> {
|
||||
let id: NonCustomPropertyId;
|
||||
if let Some(alias_id) = alias {
|
||||
id = alias_id.into();
|
||||
|
@ -1177,10 +1180,10 @@ impl PropertyId {
|
|||
${id_set("DISALLOWED_IN_PAGE_RULE", lambda p: not p.allowed_in_page_rule)}
|
||||
match context.rule_type {
|
||||
CssRuleType::Keyframe if DISALLOWED_IN_KEYFRAME_BLOCK.contains(id) => {
|
||||
return Err(PropertyDeclarationParseError::AnimationPropertyInKeyframeBlock)
|
||||
return Err(());
|
||||
}
|
||||
CssRuleType::Page if DISALLOWED_IN_PAGE_RULE.contains(id) => {
|
||||
return Err(PropertyDeclarationParseError::NotAllowedInPageRule)
|
||||
return Err(())
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
@ -1245,15 +1248,15 @@ impl PropertyId {
|
|||
if context.stylesheet_origin != Origin::UserAgent {
|
||||
if EXPERIMENTAL.contains(id) {
|
||||
if !passes_pref_check() {
|
||||
return Err(PropertyDeclarationParseError::ExperimentalProperty);
|
||||
return Err(())
|
||||
}
|
||||
} else {
|
||||
return Err(PropertyDeclarationParseError::UnknownProperty(self.name().into()));
|
||||
return Err(())
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if EXPERIMENTAL.contains(id) && !passes_pref_check() {
|
||||
return Err(PropertyDeclarationParseError::ExperimentalProperty);
|
||||
return Err(());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue