Bug 1466963: Trivially simplify a condition. r=xidorn
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 05 Jun 2018 21:17:08 +0200
changeset 805254 b8e27ee3035e79531e39961115f793815068b97b
parent 805253 3e80f0aa86c50d1cf89ea2f69de8b596e490e46f
child 805255 6245a29f2539b162a3d8bc5cc456c9e47bce4888
push id112610
push userbmo:gl@mozilla.com
push dateThu, 07 Jun 2018 15:48:24 +0000
reviewersxidorn
bugs1466963
milestone62.0a1
Bug 1466963: Trivially simplify a condition. r=xidorn MozReview-Commit-ID: L9LzpPt4js4
servo/components/style/properties/declaration_block.rs
--- a/servo/components/style/properties/declaration_block.rs
+++ b/servo/components/style/properties/declaration_block.rs
@@ -512,25 +512,25 @@ impl PropertyDeclarationBlock {
 
         if !definitely_new {
             let mut index_to_remove = None;
             for (i, slot) in self.declarations.iter_mut().enumerate() {
                 if slot.id() != declaration.id() {
                     continue;
                 }
 
-                let important = self.declarations_importance[i];
-                // For declarations from parsing, non-important declarations
-                // shouldn't override existing important one.
-                if important && !importance.important() &&
-                    matches!(source, DeclarationSource::Parsing) {
-                    return false;
-                }
+                if matches!(source, DeclarationSource::Parsing) {
+                    let important = self.declarations_importance[i];
 
-                if matches!(source, DeclarationSource::Parsing) {
+                    // For declarations from parsing, non-important declarations
+                    // shouldn't override existing important one.
+                    if important && !importance.important() {
+                        return false;
+                    }
+
                     // As a compatibility hack, specially on Android,
                     // don't allow to override a prefixed webkit display
                     // value with an unprefixed version from parsing
                     // code.
                     //
                     // TODO(emilio): Unship.
                     if let PropertyDeclaration::Display(old_display) = *slot {
                         use properties::longhands::display::computed_value::T as display;