DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (b6057e17f856)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
<!DOCTYPE HTML>
<html>
<!--
-->
<head>
  <title>Test for preference not to use document colors</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  <style type="text/css">

  #one, #three { background: blue; color: yellow; border: thin solid red; -moz-column-rule: 2px solid green; text-shadow: 2px 2px green; box-shadow: 3px 7px blue; }
  #two { background: transparent; border: thin solid; }
  #five, #six {border: thick solid red; -moz-border-start-color:green; -moz-border-end-color:blue}
  #seven {
    border: 3px solid;
    -moz-border-top-colors: blue aqua fuchsia;
    -moz-border-right-colors: aqua blue fuchsia;
    -moz-border-bottom-colors: blue fuchsia aqua;
    -moz-border-left-colors: fuchsia blue blue;
  }

  /* XXX also test rgba() */

  </style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=58048">Mozilla Bug 58048</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=255411">Mozilla Bug 255411</a>
<div id="display">

<div id="one">Hello</div>
<div id="two">Hello</div>
<input id="three" type="button" value="Hello">
<input id="four" type="button" value="Hello">
<div id="five" dir="ltr">Hello</div>
<div id="six" dir="rtl">Hello</div>
<div id="seven">Hello</div>

</div>
<pre id="test">
<script class="testbody" type="text/javascript">

SimpleTest.waitForExplicitFinish();

var cs1 = getComputedStyle(document.getElementById("one"), "");
var cs2 = getComputedStyle(document.getElementById("two"), "");
var cs3 = getComputedStyle(document.getElementById("three"), "");
var cs4 = getComputedStyle(document.getElementById("four"), "");
var cs5 = getComputedStyle(document.getElementById("five"), "");
var cs6 = getComputedStyle(document.getElementById("six"), "");
var cs7 = getComputedStyle(document.getElementById("seven"), "");

SpecialPowers.pushPrefEnv({'set': [['browser.display.use_document_colors', true]]}, part1);

var transparentBackgroundColor;
var inputBackgroundColor, inputColor, inputBorderTopColor;
var inputBorderRightColor, inputBorderLeftColor, inputBorderBottomColor;

function part1()
{

    isnot(cs1.backgroundColor, cs2.backgroundColor, "background-color applies");
    isnot(cs1.color, cs2.color, "color applies");
    isnot(cs1.borderTopColor, cs2.borderTopColor, "border-top-color applies");
    isnot(cs1.borderRightColor, cs2.borderRightColor,
          "border-right-color applies");
    isnot(cs1.borderLeftColor, cs2.borderLeftColor,
          "border-left-color applies");
    isnot(cs1.borderBottomColor, cs2.borderBottomColor,
          "border-top-color applies");
    isnot(cs1.MozColumnRuleColor, cs2.MozColumnRuleColor,
          "-moz-column-rule-color applies");
    isnot(cs1.textShadow, cs2.textShadow,
          "text-shadow applies");
    isnot(cs1.boxShadow, cs2.boxShadow,
          "box-shadow applies");
    is(cs1.borderTopColor, cs3.borderTopColor, "border-top-color applies");
    is(cs1.borderRightColor, cs3.borderRightColor,
       "border-right-color applies");
    is(cs1.borderLeftColor, cs3.borderLeftColor,
       "border-left-color applies");
    is(cs1.borderBottomColor, cs3.borderBottomColor, 
       "border-top-color applies");
    is(cs1.MozColumnRuleColor, cs3.MozColumnRuleColor,
       "-moz-column-rule-color applies");
    is(cs1.textShadow, cs3.textShadow,
       "text-shadow applies");
    is(cs1.boxShadow, cs3.boxShadow,
       "box-shadow applies");
    isnot(cs5.borderRightColor, cs2.borderRightColor,
          "-moz-border-end-color applies");
    isnot(cs5.borderLeftColor, cs2.borderLeftColor,
          "-moz-border-start-color applies");    
    isnot(cs6.borderRightColor, cs2.borderRightColor,
          "-moz-border-start-color applies");
    isnot(cs6.borderLeftColor, cs2.borderLeftColor,
          "-moz-border-end-color applies");
    isnot(cs7.MozBorderTopColors, cs2.MozBorderTopColors,
          "-moz-border-top-colors applies");
    isnot(cs7.MozBorderRightColors, cs2.MozBorderRightColors,
          "-moz-border-right-colors applies");
    isnot(cs7.MozBorderBottomColors, cs2.MozBorderBottomColors,
          "-moz-border-bottom-colors applies");
    isnot(cs7.MozBorderLeftColors, cs2.MozBorderLeftColors,
          "-moz-border-left-colors applies");
    is(cs1.color, cs3.color, "color applies");
    is(cs1.backgroundColor, cs3.backgroundColor, "background-color applies");
    isnot(cs3.backgroundColor, cs4.backgroundColor, "background-color applies");
    isnot(cs3.color, cs4.color, "color applies");
    isnot(cs3.borderTopColor, cs4.borderTopColor, "border-top-color applies");
    isnot(cs3.borderRightColor, cs4.borderRightColor,
          "border-right-color applies");
    isnot(cs3.borderLeftColor, cs4.borderLeftColor,
          "border-left-color applies");
    isnot(cs3.borderBottomColor, cs4.borderBottomColor,
          "border-bottom-color applies");
    transparentBackgroundColor = cs2.backgroundColor;
    inputBackgroundColor = cs4.backgroundColor;
    inputColor = cs4.color;
    inputBorderTopColor = cs4.borderTopColor;
    inputBorderRightColor = cs4.borderRightColor;
    inputBorderLeftColor = cs4.borderLeftColor;
    inputBorderBottomColor = cs4.borderBottomColor;
    SpecialPowers.pushPrefEnv({'set': [['browser.display.use_document_colors', false]]}, part2);
}

function part2()
{
    isnot(cs1.backgroundColor, cs2.backgroundColor, "background-color transparency preserved (opaque)");
    is(cs2.backgroundColor, transparentBackgroundColor, "background-color transparency is preserved (transparent)");
    is(cs1.color, cs2.color, "color is blocked");
    is(cs1.borderTopColor, cs2.borderTopColor, "border-top-color is blocked");
    is(cs1.borderRightColor, cs2.borderRightColor,
       "border-right-color is blocked");
    is(cs1.borderLeftColor, cs2.borderLeftColor,
       "border-left-color is blocked");
    is(cs5.borderRightColor, cs2.borderRightColor,
       "-moz-border-end-color is blocked");
    is(cs5.borderLeftColor, cs2.borderLeftColor,
       "-moz-border-start-color is blocked");
    is(cs6.borderRightColor, cs2.borderRightColor,
       "-moz-border-start-color is blocked");
    is(cs6.borderLeftColor, cs2.borderLeftColor,
       "-moz-border-end-color is blocked");
    is(cs7.MozBorderTopColors, cs2.MozBorderTopColors,
       "-moz-border-top-colors is blocked");
    is(cs7.MozBorderRightColors, cs2.MozBorderRightColors,
       "-moz-border-right-colors is blocked");
    is(cs7.MozBorderBottomColors, cs2.MozBorderBottomColors,
       "-moz-border-bottom-colors is blocked");
    is(cs7.MozBorderLeftColors, cs2.MozBorderLeftColors,
       "-moz-border-left-colors is blocked");
    is(cs1.borderBottomColor, cs2.borderBottomColor,
       "border-bottom-color is blocked");
    is(cs1.MozColumnRuleColor, cs2.MozColumnRuleColor,
       "-moz-column-rule-color is blocked");
    is(cs1.textShadow, cs2.textShadow,
       "text-shadow is blocked");
    is(cs1.boxShadow, cs2.boxShadow,
       "box-shadow is blocked");
    is(cs3.backgroundColor, cs1.backgroundColor, "background-color transparency preserved (opaque)");
    is(cs3.color, cs4.color, "color is blocked");
    is(cs3.borderTopColor, cs4.borderTopColor, "border-top-color is blocked");
    is(cs3.borderRightColor, cs4.borderRightColor,
       "border-right-color is blocked");
    is(cs3.borderLeftColor, cs4.borderLeftColor,
       "border-left-color is blocked");
    is(cs3.borderBottomColor, cs4.borderBottomColor,
       "border-bottom-color is blocked");
    is(cs4.backgroundColor, inputBackgroundColor, "background-color not broken on inputs");
    is(cs4.color, inputColor, "color not broken on inputs");
    is(cs4.borderTopColor, inputBorderTopColor, "border-top-color not broken on inputs");
    is(cs4.borderRightColor, inputBorderRightColor,
       "border-right-color not broken on inputs");
    is(cs4.borderLeftColor, inputBorderLeftColor,
       "border-left-color not broken on inputs");
    is(cs4.borderBottomColor, inputBorderBottomColor,
       "border-bottom-color not broken on inputs");

    SimpleTest.finish();
}

</script>
</pre>
</body>
</html>