2013-10-03 14:58:01 +04:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Test that preffed off properties do not appear in computed style</title>
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=919594">Mozilla Bug 919594</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script type="application/javascript; version=1.7">
|
|
|
|
|
|
|
|
/** Test that preffed off properties do not appear in computed style **/
|
|
|
|
|
|
|
|
function testWithAllPrefsDisabled() {
|
|
|
|
let exposedProperties = Object.keys(gCS).map(i => gCS[i]);
|
|
|
|
|
|
|
|
// Store the number of properties for later tests to use.
|
|
|
|
gLengthWithAllPrefsDisabled = gCS.length;
|
|
|
|
|
|
|
|
// Check that all of the properties behind the prefs are not exposed.
|
|
|
|
for (let pref in gProps) {
|
|
|
|
for (let prop of gProps[pref]) {
|
|
|
|
ok(exposedProperties.indexOf(prop) == -1, prop + " not exposed when prefs are false");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function testWithOnePrefEnabled(aPref) {
|
|
|
|
let exposedProperties = Object.keys(gCS).map(i => gCS[i]);
|
|
|
|
|
|
|
|
// Check that the number of properties on the object is as expected.
|
|
|
|
is(gCS.length, gLengthWithAllPrefsDisabled + gProps[aPref].length, "length when " + aPref + " is true");
|
|
|
|
|
|
|
|
// Check that the properties corresponding to aPref are exposed.
|
|
|
|
for (let prop of gProps[aPref]) {
|
|
|
|
ok(exposedProperties.indexOf(prop) != -1, prop + " exposed when " + aPref + " is true");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function step() {
|
|
|
|
if (gTestIndex == gTests.length) {
|
|
|
|
// Reached the end of the tests.
|
|
|
|
SimpleTest.finish();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gPrefsPushed) {
|
|
|
|
// We've just finished running one tests. Pop the prefs and go on to
|
|
|
|
// the next test.
|
|
|
|
gTestIndex++;
|
|
|
|
gPrefsPushed = false;
|
|
|
|
SpecialPowers.popPrefEnv(step);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// About to run one test. Push the prefs and run it.
|
|
|
|
let fn = gTests[gTestIndex].fn;
|
|
|
|
gPrefsPushed = true;
|
|
|
|
SpecialPowers.pushPrefEnv(gTests[gTestIndex].settings,
|
|
|
|
function() { fn(); SimpleTest.executeSoon(step); });
|
|
|
|
}
|
|
|
|
|
|
|
|
// ----
|
|
|
|
|
|
|
|
var gProps = {
|
2015-07-02 15:27:33 +03:00
|
|
|
"layout.css.vertical-text.enabled": ["text-orientation", "writing-mode"],
|
|
|
|
"layout.css.text-combine-upright.enabled": ["text-combine-upright"],
|
2013-10-03 14:58:01 +04:00
|
|
|
"layout.css.image-orientation.enabled": ["image-orientation"],
|
|
|
|
"layout.css.mix-blend-mode.enabled": ["mix-blend-mode"],
|
2014-10-15 16:13:00 +04:00
|
|
|
"layout.css.isolation.enabled": [ "isolation"],
|
2014-01-15 19:03:15 +04:00
|
|
|
"layout.css.masking.enabled": ["mask-type"],
|
2015-05-16 00:43:25 +03:00
|
|
|
"layout.css.touch_action.enabled": ["touch-action"],
|
2015-09-16 00:10:48 +03:00
|
|
|
"svg.transform-box.enabled": ["transform-box"]
|
2013-10-03 14:58:01 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
var gCS = getComputedStyle(document.body, "");
|
|
|
|
var gLengthWithAllPrefsDisabled;
|
|
|
|
|
|
|
|
var gTestIndex = 0;
|
|
|
|
var gPrefsPushed = false;
|
|
|
|
var gTests = [
|
|
|
|
// First, test when all of the prefs are disabled.
|
|
|
|
{ settings: { set: Object.keys(gProps).map(x => [x, false]) },
|
|
|
|
fn: testWithAllPrefsDisabled },
|
|
|
|
// Then, test each pref enabled individually.
|
|
|
|
...Object.keys(gProps).map(p =>
|
|
|
|
({ settings: { set: Object.keys(gProps).map(x => [x, x == p]) },
|
|
|
|
fn: testWithOnePrefEnabled.bind(null, p) }))
|
|
|
|
];
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
step();
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|