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 (a81015259a98)

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 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=652486
-->
<head>
  <title>Test for Bug 652486</title>
  <script type="text/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=652486">Mozilla Bug 652486</a>

<p id="display"></p>
<div id="content" style="display: none">
  <div id="t"></div>  
</div>
<pre id="test">
<script class="testbody" type="text/javascript">

/** Test for Bug 652486 **/

function c() {
  return document.defaultView.getComputedStyle($('t'), "").
           getPropertyValue("text-decoration");
}

function cval() {
  var val = document.defaultView.getComputedStyle($('t'), "").
              getPropertyCSSValue("text-decoration");
  return val ? val.getStringValue() : val;
}

var tests = [
  // When only text-decoration was specified, text-decoration should look like
  // a longhand property.
  { decoration: "none",
    blink: null, line: null, color: null, style: null,
    expectedValue: "none", expectedCSSValue: "none" },
  { decoration: "underline",
    blink: null, line: null, color: null, style: null,
    expectedValue: "underline", expectedCSSValue: "underline" },
  { decoration: "overline",
    blink: null, line: null, color: null, style: null,
    expectedValue: "overline", expectedCSSValue: "overline" },
  { decoration: "line-through",
    blink: null, line: null, color: null, style: null,
    expectedValue: "line-through", expectedCSSValue: "line-through" },
  { decoration: "blink",
    blink: null, line: null, color: null, style: null,
    expectedValue: "blink", expectedCSSValue: "blink" },
  { decoration: "underline overline",
    blink: null, line: null, color: null, style: null,
    expectedValue: "underline overline",
    expectedCSSValue: "underline overline" },
  { decoration: "underline line-through",
    blink: null, line: null, color: null, style: null,
    expectedValue: "underline line-through",
    expectedCSSValue: "underline line-through" },
  { decoration: "blink underline",
    blink: null, line: null, color: null, style: null,
    expectedValue: "underline blink",
    expectedCSSValue: "underline blink" },
  { decoration: "underline blink",
    blink: null, line: null, color: null, style: null,
    expectedValue: "underline blink",
    expectedCSSValue: "underline blink" },

  // When only text-decoration-line or text-blink was specified,
  // text-decoration should look like a longhand property.
  { decoration: null,
    blink: "blink", line: null, color: null, style: null,
    expectedValue: "blink", expectedCSSValue: "blink" },
  { decoration: null,
    blink: null, line: "underline", color: null, style: null,
    expectedValue: "underline", expectedCSSValue: "underline" },
  { decoration: null,
    blink: null, line: "overline", color: null, style: null,
    expectedValue: "overline", expectedCSSValue: "overline" },
  { decoration: null,
    blink: null, line: "line-through", color: null, style: null,
    expectedValue: "line-through", expectedCSSValue: "line-through" },
  { decoration: null,
    blink: "blink", line: "underline", color: null, style: null,
    expectedValue: "underline blink", expectedCSSValue: "underline blink" },
  { decoration: null,
    blink: "none", line: "underline", color: null, style: null,
    expectedValue: "underline", expectedCSSValue: "underline" },
  { decoration: null,
    blink: "blink", line: "none", color: null, style: null,
    expectedValue: "blink", expectedCSSValue: "blink" },

  // When text-decoration-color isn't its initial value,
  // text-decoration should be a shorthand property.
  { decoration: "blink",
    blink: null, line: null, color: "rgb(0, 0, 0)", style: null,
    expectedValue: "", expectedCSSValue: null },
  { decoration: "underline",
    blink: null, line: null, color: "black", style: null,
    expectedValue: "", expectedCSSValue: null },
  { decoration: "overline",
    blink: null, line: null, color: "#ff0000", style: null,
    expectedValue: "", expectedCSSValue: null },
  { decoration: "line-through",
    blink: null, line: null, color: "-moz-initial", style: null,
    expectedValue: "line-through", expectedCSSValue: "line-through" },
  { decoration: "blink underline",
    blink: null, line: null, color: "currentColor", style: null,
    expectedValue: "underline blink", expectedCSSValue: "underline blink" },
  { decoration: "underline line-through",
    blink: null, line: null, color: "-moz-use-text-color", style: null,
    expectedValue: "underline line-through",
    expectedCSSValue: "underline line-through" },

  // When text-decoration-style isn't its initial value,
  // text-decoration should be a shorthand property.
  { decoration: "blink",
    blink: null, line: null, color: null, style: "-moz-none",
    expectedValue: "", expectedCSSValue: null },
  { decoration: "underline",
    blink: null, line: null, color: null, style: "dotted",
    expectedValue: "", expectedCSSValue: null },
  { decoration: "overline",
    blink: null, line: null, color: null, style: "dashed",
    expectedValue: "", expectedCSSValue: null },
  { decoration: "line-through",
    blink: null, line: null, color: null, style: "double",
    expectedValue: "", expectedCSSValue: null },
  { decoration: "blink underline",
    blink: null, line: null, color: null, style: "wavy",
    expectedValue: "", expectedCSSValue: null },
  { decoration: "underline blink overline line-through",
    blink: null, line: null, color: null, style: "solid",
    expectedValue: "underline overline line-through blink",
    expectedCSSValue: "underline overline line-through blink" },
  { decoration: "line-through overline underline",
    blink: null, line: null, color: null, style: "-moz-initial",
    expectedValue: "underline overline line-through",
    expectedCSSValue: "underline overline line-through" }
];

function makeDeclaration(aTest)
{
  var str = "";
  if (aTest.decoration) {
    str += "text-decoration: " + aTest.decoration + "; ";
  }
  if (aTest.blink) {
    str += "-moz-text-blink: " + aTest.blink + "; ";
  }
  if (aTest.color) {
    str += "-moz-text-decoration-color: " + aTest.color + "; ";
  }
  if (aTest.line) {
    str += "-moz-text-decoration-line: " + aTest.line + "; ";
  }
  if (aTest.style) {
    str += "-moz-text-decoration-style: " + aTest.style + "; ";
  }
  return str;
}

function clearStyleObject()
{
  $('t').style.textDecoration = null;
}

for (var i = 0; i < tests.length; ++i) {
  var test = tests[i];
  if (test.decoration) {
    $('t').style.textDecoration = test.decoration;
  }
  if (test.blink) {
    $('t').style.MozTextBlink = test.blink;
  }
  if (test.color) {
    $('t').style.MozTextDecorationColor = test.color;
  }
  if (test.line) {
    $('t').style.MozTextDecorationLine = test.line;
  }
  if (test.style) {
    $('t').style.MozTextDecorationStyle = test.style;
  }

  var dec = makeDeclaration(test);
  is(c(), test.expectedValue, "Test1 (computed value): " + dec);
  is(cval(), test.expectedCSSValue, "Test1 (CSS value): " + dec);

  clearStyleObject();

  $('t').setAttribute("style", dec);

  is(c(), test.expectedValue, "Test2 (computed value): " + dec);
  is(cval(), test.expectedCSSValue, "Test2 (CSS value): " + dec);

  $('t').removeAttribute("style");
}

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