Bug 1484575 - Simplify PropertyDeclarationBlock::get a little. r=xidorn
authorCameron McCormack <cam@mcc.id.au>
Mon, 20 Aug 2018 04:11:37 +0000
changeset 487409 1aa8b1865c770f3b3a48bbda953ce5d38f69dd45
parent 487408 a592b4286d6fa94ecf434e2c5d0f9bac74e3bda9
child 487410 fc5c57e9b65b65e98fdc8e792913a5553bb67897
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1484575
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1484575 - Simplify PropertyDeclarationBlock::get a little. r=xidorn Depends On D3747 Differential Revision: https://phabricator.services.mozilla.com/D3748
servo/components/style/properties/declaration_block.rs
--- a/servo/components/style/properties/declaration_block.rs
+++ b/servo/components/style/properties/declaration_block.rs
@@ -300,24 +300,18 @@ impl PropertyDeclarationBlock {
     #[inline]
     pub fn get(&self, property: PropertyDeclarationId) -> Option<(&PropertyDeclaration, Importance)> {
         if let PropertyDeclarationId::Longhand(id) = property {
             if !self.contains(id) {
                 return None;
             }
         }
 
-        self.declarations.iter().enumerate().find(|&(_, decl)| decl.id() == property).map(|(i, decl)| {
-            let importance = if self.declarations_importance[i] {
-                Importance::Important
-            } else {
-                Importance::Normal
-            };
-            (decl, importance)
-        })
+        self.declaration_importance_iter()
+            .find(|(declaration, _)| declaration.id() == property)
     }
 
     fn shorthand_to_css(
         &self,
         shorthand: ShorthandId,
         dest: &mut CssStringWriter,
     ) -> fmt::Result {
         // Step 1.2.1 of