Skip to content

Commit ebc97f3

Browse files
committed
Bug 1978208 - Serialize Color::InheritFromBodyQuirk. r=emilio.
Differential Revision: https://phabricator.services.mozilla.com/D257858
1 parent 0868d0b commit ebc97f3

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<!DOCTYPE html>
21
<link rel="stylesheet" href="getMatchingCSSRules-1.css">
32
<unknowntagname></unknowntagname>
43
<img width=10 height=15>
54
<div class="anim"></div>
65
<div style="z-index: 1;"></div>
6+
<table></table>

layout/inspector/tests/test_getMatchingCSSRules.html

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,20 @@
3434
return null;
3535
}
3636

37-
function checkDeclaration(target, origin, props) {
37+
function checkDeclaration(doc, selector, origin, props) {
38+
info(`Checking ${origin} declarations for element "${selector}"`);
3839
ok(!!props, "Should pass some properties to check");
40+
41+
const target = doc.querySelector(selector);
3942
let decl = getDeclarationWithOrigin(target, origin);
40-
ok(!!decl, "Should find a declaration for " + origin);
41-
info(decl.style.cssText);
42-
for (let [k, v] of Object.entries(props)) {
43-
is(decl.style[k], v, `Should see ${k}: ${v}`);
43+
ok(!!decl, `Should find a ${origin} declaration for "${selector}"`);
44+
45+
const propsEntries = Object.entries(props);
46+
is(decl.style.length, propsEntries.length, `Got expected number of ${origin} declarations for "${selector}"`);
47+
for (let i = 0; i < decl.style.length; i++) {
48+
const [name, value] = propsEntries[i] || [];
49+
is(decl.style[i], name, `Should see "${name}" property on ${origin} declaration for "${selector}"`);
50+
is(decl.style[name], value, `"${name}" has expected "${value}" value on ${origin} declaration for "${selector}"`);
4451
}
4552
let modificationThrew = false;
4653
try {
@@ -205,9 +212,10 @@
205212
{
206213
title: "Check pres hints",
207214
async run(doc, win) {
208-
checkDeclaration(doc.querySelector("img"), "pres-hints", { width: "10px", height: "15px" });
209-
checkDeclaration(doc.querySelector(".anim"), "animations", {zIndex: "1"});
210-
checkDeclaration(doc.querySelector("[style]"), "style-attribute", {zIndex: "1"});
215+
checkDeclaration(doc, "img", "pres-hints", { width: "10px", height: "15px", "aspect-ratio": "auto 10 / 15" });
216+
checkDeclaration(doc, "table", "pres-hints", {color: "-moz-inherit-from-body-quirk"});
217+
checkDeclaration(doc, ".anim", "animations", {"z-index": "1"});
218+
checkDeclaration(doc, "[style]", "style-attribute", {"z-index": "1"});
211219
// TODO: transitions/SMIL are a bit more annoying to test.
212220
},
213221
}

servo/components/style/values/specified/color.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ impl ToCss for Color {
529529
#[cfg(feature = "gecko")]
530530
Color::System(system) => system.to_css(dest),
531531
#[cfg(feature = "gecko")]
532-
Color::InheritFromBodyQuirk => Ok(()),
532+
Color::InheritFromBodyQuirk => dest.write_str("-moz-inherit-from-body-quirk"),
533533
}
534534
}
535535
}

0 commit comments

Comments
 (0)