|
1 <?xml version="1.0"?> |
|
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
|
3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?> |
|
4 <!-- |
|
5 https://bugzilla.mozilla.org/show_bug.cgi?id=469774 |
|
6 --> |
|
7 <window title="Mozilla Bug 469774" |
|
8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
|
9 |
|
10 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
|
11 <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script> |
|
12 |
|
13 <vbox height="50"/> |
|
14 |
|
15 <menupopup id="popup"> |
|
16 <textbox id="textbox"/> |
|
17 </menupopup> |
|
18 |
|
19 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
20 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469774">Mozilla Bug 469774</a> |
|
21 |
|
22 <p id="display"></p> |
|
23 <div id="content" style="display: none"> |
|
24 </div> |
|
25 </body> |
|
26 |
|
27 <script class="testbody" type="application/javascript;version=1.7"><![CDATA[ |
|
28 |
|
29 /** Test for Bug 469774 **/ |
|
30 |
|
31 // Test whether menu popups are blocked from being painted in their parent window. |
|
32 |
|
33 // Like snapshotWindow, but with DRAWWINDOW_DRAW_CARET |
|
34 function snapShot() { |
|
35 var canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"); |
|
36 canvas.setAttribute("width", 200); |
|
37 canvas.setAttribute("height", 50); |
|
38 var ctx = canvas.getContext("2d"); |
|
39 ctx.drawWindow(window, 0, 0, 200, 50, "transparent", ctx.DRAWWINDOW_DRAW_CARET); |
|
40 return canvas; |
|
41 } |
|
42 |
|
43 function doTest() { |
|
44 window.removeEventListener("focus", doTest, false); |
|
45 |
|
46 var before = snapShot(); |
|
47 |
|
48 var popup = document.getElementById("popup"); |
|
49 popup.openPopup(null, "after_start", 0, 0, false, false); |
|
50 |
|
51 popup.addEventListener("popupshown", function() { |
|
52 var textbox = document.getElementById("textbox"); |
|
53 textbox.focus(); // show caret |
|
54 |
|
55 var after = snapShot(); |
|
56 |
|
57 var equal, str1, str2; |
|
58 [equal, str1, str2] = compareSnapshots(after, before, true); |
|
59 ok(equal, "Showing a popup shouldn't affect drawing in its parent window", |
|
60 "got " + str1 + " but expected " + str2); |
|
61 |
|
62 popup.hidePopup(); |
|
63 SimpleTest.finish(); |
|
64 }, false); |
|
65 } |
|
66 |
|
67 SimpleTest.waitForExplicitFinish(); |
|
68 window.addEventListener("focus", doTest, false); |
|
69 |
|
70 ]]></script> |
|
71 |
|
72 </window> |