layout/reftests/image/image-orientation-ref.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/reftests/image/image-orientation-ref.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,80 @@
     1.4 +<!DOCTYPE>
     1.5 +<head>
     1.6 +  <style>
     1.7 +    body {
     1.8 +      border:  0px;
     1.9 +      margin:  0px;
    1.10 +      padding: 0px;
    1.11 +    }
    1.12 +    div {
    1.13 +      border:  50px solid black;
    1.14 +      margin:  50px;
    1.15 +      padding: 50px;
    1.16 +    }
    1.17 +    table {
    1.18 +      border-spacing: 0px;
    1.19 +    }
    1.20 +  </style>
    1.21 +</head>
    1.22 +<body>
    1.23 +  <div>
    1.24 +    <table>
    1.25 +      <tr>
    1.26 +        <td id="ul"></td>
    1.27 +        <td id="ur"></td>
    1.28 +      </tr>
    1.29 +      <tr>
    1.30 +        <td id="ll"></td>
    1.31 +        <td id="lr"></td>
    1.32 +      </tr>
    1.33 +    </table>
    1.34 +  </div>
    1.35 +
    1.36 +  <script>
    1.37 +    var orientation = location.search.substring(1).split("&");
    1.38 +    var angle = parseInt(orientation[0]);
    1.39 +    var flip = orientation[1] == "flip" ? true : false;
    1.40 +
    1.41 +    // Each id corresponds to a color.
    1.42 +    var ids = ["ul", "ur", "lr", "ll"];
    1.43 +    var colors = [
    1.44 +      "rgb(0, 191, 0)",
    1.45 +      "rgb(0, 255, 1)",
    1.46 +      "rgb(254, 0, 122)",
    1.47 +      "rgb(191, 0, 93)",
    1.48 +    ];
    1.49 +
    1.50 +    // 'Rotate' the colors according to the angle.
    1.51 +    colors.unshift.apply(colors, colors.splice((360 - angle) / 90, colors.length));
    1.52 +
    1.53 +    // 'Flip' the colors if requested.
    1.54 +    if (flip) {
    1.55 +        var tmp = colors[0];
    1.56 +        colors[0] = colors[1];
    1.57 +        colors[1] = tmp;
    1.58 +        tmp = colors[2];
    1.59 +        colors[2] = colors[3];
    1.60 +        colors[3] = tmp;
    1.61 +    }
    1.62 +
    1.63 +    // Construct a style.
    1.64 +    var style = "";
    1.65 +
    1.66 +    if (angle == 90 || angle == 270) {
    1.67 +      style += "div { width: 200px; height: 100px; }\n";
    1.68 +      style += "td { width: 100px; height: 50px; }\n";
    1.69 +    } else {
    1.70 +      style += "div { width: 100px; height: 200px; }\n";
    1.71 +      style += "td { width: 50px; height: 100px; }\n";
    1.72 +    }
    1.73 +
    1.74 +    for (var i = 0 ; i < 4 ; ++i) {
    1.75 +      style += "#" + ids[i] + " { background-color: " + colors[i] + "; }\n";
    1.76 +    }
    1.77 +
    1.78 +    // Apply the style to the document.
    1.79 +    var sheet = document.createElement('style');
    1.80 +    sheet.innerHTML = style;
    1.81 +    document.body.appendChild(sheet);
    1.82 +  </script>
    1.83 +</body>

mercurial