mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #18279 - jdm:rearrange, r=emilio
Prioritize parsing non-custom property names. This should cause a slight improvement in the common case where we are parsing non-custom property names. --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18279) <!-- Reviewable:end -->
This commit is contained in:
commit
d68c57158d
1 changed files with 2 additions and 5 deletions
|
@ -1011,10 +1011,6 @@ impl PropertyId {
|
||||||
/// will be used. It is `Origin::Author` for stylesheet_origin and
|
/// will be used. It is `Origin::Author` for stylesheet_origin and
|
||||||
/// `CssRuleType::Style` for rule_type.
|
/// `CssRuleType::Style` for rule_type.
|
||||||
pub fn parse(property_name: &str, context: Option< &PropertyParserContext>) -> Result<Self, ()> {
|
pub fn parse(property_name: &str, context: Option< &PropertyParserContext>) -> Result<Self, ()> {
|
||||||
if let Ok(name) = ::custom_properties::parse_name(property_name) {
|
|
||||||
return Ok(PropertyId::Custom(::custom_properties::Name::from(name)))
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME(https://github.com/rust-lang/rust/issues/33156): remove this enum and use PropertyId
|
// FIXME(https://github.com/rust-lang/rust/issues/33156): remove this enum and use PropertyId
|
||||||
// when stable Rust allows destructors in statics.
|
// when stable Rust allows destructors in statics.
|
||||||
// ShorthandAlias is not used in servo build. That's why we need to allow dead_code.
|
// ShorthandAlias is not used in servo build. That's why we need to allow dead_code.
|
||||||
|
@ -1071,7 +1067,8 @@ impl PropertyId {
|
||||||
Some(&StaticId::ShorthandAlias(id, alias)) => {
|
Some(&StaticId::ShorthandAlias(id, alias)) => {
|
||||||
(PropertyId::Shorthand(id), Some(alias))
|
(PropertyId::Shorthand(id), Some(alias))
|
||||||
},
|
},
|
||||||
None => return Err(()),
|
None => return ::custom_properties::parse_name(property_name)
|
||||||
|
.map(|name| PropertyId::Custom(::custom_properties::Name::from(name))),
|
||||||
};
|
};
|
||||||
id.check_allowed_in(alias, context).map_err(|_| ())?;
|
id.check_allowed_in(alias, context).map_err(|_| ())?;
|
||||||
Ok(id)
|
Ok(id)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue