servo: Merge #19321 - style: Avoid unneessary malloc churn when evaluating @supports rules (from emilio:supports-dumb); r=SimonSapin
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 21 Nov 2017 15:27:59 -0600
changeset 701847 96975880806ec6641fe4416aadbf51e546b6723a
parent 701846 ded823ec7764b9154f93446b5676ba15452efd4f
child 701848 37d892d33b6c5fad517a9adaa596940953773f22
push id90298
push userbmo:bpostelnicu@mozilla.com
push dateWed, 22 Nov 2017 10:54:01 +0000
reviewersSimonSapin
milestone59.0a1
servo: Merge #19321 - style: Avoid unneessary malloc churn when evaluating @supports rules (from emilio:supports-dumb); r=SimonSapin Source-Repo: https://github.com/servo/servo Source-Revision: 06d834c1b984b4fae55da4ac82b5fbe002295dda
servo/components/style/stylesheets/supports_rule.rs
--- a/servo/components/style/stylesheets/supports_rule.rs
+++ b/servo/components/style/stylesheets/supports_rule.rs
@@ -251,24 +251,24 @@ impl Declaration {
     ///
     /// <https://drafts.csswg.org/css-conditional-3/#support-definition>
     pub fn eval(&self, context: &ParserContext) -> bool {
         debug_assert_eq!(context.rule_type(), CssRuleType::Style);
 
         let mut input = ParserInput::new(&self.0);
         let mut input = Parser::new(&mut input);
         input.parse_entirely(|input| -> Result<(), CssParseError<()>> {
-            let prop = input.expect_ident().unwrap().as_ref().to_owned();
+            let prop = input.expect_ident_cloned().unwrap();
             input.expect_colon().unwrap();
 
             let id = PropertyId::parse(&prop)
                 .map_err(|_| input.new_custom_error(()))?;
 
             let mut declarations = SourcePropertyDeclaration::new();
             input.parse_until_before(Delimiter::Bang, |input| {
-                PropertyDeclaration::parse_into(&mut declarations, id, prop.into(), &context, input)
+                PropertyDeclaration::parse_into(&mut declarations, id, prop, &context, input)
                     .map_err(|_| input.new_custom_error(()))
             })?;
             let _ = input.try(parse_important);
             Ok(())
         }).is_ok()
     }
 }