mirror of
https://github.com/servo/servo.git
synced 2025-07-03 21:43:41 +01:00
Auto merge of #20582 - upsuper:cssom-append, r=emilio
Have CSSOM append rather than replace slot in declaration block The early return for identical setting in importance matching as well as the comment before `index_to_remove` are removed because the order is web-exposing regardless of whether it's from CSSOM or parsing. e.g. `top: 1px; left: 2px; top: 1px;` is effectively `left: 2px; top: 1px;`, not `top: 1px; left: 2px;`. This is patch for [bug 1415330](https://bugzilla.mozilla.org/show_bug.cgi?id=1415330), for spec change in w3c/csswg-drafts#2516. And corresponding test will be added in w3c/web-platform-tests#10354. <!-- 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/20582) <!-- Reviewable:end -->
This commit is contained in:
commit
ccc9d1c4c2
1 changed files with 20 additions and 40 deletions
|
@ -518,30 +518,14 @@ impl PropertyDeclarationBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
let important = self.declarations_importance.get(i as u32);
|
let important = self.declarations_importance.get(i as u32);
|
||||||
match (important, importance.important()) {
|
// For declarations from parsing, non-important declarations
|
||||||
(false, true) => {}
|
// shouldn't override existing important one.
|
||||||
|
if important && !importance.important() &&
|
||||||
(true, false) => {
|
matches!(source, DeclarationSource::Parsing) {
|
||||||
// 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;
|
return true;
|
||||||
}
|
}
|
||||||
DeclarationSource::Parsing => {
|
|
||||||
|
if matches!(source, 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
|
||||||
|
@ -557,15 +541,11 @@ impl PropertyDeclarationBlock {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 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);
|
index_to_remove = Some(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(index) = index_to_remove {
|
if let Some(index) = index_to_remove {
|
||||||
self.declarations.remove(index);
|
self.declarations.remove(index);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue