Auto merge of #15872 - servo:dedup, r=emilio

Fix debug assertion failure in gecko CI

<!-- 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/15872)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-03-08 13:35:40 -08:00 committed by GitHub
commit 2565242665
3 changed files with 32 additions and 3 deletions

View file

@ -288,10 +288,15 @@ impl PropertyDeclarationBlock {
}
let important_count = &mut self.important_count;
let mut removed_at_least_one = false;
let longhands = &mut self.longhands;
self.declarations.retain(|&(ref declaration, importance)| {
let remove = declaration.id().is_or_is_longhand_of(property);
let id = declaration.id();
let remove = id.is_or_is_longhand_of(property);
if remove {
removed_at_least_one = true;
if let PropertyDeclarationId::Longhand(id) = id {
longhands.remove(id)
}
if importance.important() {
*important_count -= 1
}
@ -299,9 +304,8 @@ impl PropertyDeclarationBlock {
!remove
});
if let PropertyId::Longhand(id) = *property {
if let PropertyId::Longhand(_) = *property {
debug_assert!(removed_at_least_one);
self.longhands.remove(id);
}
removed_at_least_one
}

View file

@ -11024,6 +11024,12 @@
{}
]
],
"css/bug_1345483.html": [
[
"/_mozilla/css/bug_1345483.html",
{}
]
],
"css/empty-keyframes.html": [
[
"/_mozilla/css/empty-keyframes.html",
@ -20613,6 +20619,10 @@
"2ebf9c8f963a2f3971a3c1b64b6b01825eacdedc",
"support"
],
"css/bug_1345483.html": [
"41b55af9d5c95910b1af74c0fbffb24e20bbe869",
"testharness"
],
"css/button_css_width.html": [
"bb88fcb6c5856a1f5199599938e1b9c84aa8ea77",
"reftest"

View file

@ -0,0 +1,15 @@
<!doctype html>
<meta charset="utf-8">
<title></title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
var style = document.documentElement.style;
style.marginTop = "0";
assert_equals(style.marginTop, "0px");
style.margin = null; // This used to fail to unset a bit in a LonghandIdSet
assert_equals(style.marginTop, "");
style.marginTop = null; // This would find the bit and expect to find a corresponding declarations.
}, "regression for bug 1345483")
</script>