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

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html class="reftest-wait">
michael@0 3 <title>getComputedStyle across windows</title>
michael@0 4 <style>
michael@0 5 p { color: blue }
michael@0 6
michael@0 7 div { margin: 1em 0 }
michael@0 8 </style>
michael@0 9
michael@0 10 <script>
michael@0 11
michael@0 12 var gRunCount = 2;
michael@0 13
michael@0 14 function run() {
michael@0 15 if (--gRunCount != 0)
michael@0 16 return;
michael@0 17
michael@0 18 var i = document.getElementById("i");
michael@0 19
michael@0 20 var pout = document.getElementById("out");
michael@0 21 var poutnone = document.getElementById("outnone");
michael@0 22 var poutdet = document.createElement("p");
michael@0 23 var pin = i.contentDocument.getElementsByTagName("p")[0];
michael@0 24 var pinnone = i.contentDocument.getElementsByTagName("p")[1];
michael@0 25 var pindet = i.contentDocument.createElement("p");
michael@0 26
michael@0 27 document.getElementById("res1").style.color =
michael@0 28 window.getComputedStyle(pin, "").color;
michael@0 29
michael@0 30 document.getElementById("res2").style.color =
michael@0 31 i.contentWindow.getComputedStyle(pout, "").color;
michael@0 32
michael@0 33 document.getElementById("res3").style.color =
michael@0 34 window.getComputedStyle(pinnone, "").color;
michael@0 35
michael@0 36 document.getElementById("res4").style.color =
michael@0 37 i.contentWindow.getComputedStyle(poutnone, "").color;
michael@0 38
michael@0 39 document.getElementById("res5").style.color =
michael@0 40 window.getComputedStyle(pindet, "").color;
michael@0 41
michael@0 42 document.getElementById("res6").style.color =
michael@0 43 i.contentWindow.getComputedStyle(poutdet, "").color;
michael@0 44
michael@0 45 document.documentElement.removeAttribute("class");
michael@0 46 }
michael@0 47
michael@0 48 </script>
michael@0 49 <body onload="run()">
michael@0 50
michael@0 51 <p id="out">This is a paragraph outside the iframe.</p>
michael@0 52 <div style="display:none"><p id="outnone">This is a paragraph outside the iframe.</p></div>
michael@0 53
michael@0 54 <iframe id="i" src="computed-style-cross-window-inner.html" onload="run()"></iframe>
michael@0 55
michael@0 56 <div id="res1">This paragraph is the color that
michael@0 57 outerWindow.getComputedStyle says the paragraph inside the iframe
michael@0 58 is.</div>
michael@0 59
michael@0 60 <div id="res2">This paragraph is the color that
michael@0 61 iframeWindow.getComputedStyle says the paragraph outside the iframe
michael@0 62 is.</div>
michael@0 63
michael@0 64 <div id="res3">This paragraph is the color that
michael@0 65 outerWindow.getComputedStyle says the display:none paragraph inside the
michael@0 66 iframe is.</div>
michael@0 67
michael@0 68 <div id="res4">This paragraph is the color that
michael@0 69 iframeWindow.getComputedStyle says the display:none paragraph outside
michael@0 70 the iframe is.</div>
michael@0 71
michael@0 72 <div id="res5">This paragraph is the color that
michael@0 73 outerWindow.getComputedStyle says the detached paragraph inside the
michael@0 74 iframe is.</div>
michael@0 75
michael@0 76 <div id="res6">This paragraph is the color that
michael@0 77 iframeWindow.getComputedStyle says the detached paragraph outside
michael@0 78 the iframe is.</div>

mercurial