Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | <?xml-stylesheet type="text/css" href="chrome://global/skin"?> |
michael@0 | 3 | <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" |
michael@0 | 4 | type="text/css"?> |
michael@0 | 5 | <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 6 | onload="runTests()"> |
michael@0 | 7 | <script type="application/javascript" |
michael@0 | 8 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <script type="text/javascript" |
michael@0 | 10 | src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script> |
michael@0 | 11 | <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script> |
michael@0 | 12 | |
michael@0 | 13 | <div id="container" xmlns="http://www.w3.org/1999/xhtml" style="height:400px; overflow:auto; background:gray"> |
michael@0 | 14 | <div style="height:0"> |
michael@0 | 15 | <iframe type="content" id="f" src="no_clip_iframe_subdoc.html" |
michael@0 | 16 | style="margin-top:50px; border:1px solid black; width:100px; height:100px;"/> |
michael@0 | 17 | </div> |
michael@0 | 18 | <div id="ref" style="background:gray;"> |
michael@0 | 19 | <div style="border:1px solid black; margin-top:50px; width:100px; height:100px;"> |
michael@0 | 20 | <div id="ref-d" style="background:lime; height:250px; width:150px;"> |
michael@0 | 21 | <div style="position:relative; top:-50px; width:150px; height:100%; background:yellow;"/> |
michael@0 | 22 | </div> |
michael@0 | 23 | </div> |
michael@0 | 24 | </div> |
michael@0 | 25 | </div> |
michael@0 | 26 | <vbox flex="1"/> |
michael@0 | 27 | |
michael@0 | 28 | <script type="application/javascript"> |
michael@0 | 29 | <![CDATA[ |
michael@0 | 30 | var imports = [ "SimpleTest", "is", "isnot", "ok", "onerror" ]; |
michael@0 | 31 | for each (var name in imports) { |
michael@0 | 32 | window[name] = window.opener.wrappedJSObject[name]; |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 36 | |
michael@0 | 37 | var Ci = Components.interfaces; |
michael@0 | 38 | var frame = document.getElementById("f"); |
michael@0 | 39 | var fl = frame.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader; |
michael@0 | 40 | is(fl.clipSubdocument, true, "clipSubdocument should default to true"); |
michael@0 | 41 | fl.clipSubdocument = false; |
michael@0 | 42 | is(fl.clipSubdocument, false, "clipSubdocument should have been set to false"); |
michael@0 | 43 | |
michael@0 | 44 | function runTests() { |
michael@0 | 45 | var ref = document.getElementById("ref"); |
michael@0 | 46 | frame.contentWindow.scrollTo(0,0); |
michael@0 | 47 | |
michael@0 | 48 | ref.style.visibility = "hidden"; |
michael@0 | 49 | var testCanvas = snapshotWindow(window); |
michael@0 | 50 | ref.style.visibility = ""; |
michael@0 | 51 | var refCanvas = snapshotWindow(window); |
michael@0 | 52 | var comparison = compareSnapshots(testCanvas, refCanvas, true); |
michael@0 | 53 | ok(comparison[0], "Basic overflow drawing; got " + comparison[1] + ", expected " + comparison[2]); |
michael@0 | 54 | |
michael@0 | 55 | document.getElementById("container").style.height = "200px"; |
michael@0 | 56 | ref.style.visibility = "hidden"; |
michael@0 | 57 | testCanvas = snapshotWindow(window); |
michael@0 | 58 | ref.style.visibility = ""; |
michael@0 | 59 | refCanvas = snapshotWindow(window); |
michael@0 | 60 | comparison = compareSnapshots(testCanvas, refCanvas, true); |
michael@0 | 61 | ok(comparison[0], "Drawing with vertical scrollbar to show overflow area computation; got " + |
michael@0 | 62 | comparison[1] + ", expected " + comparison[2]); |
michael@0 | 63 | |
michael@0 | 64 | frame.contentDocument.getElementById("d").style.height = "350px"; |
michael@0 | 65 | document.getElementById("ref-d").style.height = "350px"; |
michael@0 | 66 | ref.style.visibility = "hidden"; |
michael@0 | 67 | testCanvas = snapshotWindow(window); |
michael@0 | 68 | ref.style.visibility = ""; |
michael@0 | 69 | refCanvas = snapshotWindow(window); |
michael@0 | 70 | comparison = compareSnapshots(testCanvas, refCanvas, true); |
michael@0 | 71 | ok(comparison[0], "testing dynamic overflow area change affecting scrollbar; got " + |
michael@0 | 72 | comparison[1] + ", expected " + comparison[2]); |
michael@0 | 73 | |
michael@0 | 74 | // Now do invalidation tests |
michael@0 | 75 | ref.style.visibility = "hidden"; |
michael@0 | 76 | document.getElementById("container").style.height = "400px"; |
michael@0 | 77 | waitForAllPaintsFlushed(function() { |
michael@0 | 78 | frame.contentWindow.scrollTo(0,80); |
michael@0 | 79 | waitForAllPaintsFlushed(function(x1, y1, x2, y2) { |
michael@0 | 80 | ok(x1 <= 1 && x2 >= 151 && y1 <= 0 && y2 >= 400, |
michael@0 | 81 | "Entire scrolled region is painted: " + x1 + "," + y1 + "," + x2 + "," + y2); |
michael@0 | 82 | frame.contentDocument.getElementById("p").style.background = "cyan"; |
michael@0 | 83 | waitForAllPaintsFlushed(function(x1, y1, x2, y2) { |
michael@0 | 84 | ok(x1 <= 1 && x2 >= 151 && y1 <= 271 && y2 >= 320, |
michael@0 | 85 | "Entire updated region is painted: " + x1 + "," + y1 + "," + x2 + "," + y2); |
michael@0 | 86 | |
michael@0 | 87 | var tester = window.SimpleTest; |
michael@0 | 88 | window.close(); |
michael@0 | 89 | tester.finish(); |
michael@0 | 90 | }, frame.contentDocument); |
michael@0 | 91 | }); |
michael@0 | 92 | }); |
michael@0 | 93 | } |
michael@0 | 94 | ]]> |
michael@0 | 95 | </script> |
michael@0 | 96 | </window> |