mirror of
https://github.com/servo/servo.git
synced 2025-07-13 02:13:40 +01:00
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 -->
This commit is contained in:
commit
ac6e04ebfb
1 changed files with 42 additions and 40 deletions
|
@ -470,54 +470,56 @@ impl PropertyDeclarationBlock {
|
||||||
if !definitely_new {
|
if !definitely_new {
|
||||||
let mut index_to_remove = None;
|
let mut index_to_remove = None;
|
||||||
for (i, slot) in self.declarations.iter_mut().enumerate() {
|
for (i, slot) in self.declarations.iter_mut().enumerate() {
|
||||||
if slot.id() == declaration.id() {
|
if slot.id() != declaration.id() {
|
||||||
let important = self.declarations_importance.get(i as u32);
|
continue;
|
||||||
match (important, importance.important()) {
|
}
|
||||||
(false, true) => {}
|
|
||||||
|
|
||||||
(true, false) => {
|
let important = self.declarations_importance.get(i as u32);
|
||||||
// For declarations set from the OM, less-important
|
match (important, importance.important()) {
|
||||||
// declarations are overridden.
|
(false, true) => {}
|
||||||
if !matches!(source, DeclarationSource::CssOm) {
|
|
||||||
return false
|
(true, false) => {
|
||||||
}
|
// For declarations set from the OM, more-important
|
||||||
}
|
// declarations are overridden.
|
||||||
_ => if *slot == declaration {
|
if !matches!(source, DeclarationSource::CssOm) {
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_ => if *slot == declaration {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
match source {
|
match source {
|
||||||
// CSSOM preserves the declaration position, and
|
// CSSOM preserves the declaration position, and
|
||||||
// overrides importance.
|
// overrides importance.
|
||||||
DeclarationSource::CssOm => {
|
DeclarationSource::CssOm => {
|
||||||
*slot = declaration;
|
*slot = declaration;
|
||||||
self.declarations_importance.set(i as u32, importance.important());
|
self.declarations_importance.set(i as u32, importance.important());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
DeclarationSource::Parsing => {
|
DeclarationSource::Parsing => {
|
||||||
// As a compatibility hack, specially on Android,
|
// As a compatibility hack, specially on Android,
|
||||||
// don't allow to override a prefixed webkit display
|
// don't allow to override a prefixed webkit display
|
||||||
// value with an unprefixed version from parsing
|
// value with an unprefixed version from parsing
|
||||||
// code.
|
// code.
|
||||||
//
|
//
|
||||||
// TODO(emilio): Unship.
|
// TODO(emilio): Unship.
|
||||||
if let PropertyDeclaration::Display(old_display) = *slot {
|
if let PropertyDeclaration::Display(old_display) = *slot {
|
||||||
use properties::longhands::display::computed_value::T as display;
|
use properties::longhands::display::computed_value::T as display;
|
||||||
|
|
||||||
if let PropertyDeclaration::Display(new_display) = declaration {
|
if let PropertyDeclaration::Display(new_display) = declaration {
|
||||||
if display::should_ignore_parsed_value(old_display, new_display) {
|
if display::should_ignore_parsed_value(old_display, new_display) {
|
||||||
return false;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue