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