diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-11-26 12:45:41 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-26 12:45:41 -0600 |
commit | ac6e04ebfbf27317fea00ea93e855520237b538d (patch) | |
tree | 53d9f70ebbd44415537331e77770ae447025849c | |
parent | e44c0b74967298c098be8ee2ea9a956b1f42e300 (diff) | |
parent | 47e9c8874278037a3d3b4dcc29becff2d61ee203 (diff) | |
download | servo-ac6e04ebfbf27317fea00ea93e855520237b538d.tar.gz servo-ac6e04ebfbf27317fea00ea93e855520237b538d.zip |
Auto merge of #19382 - emilio:pdb-deindent, r=canaltinova
style: Deindent some property declaration code.
<!-- 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/19382)
<!-- Reviewable:end -->
-rw-r--r-- | components/style/properties/declaration_block.rs | 86 |
1 files changed, 44 insertions, 42 deletions
diff --git a/components/style/properties/declaration_block.rs b/components/style/properties/declaration_block.rs index 20bcb70f1dd..213d1df5431 100644 --- a/components/style/properties/declaration_block.rs +++ b/components/style/properties/declaration_block.rs @@ -470,54 +470,56 @@ 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() { - let important = self.declarations_importance.get(i as u32); - match (important, importance.important()) { - (false, true) => {} - - (true, false) => { - // For declarations set from the OM, less-important - // declarations are overridden. - if !matches!(source, DeclarationSource::CssOm) { - return false - } - } - _ => if *slot == declaration { - return false; + if slot.id() != declaration.id() { + continue; + } + + let important = self.declarations_importance.get(i as u32); + match (important, importance.important()) { + (false, true) => {} + + (true, false) => { + // For declarations set from the OM, more-important + // declarations are overridden. + if !matches!(source, DeclarationSource::CssOm) { + return false } } + _ => if *slot == declaration { + return false; + } + } - match source { - // CSSOM preserves the declaration position, and - // overrides importance. - DeclarationSource::CssOm => { - *slot = declaration; - self.declarations_importance.set(i as u32, importance.important()); - return true; - } - DeclarationSource::Parsing => { - // 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; - - if let PropertyDeclaration::Display(new_display) = declaration { - if display::should_ignore_parsed_value(old_display, new_display) { - return false; - } + match source { + // CSSOM preserves the declaration position, and + // overrides importance. + DeclarationSource::CssOm => { + *slot = declaration; + self.declarations_importance.set(i as u32, importance.important()); + return true; + } + DeclarationSource::Parsing => { + // 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; + + if let PropertyDeclaration::Display(new_display) = declaration { + if display::should_ignore_parsed_value(old_display, new_display) { + return false; } } - - // NOTE(emilio): We could avoid this and just override for - // properties not affected by logical props, but it's not - // clear it's worth it given the `definitely_new` check. - index_to_remove = Some(i); - break; } + + // NOTE(emilio): We could avoid this and just override for + // properties not affected by logical props, but it's not + // clear it's worth it given the `definitely_new` check. + index_to_remove = Some(i); + break; } } } |