layout/reftests/cssom/computed-style-cross-window-ref.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/reftests/cssom/computed-style-cross-window-ref.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,75 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<title>getComputedStyle across windows</title>
     1.6 +<style>
     1.7 +p { color: blue }
     1.8 +
     1.9 +div { margin: 1em 0 }
    1.10 +</style>
    1.11 +
    1.12 +<script>
    1.13 +
    1.14 +var gRunCount = 2;
    1.15 +
    1.16 +function run() {
    1.17 +  if (--gRunCount != 0)
    1.18 +    return;
    1.19 +
    1.20 +  var i = document.getElementById("i");
    1.21 +
    1.22 +  var pout = document.getElementById("out");
    1.23 +  var poutnone = document.getElementById("outnone");
    1.24 +  var poutdet = document.createElement("p");
    1.25 +  var pin = i.contentDocument.getElementsByTagName("p")[0];
    1.26 +  var pinnone = i.contentDocument.getElementsByTagName("p")[1];
    1.27 +  var pindet = i.contentDocument.createElement("p");
    1.28 +
    1.29 +  document.getElementById("res1").style.color =
    1.30 +    window.getComputedStyle(pin, "").color;
    1.31 +
    1.32 +  document.getElementById("res2").style.color =
    1.33 +    i.contentWindow.getComputedStyle(pout, "").color;
    1.34 +
    1.35 +  document.getElementById("res3").style.color =
    1.36 +    window.getComputedStyle(pinnone, "").color;
    1.37 +
    1.38 +  document.getElementById("res4").style.color =
    1.39 +    i.contentWindow.getComputedStyle(poutnone, "").color;
    1.40 +
    1.41 +  document.getElementById("res5").style.color =
    1.42 +    window.getComputedStyle(pindet, "").color;
    1.43 +
    1.44 +  document.getElementById("res6").style.color =
    1.45 +    i.contentWindow.getComputedStyle(poutdet, "").color;
    1.46 +}
    1.47 +
    1.48 +</script>
    1.49 +<body onload="run()">
    1.50 +
    1.51 +<p id="out">This is a paragraph outside the iframe.</p>
    1.52 +<div style="display:none"><p id="outnone">This is a paragraph outside the iframe.</p></div>
    1.53 +
    1.54 +<iframe id="i" src="computed-style-cross-window-inner.html" onload="run()"></iframe>
    1.55 +
    1.56 +<div style="color:fuchsia">This paragraph is the color that
    1.57 +outerWindow.getComputedStyle says the paragraph inside the iframe
    1.58 +is.</div>
    1.59 +
    1.60 +<div style="color:blue">This paragraph is the color that
    1.61 +iframeWindow.getComputedStyle says the paragraph outside the iframe
    1.62 +is.</div>
    1.63 +
    1.64 +<div style="color:fuchsia">This paragraph is the color that
    1.65 +outerWindow.getComputedStyle says the display:none paragraph inside the
    1.66 +iframe is.</div>
    1.67 +
    1.68 +<div style="color:blue">This paragraph is the color that
    1.69 +iframeWindow.getComputedStyle says the display:none paragraph outside
    1.70 +the iframe is.</div>
    1.71 +
    1.72 +<div style="color:blue">This paragraph is the color that
    1.73 +outerWindow.getComputedStyle says the detached paragraph inside the
    1.74 +iframe is.</div>
    1.75 +
    1.76 +<div style="color:fuchsia">This paragraph is the color that
    1.77 +iframeWindow.getComputedStyle says the detached paragraph outside
    1.78 +the iframe is.</div>

mercurial