summaryrefslogtreecommitdiffstats
path: root/layout/xul/test
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /layout/xul/test
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'layout/xul/test')
-rw-r--r--layout/xul/test/browser.ini8
-rw-r--r--layout/xul/test/browser_bug1163304.js35
-rw-r--r--layout/xul/test/browser_bug685470.js19
-rw-r--r--layout/xul/test/browser_bug703210.js33
-rw-r--r--layout/xul/test/browser_bug706743.js84
-rw-r--r--layout/xul/test/chrome.ini24
-rw-r--r--layout/xul/test/mochitest.ini12
-rw-r--r--layout/xul/test/test_bug1197913.xul68
-rw-r--r--layout/xul/test/test_bug159346.xul135
-rw-r--r--layout/xul/test/test_bug372685.xul49
-rw-r--r--layout/xul/test/test_bug381167.xhtml49
-rw-r--r--layout/xul/test/test_bug386386.html34
-rw-r--r--layout/xul/test/test_bug393970.xul91
-rw-r--r--layout/xul/test/test_bug394800.xhtml39
-rw-r--r--layout/xul/test/test_bug398982-1.xul31
-rw-r--r--layout/xul/test/test_bug398982-2.xul33
-rw-r--r--layout/xul/test/test_bug467442.xul54
-rw-r--r--layout/xul/test/test_bug477754.xul49
-rw-r--r--layout/xul/test/test_bug511075.html121
-rw-r--r--layout/xul/test/test_bug563416.html53
-rw-r--r--layout/xul/test/test_bug703150.xul69
-rw-r--r--layout/xul/test/test_bug987230.xul125
-rw-r--r--layout/xul/test/test_popupReflowPos.xul76
-rw-r--r--layout/xul/test/test_popupSizeTo.xul55
-rw-r--r--layout/xul/test/test_popupZoom.xul57
-rw-r--r--layout/xul/test/test_resizer.xul94
-rw-r--r--layout/xul/test/test_resizer_incontent.xul42
-rw-r--r--layout/xul/test/test_splitter.xul117
-rw-r--r--layout/xul/test/test_stack.xul327
-rw-r--r--layout/xul/test/test_submenuClose.xul91
-rw-r--r--layout/xul/test/test_windowminmaxsize.xul245
-rw-r--r--layout/xul/test/window_resizer.xul113
-rw-r--r--layout/xul/test/window_resizer_element.xul188
33 files changed, 2620 insertions, 0 deletions
diff --git a/layout/xul/test/browser.ini b/layout/xul/test/browser.ini
new file mode 100644
index 000000000..3fa28b153
--- /dev/null
+++ b/layout/xul/test/browser.ini
@@ -0,0 +1,8 @@
+[DEFAULT]
+
+[browser_bug685470.js]
+[browser_bug703210.js]
+[browser_bug706743.js]
+skip-if = (os == 'linux') # Bug 1157576
+[browser_bug1163304.js]
+skip-if = os != 'linux' && os != 'win' // Due to testing menubar behavior with keyboard
diff --git a/layout/xul/test/browser_bug1163304.js b/layout/xul/test/browser_bug1163304.js
new file mode 100644
index 000000000..b8e9409dd
--- /dev/null
+++ b/layout/xul/test/browser_bug1163304.js
@@ -0,0 +1,35 @@
+function test() {
+ waitForExplicitFinish();
+
+ let searchBar = BrowserSearch.searchBar;
+ searchBar.focus();
+
+ let DOMWindowUtils = EventUtils._getDOMWindowUtils();
+ is(DOMWindowUtils.IMEStatus, DOMWindowUtils.IME_STATUS_ENABLED,
+ "IME should be available when searchbar has focus");
+
+ let searchPopup = document.getElementById("PopupSearchAutoComplete");
+ searchPopup.addEventListener("popupshown", function (aEvent) {
+ searchPopup.removeEventListener("popupshown", arguments.callee);
+ setTimeout(function () {
+ is(DOMWindowUtils.IMEStatus, DOMWindowUtils.IME_STATUS_ENABLED,
+ "IME should be available even when the popup of searchbar is open");
+ searchPopup.addEventListener("popuphidden", function (aEvent) {
+ searchPopup.removeEventListener("popuphidden", arguments.callee);
+ setTimeout(function () {
+ is(DOMWindowUtils.IMEStatus, DOMWindowUtils.IME_STATUS_DISABLED,
+ "IME should not be available when menubar is active");
+ // Inactivate the menubar (and restore the focus to the searchbar
+ EventUtils.synthesizeKey("VK_ESCAPE", {});
+ is(DOMWindowUtils.IMEStatus, DOMWindowUtils.IME_STATUS_ENABLED,
+ "IME should be available after focus is back to the searchbar");
+ finish();
+ }, 0);
+ });
+ // Activate the menubar, then, the popup should be closed
+ EventUtils.synthesizeKey("VK_ALT", {});
+ }, 0);
+ });
+ // Open popup of the searchbar
+ EventUtils.synthesizeKey("VK_F4", {});
+}
diff --git a/layout/xul/test/browser_bug685470.js b/layout/xul/test/browser_bug685470.js
new file mode 100644
index 000000000..c86231bc7
--- /dev/null
+++ b/layout/xul/test/browser_bug685470.js
@@ -0,0 +1,19 @@
+add_task(function* () {
+ const html = "<p id=\"p1\" title=\"tooltip is here\">This paragraph has a tooltip.</p>";
+ yield BrowserTestUtils.openNewForegroundTab(gBrowser, "data:text/html," + html);
+
+ yield new Promise(resolve => {
+ SpecialPowers.pushPrefEnv({"set": [["ui.tooltipDelay", 0]]}, resolve);
+ });
+
+ yield BrowserTestUtils.synthesizeMouseAtCenter("#p1", { type: "mousemove" },
+ gBrowser.selectedBrowser);
+ yield BrowserTestUtils.synthesizeMouseAtCenter("#p1", { }, gBrowser.selectedBrowser);
+
+ // Wait until the tooltip timeout triggers that would normally have opened the popup.
+ yield new Promise(resolve => setTimeout(resolve, 0));
+ is(document.getElementById("aHTMLTooltip").state, "closed", "local tooltip is closed");
+ is(document.getElementById("remoteBrowserTooltip").state, "closed", "remote tooltip is closed");
+
+ gBrowser.removeCurrentTab();
+});
diff --git a/layout/xul/test/browser_bug703210.js b/layout/xul/test/browser_bug703210.js
new file mode 100644
index 000000000..cfd626b1c
--- /dev/null
+++ b/layout/xul/test/browser_bug703210.js
@@ -0,0 +1,33 @@
+add_task(function* () {
+ const url = "data:text/html," +
+ "<html onmousemove='event.stopPropagation()'" +
+ " onmouseenter='event.stopPropagation()' onmouseleave='event.stopPropagation()'" +
+ " onmouseover='event.stopPropagation()' onmouseout='event.stopPropagation()'>" +
+ "<p id=\"p1\" title=\"tooltip is here\">This paragraph has a tooltip.</p>" +
+ "<p id=\"p2\">This paragraph doesn't have tooltip.</p></html>";
+
+ let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, url);
+ let browser = gBrowser.selectedBrowser;
+
+ yield new Promise(resolve => {
+ SpecialPowers.pushPrefEnv({"set": [["ui.tooltipDelay", 0]]}, resolve);
+ });
+
+ // Send a mousemove at a known position to start the test.
+ yield BrowserTestUtils.synthesizeMouseAtCenter("#p2", { type: "mousemove" }, browser);
+ let popupShownPromise = BrowserTestUtils.waitForEvent(document, "popupshown", false, event => {
+ is(event.originalTarget.localName, "tooltip", "tooltip is showing");
+ return true;
+ });
+ yield BrowserTestUtils.synthesizeMouseAtCenter("#p1", { type: "mousemove" }, browser);
+ yield popupShownPromise;
+
+ let popupHiddenPromise = BrowserTestUtils.waitForEvent(document, "popuphidden", false, event => {
+ is(event.originalTarget.localName, "tooltip", "tooltip is hidden");
+ return true;
+ });
+ yield BrowserTestUtils.synthesizeMouseAtCenter("#p2", { type: "mousemove" }, browser);
+ yield popupHiddenPromise;
+
+ gBrowser.removeCurrentTab();
+});
diff --git a/layout/xul/test/browser_bug706743.js b/layout/xul/test/browser_bug706743.js
new file mode 100644
index 000000000..b7262e812
--- /dev/null
+++ b/layout/xul/test/browser_bug706743.js
@@ -0,0 +1,84 @@
+add_task(function* () {
+ const url = "data:text/html,<html><head></head><body>" +
+ "<a id=\"target\" href=\"about:blank\" title=\"This is tooltip text\" " +
+ "style=\"display:block;height:20px;margin:10px;\" " +
+ "onclick=\"return false;\">here is an anchor element</a></body></html>";
+
+ let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, url);
+ let browser = gBrowser.selectedBrowser;
+
+ yield new Promise(resolve => {
+ SpecialPowers.pushPrefEnv({"set": [["ui.tooltipDelay", 0]]}, resolve);
+ });
+
+ // Send a mousemove at a known position to start the test.
+ yield BrowserTestUtils.synthesizeMouse("#target", -5, -5, { type: "mousemove" }, browser);
+
+ // show tooltip by mousemove into target.
+ let popupShownPromise = BrowserTestUtils.waitForEvent(document, "popupshown");
+ yield BrowserTestUtils.synthesizeMouse("#target", 5, 15, { type: "mousemove" }, browser);
+ yield popupShownPromise;
+
+ // hide tooltip by mousemove to outside.
+ let popupHiddenPromise = BrowserTestUtils.waitForEvent(document, "popuphidden");
+ yield BrowserTestUtils.synthesizeMouse("#target", -5, 15, { type: "mousemove" }, browser);
+ yield popupHiddenPromise;
+
+ // mousemove into the target and start drag by emulation via nsIDragService.
+ // Note that on some platforms, we cannot actually start the drag by
+ // synthesized events. E.g., Windows waits an actual mousemove event after
+ // dragstart.
+
+ // Emulate a buggy mousemove event. widget might dispatch mousemove event
+ // during drag.
+
+ function tooltipNotExpected()
+ {
+ ok(false, "tooltip is shown during drag");
+ }
+ addEventListener("popupshown", tooltipNotExpected, true);
+
+ let dragService = Components.classes["@mozilla.org/widget/dragservice;1"].
+ getService(Components.interfaces.nsIDragService);
+ dragService.startDragSession();
+ yield BrowserTestUtils.synthesizeMouse("#target", 5, 15, { type: "mousemove" }, browser);
+
+ yield new Promise(resolve => setTimeout(resolve, 100));
+ removeEventListener("popupshown", tooltipNotExpected, true);
+ dragService.endDragSession(true);
+
+ yield BrowserTestUtils.synthesizeMouse("#target", -5, -5, { type: "mousemove" }, browser);
+
+ // If tooltip listener used a flag for managing D&D state, we would need
+ // to test if the tooltip is shown after drag.
+
+ // show tooltip by mousemove into target.
+ popupShownPromise = BrowserTestUtils.waitForEvent(document, "popupshown");
+ yield BrowserTestUtils.synthesizeMouse("#target", 5, 15, { type: "mousemove" }, browser);
+ yield popupShownPromise;
+
+ // hide tooltip by mousemove to outside.
+ popupHiddenPromise = BrowserTestUtils.waitForEvent(document, "popuphidden");
+ yield BrowserTestUtils.synthesizeMouse("#target", -5, 15, { type: "mousemove" }, browser);
+ yield popupHiddenPromise;
+
+ // Show tooltip after mousedown
+ popupShownPromise = BrowserTestUtils.waitForEvent(document, "popupshown");
+ yield BrowserTestUtils.synthesizeMouse("#target", 5, 15, { type: "mousemove" }, browser);
+ yield popupShownPromise;
+
+ popupHiddenPromise = BrowserTestUtils.waitForEvent(document, "popuphidden");
+ yield BrowserTestUtils.synthesizeMouse("#target", 5, 15, { type: "mousedown" }, browser);
+ yield popupHiddenPromise;
+
+ yield BrowserTestUtils.synthesizeMouse("#target", 5, 15, { type: "mouseup" }, browser);
+ yield BrowserTestUtils.synthesizeMouse("#target", -5, 15, { type: "mousemove" }, browser);
+
+ ok(true, "tooltips appear properly");
+
+ gBrowser.removeCurrentTab();
+});
+
+
+
+
diff --git a/layout/xul/test/chrome.ini b/layout/xul/test/chrome.ini
new file mode 100644
index 000000000..2a647b6b7
--- /dev/null
+++ b/layout/xul/test/chrome.ini
@@ -0,0 +1,24 @@
+[DEFAULT]
+skip-if = os == 'android'
+support-files =
+ window_resizer.xul
+ window_resizer_element.xul
+
+[test_bug159346.xul]
+[test_bug372685.xul]
+[test_bug381167.xhtml]
+[test_bug393970.xul]
+[test_bug398982-1.xul]
+[test_bug398982-2.xul]
+[test_bug467442.xul]
+[test_bug477754.xul]
+[test_bug703150.xul]
+[test_bug987230.xul]
+skip-if = os == 'linux' # No native mousedown event on Linux
+[test_popupReflowPos.xul]
+[test_popupSizeTo.xul]
+[test_popupZoom.xul]
+[test_resizer.xul]
+[test_stack.xul]
+[test_submenuClose.xul]
+[test_windowminmaxsize.xul]
diff --git a/layout/xul/test/mochitest.ini b/layout/xul/test/mochitest.ini
new file mode 100644
index 000000000..540abc730
--- /dev/null
+++ b/layout/xul/test/mochitest.ini
@@ -0,0 +1,12 @@
+[DEFAULT]
+
+[test_bug386386.html]
+[test_bug394800.xhtml]
+[test_bug511075.html]
+skip-if = toolkit == 'android' #bug 798806
+[test_bug563416.html]
+[test_bug1197913.xul]
+skip-if = toolkit == 'android'
+[test_resizer_incontent.xul]
+[test_splitter.xul]
+skip-if = toolkit == 'android' # no XUL theme
diff --git a/layout/xul/test/test_bug1197913.xul b/layout/xul/test/test_bug1197913.xul
new file mode 100644
index 000000000..6f922402d
--- /dev/null
+++ b/layout/xul/test/test_bug1197913.xul
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1197913
+-->
+<window title="Mozilla Bug 1197913"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ onload="SimpleTest.waitForFocus(nextTest, window)">
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"/>
+
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1197913"
+ target="_blank">Mozilla Bug 1197913</a>
+ </body>
+
+ <hbox align="center" pack="center">
+ <menulist>
+ <menupopup>
+ <menuitem label="Car" />
+ <menuitem label="Taxi" id="target" />
+ <menuitem label="Bus" />
+ </menupopup>
+ </menulist>
+ </hbox>
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+ SimpleTest.waitForExplicitFinish();
+
+ let menulist = document.getElementsByTagName("menulist")[0];
+ let menuitem = document.getElementById("target");
+
+ function onDOMMenuItemActive(e) {
+ menuitem.removeEventListener("DOMMenuItemActive", onDOMMenuItemActive);
+
+ synthesizeMouse(menuitem, 0, 0, { type: "mousemove" });
+ synthesizeMouse(menuitem, -1, 0, { type: "mousemove" });
+
+ setTimeout(() => {
+ if (navigator.platform.toLowerCase().startsWith("win")) {
+ ok(menuitem.getAttribute("_moz-menuactive"));
+ } else {
+ ok(!menuitem.getAttribute("_moz-menuactive"));
+ }
+
+ SimpleTest.finish();
+ });
+ }
+
+ function onPopupShown(e) {
+ menulist.removeEventListener("popupshown", onPopupShown);
+ menuitem.addEventListener("DOMMenuItemActive", onDOMMenuItemActive);
+ synthesizeMouse(menuitem, 0, 0, { type: "mousemove" });
+ synthesizeMouse(menuitem, 1, 0, { type: "mousemove" });
+ }
+
+ function nextTest(e) {
+ menulist.addEventListener("popupshown", onPopupShown);
+ synthesizeMouseAtCenter(menulist, {});
+ }
+
+ ]]>
+ </script>
+</window>
diff --git a/layout/xul/test/test_bug159346.xul b/layout/xul/test/test_bug159346.xul
new file mode 100644
index 000000000..4ef34fe32
--- /dev/null
+++ b/layout/xul/test/test_bug159346.xul
@@ -0,0 +1,135 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ title="Test for Bug 159346">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=159346
+-->
+
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+
+<scrollbar id="scrollbar" curpos="0" maxpos="500"/>
+
+<script class="testbody" type="application/javascript">
+<![CDATA[
+
+var scrollbar = document.getElementById("scrollbar");
+var downButton =
+ document.getAnonymousElementByAttribute(scrollbar, "sbattr",
+ "scrollbar-down-bottom");
+
+function init()
+{
+ downButton.style.display = "-moz-box";
+ SimpleTest.executeSoon(doTest1);
+}
+
+function getCurrentPos()
+{
+ return Number(scrollbar.getAttribute("curpos"));
+}
+
+function doTest1()
+{
+ var lastPos = 0;
+
+ synthesizeMouseAtCenter(downButton, { type: "mousedown" });
+ ok(getCurrentPos() > lastPos,
+ "scrollbar didn't change curpos by mousedown #1");
+ lastPos = getCurrentPos();
+
+ setTimeout(function () {
+ ok(getCurrentPos() > lastPos,
+ "scrollbar didn't change curpos by auto repeat #1");
+ synthesizeMouseAtCenter(downButton, { type: "mouseup" });
+ lastPos = getCurrentPos();
+
+ setTimeout(function () {
+ is(getCurrentPos(), lastPos,
+ "scrollbar changed curpos after mouseup #1");
+ SimpleTest.executeSoon(doTest2);
+ }, 1000);
+ }, 1000);
+}
+
+function doTest2()
+{
+ SpecialPowers.setIntPref("ui.scrollbarButtonAutoRepeatBehavior", 0);
+
+ scrollbar.setAttribute("curpos", 0);
+ var lastPos = 0;
+
+ synthesizeMouseAtCenter(downButton, { type: "mousedown" });
+ ok(getCurrentPos() > lastPos,
+ "scrollbar didn't change curpos by mousedown #2");
+ lastPos = getCurrentPos();
+
+ synthesizeMouse(downButton, -10, -10, { type: "mousemove" });
+ lastPos = getCurrentPos();
+
+ setTimeout(function () {
+ is(getCurrentPos(), lastPos,
+ "scrollbar changed curpos by auto repeat when cursor is outside of scrollbar button #2");
+ synthesizeMouseAtCenter(downButton, { type: "mousemove" });
+ lastPos = getCurrentPos();
+
+ setTimeout(function () {
+ ok(getCurrentPos() > lastPos,
+ "scrollbar didn't change curpos by mousemove after cursor is back on the scrollbar button #2");
+ synthesizeMouseAtCenter(downButton, { type: "mouseup" });
+ SimpleTest.executeSoon(doTest3);
+ }, 1000);
+ }, 1000);
+}
+
+function doTest3()
+{
+ SpecialPowers.setIntPref("ui.scrollbarButtonAutoRepeatBehavior", 1);
+
+ scrollbar.setAttribute("curpos", 0);
+ var lastPos = 0;
+
+ synthesizeMouseAtCenter(downButton, { type: "mousedown" });
+ ok(getCurrentPos() > lastPos,
+ "scrollbar didn't change curpos by mousedown #3");
+ synthesizeMouse(downButton, -10, -10, { type: "mousemove" });
+ lastPos = getCurrentPos();
+
+ setTimeout(function () {
+ ok(getCurrentPos() > lastPos,
+ "scrollbar didn't change curpos by auto repeat when cursor is outside of scrollbar button #3");
+ synthesizeMouseAtCenter(downButton, { type: "mousemove" });
+ lastPos = getCurrentPos();
+
+ setTimeout(function () {
+ ok(getCurrentPos() > lastPos,
+ "scrollbar didn't change curpos by mousemove after cursor is back on the scrollbar button #3");
+ synthesizeMouseAtCenter(downButton, { type: "mouseup" });
+
+ SpecialPowers.clearUserPref("ui.scrollbarButtonAutoRepeatBehavior");
+ SimpleTest.finish();
+ }, 1000);
+ }, 1000);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+]]>
+</script>
+
+<body id="html_body" xmlns="http://www.w3.org/1999/xhtml">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=159346">Mozilla Bug 159346</a>
+<p id="display"></p>
+
+<pre id="test">
+</pre>
+<script>
+addLoadEvent(init);
+</script>
+</body>
+
+
+</window>
diff --git a/layout/xul/test/test_bug372685.xul b/layout/xul/test/test_bug372685.xul
new file mode 100644
index 000000000..09cc2be20
--- /dev/null
+++ b/layout/xul/test/test_bug372685.xul
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ title="Test for Bug 372685">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=372685
+-->
+
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+<menuitem id="a" style="display: -moz-stack;">
+<box id="b" style="display: -moz-popup; ">
+<box id="c" style="position: fixed;"></box>
+</box>
+</menuitem>
+
+<script class="testbody" type="application/javascript">
+<![CDATA[
+
+function removestyles(i){
+ document.getElementById('a').removeAttribute('style');
+ var x=document.getElementById('html_body').offsetHeight;
+ is(0, 0, "this is a crash test, so always ok if we survive this far");
+ SimpleTest.finish();
+}
+function do_test() {
+ setTimeout(removestyles,200);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+]]>
+</script>
+
+<body id="html_body" xmlns="http://www.w3.org/1999/xhtml">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=372685">Mozilla Bug 372685</a>
+<p id="display"></p>
+
+<pre id="test">
+</pre>
+<script>
+addLoadEvent(do_test);
+</script>
+</body>
+
+
+</window>
diff --git a/layout/xul/test/test_bug381167.xhtml b/layout/xul/test/test_bug381167.xhtml
new file mode 100644
index 000000000..3f98d7a4d
--- /dev/null
+++ b/layout/xul/test/test_bug381167.xhtml
@@ -0,0 +1,49 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=381167
+-->
+<head>
+ <title>Test for Bug 381167</title>
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=381167">Mozilla Bug 381167</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<xul:tree>
+ <xul:tree>
+ <xul:treechildren/>
+ <xul:treecol/>
+ </xul:tree>
+</xul:tree>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 381167 **/
+
+SimpleTest.waitForExplicitFinish();
+
+function closeit() {
+ var evt = document.createEvent('KeyboardEvent');
+ evt.initKeyEvent('keypress', true, true,
+ window,
+ true, false, false, false,
+ 'W'.charCodeAt(0), 0);
+ window.dispatchEvent(evt);
+
+ setTimeout(finish, 200);
+}
+window.addEventListener('load', closeit, false);
+
+function finish()
+{
+ ok(true, "This is a mochikit version of a crash test. To complete is to pass.");
+ SimpleTest.finish();
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/layout/xul/test/test_bug386386.html b/layout/xul/test/test_bug386386.html
new file mode 100644
index 000000000..b39ccede2
--- /dev/null
+++ b/layout/xul/test/test_bug386386.html
@@ -0,0 +1,34 @@
+<html>
+<head><title>Testcase for bug 386386</title>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=386386
+-->
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+</head>
+<body>
+
+<iframe id="test386386" src="data:application/vnd.mozilla.xul+xml;charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%3F%3E%0A%3Cwindow%3E%3C/window%3E"></iframe>
+
+<script class="testbody" type="application/javascript">
+
+function boom()
+{
+ var XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+ var doc = document.getElementById("test386386").contentDocument;
+ var observes = doc.createElementNS(XUL_NS, 'observes');
+ doc.removeChild(doc.documentElement);
+ doc.appendChild(observes);
+ is(0, 0, "Test is successful if we get here without crashing");
+ SimpleTest.finish();
+}
+
+function do_test() {
+ setTimeout(boom, 200);
+}
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
+addLoadEvent(do_test);
+</script>
+
+</body>
+</html>
diff --git a/layout/xul/test/test_bug393970.xul b/layout/xul/test/test_bug393970.xul
new file mode 100644
index 000000000..fcb0f9e43
--- /dev/null
+++ b/layout/xul/test/test_bug393970.xul
@@ -0,0 +1,91 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<?xml-stylesheet href="data:text/css,description {min-width: 1px; padding: 2px;}" type="text/css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=393970
+-->
+<window title="Mozilla Bug 393970"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=393970"
+ target="_blank">Mozilla Bug 393970</a>
+ </body>
+
+ <hbox flex="1" pack="start" style="visibility: hidden;">
+ <grid min-width="1000" width="1000">
+ <columns>
+ <column flex="1"/>
+ <column flex="2"/>
+ <column flex="3"/>
+ </columns>
+ <rows id="rows1">
+ <row>
+ <description id="cell11">test1</description>
+ <description id="cell12">test2</description>
+ <description id="cell13">test3</description>
+ </row>
+ <rows id="rows2" flex="1">
+ <row>
+ <description id="cell21">test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1</description>
+ <description id="cell22">test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2</description>
+ <description id="cell23">test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3</description>
+ </row>
+ <rows id="rows3">
+ <row>
+ <description id="cell31">test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1 test1</description>
+ <description id="cell32">test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2 test2</description>
+ <description id="cell33">test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3 test3</description>
+ </row>
+ </rows>
+ </rows>
+ </rows>
+ </grid>
+ </hbox>
+
+ <!-- test code goes here -->
+ <script type="application/javascript"><![CDATA[
+ /** Test for Bug 393970 **/
+
+ if (navigator.platform.startsWith("Linux")) {
+ SimpleTest.expectAssertions(0, 24);
+ }
+
+ var tests = [
+ 'overflow-x: hidden; overflow-y: hidden;',
+ 'overflow-x: scroll; overflow-y: hidden;',
+ 'overflow-x: hidden; overflow-y: scroll;',
+ 'overflow-x: scroll; overflow-y: scroll;',
+ ];
+ var currentTest = -1;
+
+ function runNextTest() {
+ currentTest++;
+ if (currentTest >= tests.length) {
+ SimpleTest.finish();
+ return;
+ }
+
+ $("rows2").setAttribute("style", tests[currentTest]);
+ setTimeout(checkPositions, 0, tests[currentTest]);
+ }
+
+ function checkPositions(variant) {
+ for (var col = 1; col <= 3; col++) {
+ is($('cell1' + col).boxObject.x, $('cell2' + col).boxObject.x, "Cells (1," + col + ") and (2," + col + ") line up horizontally (with " + variant + ")");
+ is($('cell2' + col).boxObject.x, $('cell3' + col).boxObject.x, "Cells (2," + col + ") and (3," + col + ") line up horizontally (with " + variant + ")");
+ }
+ for (var row = 1; row <= 3; row++) {
+ is($('cell' + row + '1').boxObject.y, $('cell' + row + '2').boxObject.y, "Cells (" + row + ",1) and (" + row + ",2) line up vertically (with " + variant + ")");
+ is($('cell' + row + '2').boxObject.y, $('cell' + row + '3').boxObject.y, "Cells (" + row + ",2) and (" + row + ",3) line up vertically (with " + variant + ")");
+ }
+ runNextTest();
+ }
+
+ addLoadEvent(runNextTest);
+ SimpleTest.waitForExplicitFinish()
+ ]]></script>
+</window>
diff --git a/layout/xul/test/test_bug394800.xhtml b/layout/xul/test/test_bug394800.xhtml
new file mode 100644
index 000000000..d2e2250e0
--- /dev/null
+++ b/layout/xul/test/test_bug394800.xhtml
@@ -0,0 +1,39 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+<head>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=394800
+-->
+ <title>Test Mozilla bug 394800</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+
+<script class="testbody" type="application/javascript">
+
+function do_test()
+{
+ var x = document.getElementById("x");
+ x.parentNode.removeChild(x);
+ is(0, 0, "this is a crash/assertion test, so we're ok if we survived this far");
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+</script>
+</head>
+
+<body>
+
+<xul:menulist><xul:tooltip/><div><span><xul:hbox id="x"/></span></div></xul:menulist>
+
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=394800">Mozilla Bug 394800</a>
+<p id="display"></p>
+
+<pre id="test">
+</pre>
+
+<script>
+ addLoadEvent(do_test);
+</script>
+
+</body>
+</html>
diff --git a/layout/xul/test/test_bug398982-1.xul b/layout/xul/test/test_bug398982-1.xul
new file mode 100644
index 000000000..39716ddf4
--- /dev/null
+++ b/layout/xul/test/test_bug398982-1.xul
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<menuitem xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ style="position: absolute; ">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=398982
+-->
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+<tooltip type="zzz">
+<treecols/>
+</tooltip>
+
+<script xmlns="http://www.w3.org/1999/xhtml" class="testbody" type="application/javascript">
+<![CDATA[
+function doe() {
+ document.getElementsByTagName('menuitem')[0].removeAttribute('style');
+ is(0, 0, "Test is successful if we get here without crashing");
+ SimpleTest.finish();
+}
+function do_test() {
+ setTimeout(doe, 200);
+}
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(do_test);
+]]>
+</script>
+<html:body></html:body> <!-- XXX SimpleTest.showReport() requires a html:body -->
+</menuitem>
diff --git a/layout/xul/test/test_bug398982-2.xul b/layout/xul/test/test_bug398982-2.xul
new file mode 100644
index 000000000..253695c39
--- /dev/null
+++ b/layout/xul/test/test_bug398982-2.xul
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ title="Test for Bug 398982">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=398982
+-->
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+<popupgroup style="position: absolute; ">
+<tooltip type="zzz">
+<treecols/>
+</tooltip>
+
+<script xmlns="http://www.w3.org/1999/xhtml" class="testbody" type="application/javascript">
+<![CDATA[
+function doe() {
+ document.getElementsByTagName('popupgroup')[0].removeAttribute('style');
+ is(0, 0, "Test is successful if we get here without crashing");
+ SimpleTest.finish();
+}
+function do_test() {
+ setTimeout(doe, 200);
+}
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(do_test);
+]]>
+</script>
+</popupgroup>
+<html:body></html:body> <!-- XXX SimpleTest.showReport() requires a html:body -->
+</window>
diff --git a/layout/xul/test/test_bug467442.xul b/layout/xul/test/test_bug467442.xul
new file mode 100644
index 000000000..809e90cb8
--- /dev/null
+++ b/layout/xul/test/test_bug467442.xul
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=467442
+-->
+<window title="Mozilla Bug 467442"
+ onload="onload()"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <!-- test code goes here -->
+ <popupset>
+ <panel id="panel">
+ Hello.
+ </panel>
+ </popupset>
+ <hbox>
+ <button id="anchor" label="Anchor hello on here" style="transform: translate(100px, 0)"/>
+ </hbox>
+ <script type="application/javascript">
+ <![CDATA[
+
+ SimpleTest.waitForExplicitFinish();
+
+ function onload() {
+ /** Test for Bug 467442 **/
+ let panel = document.getElementById("panel");
+ let anchor = document.getElementById("anchor");
+
+ panel.addEventListener("popupshown", function onpopupshown() {
+ panel.removeEventListener("popupshown", onpopupshown);
+ let panelRect = panel.getBoundingClientRect();
+ let anchorRect = anchor.getBoundingClientRect();
+ is(panelRect.left, anchorRect.left, "Panel should be anchored to the button");
+ panel.addEventListener("popuphidden", function onpopuphidden() {
+ panel.removeEventListener("popuphidden", onpopuphidden);
+ SimpleTest.finish();
+ });
+ panel.hidePopup();
+ });
+
+ panel.openPopup(anchor, "after_start", 0, 0, false, false);
+ }
+
+ ]]>
+ </script>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=467442"
+ target="_blank">Mozilla Bug 467442</a>
+ </body>
+</window>
diff --git a/layout/xul/test/test_bug477754.xul b/layout/xul/test/test_bug477754.xul
new file mode 100644
index 000000000..f72b1fffa
--- /dev/null
+++ b/layout/xul/test/test_bug477754.xul
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=477754
+-->
+<window title="Mozilla Bug 477754"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=477754"
+ target="_blank">Mozilla Bug 477754</a>
+ </body>
+
+ <hbox pack="center">
+ <label id="anchor" style="direction: rtl;" value="Anchor"/>
+ </hbox>
+ <panel id="testPopup" onpopupshown="doTest();">
+ <label value="I am a popup"/>
+ </panel>
+
+ <!-- test code goes here -->
+ <script type="application/javascript"><![CDATA[
+ /** Test for Bug 477754 **/
+ SimpleTest.waitForExplicitFinish();
+
+ let testPopup, testAnchor;
+
+ addEventListener("load", function () {
+ removeEventListener("load", arguments.callee, false);
+
+ testPopup = document.getElementById("testPopup");
+ testAnchor = document.getElementById("anchor");
+
+ testPopup.openPopup(testAnchor, "after_start", 10, 0, false, false);
+ }, false);
+
+ function doTest() {
+ is(Math.round(testAnchor.getBoundingClientRect().right -
+ testPopup.getBoundingClientRect().right), 10,
+ "RTL popup's right offset should be equal to the x offset passed to openPopup");
+ testPopup.hidePopup();
+ SimpleTest.finish();
+ }
+
+ ]]></script>
+</window>
diff --git a/layout/xul/test/test_bug511075.html b/layout/xul/test/test_bug511075.html
new file mode 100644
index 000000000..ecb228884
--- /dev/null
+++ b/layout/xul/test/test_bug511075.html
@@ -0,0 +1,121 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=511075
+-->
+<head>
+ <title>Test for Bug 511075</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <style>
+ #scroller {
+ border: 1px solid black;
+ }
+ </style>
+</head>
+<body onload="runTests()">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=511075">Mozilla Bug 511075</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 511075 **/
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
+
+var tests = [
+ function() {
+ ok(true, "Setting location.hash should scroll.");
+ nextTest();
+ // Click the top scroll arrow.
+ var x = scroller.getBoundingClientRect().width - 5;
+ var y = 5;
+ // On MacOSX the top scroll arrow can be below the slider just above
+ // the bottom scroll arrow.
+ if (navigator.platform.indexOf("Mac") >= 0)
+ y = scroller.getBoundingClientRect().height - 40;
+ synthesizeMouse(scroller, x, y, { type : "mousedown" }, window);
+ synthesizeMouse(scroller, x, y, { type: "mouseup" }, window);
+ },
+ function() {
+ ok(true, "Clicking the top scroll arrow should scroll.");
+ nextTest();
+ // Click the bottom scroll arrow.
+ var x = scroller.getBoundingClientRect().width - 5;
+ var y = scroller.getBoundingClientRect().height - 25;
+ synthesizeMouse(scroller, x, y, { type : "mousedown" }, window);
+ synthesizeMouse(scroller, x, y, { type: "mouseup" }, window);
+ },
+ function() {
+ ok(true, "Clicking the bottom scroll arrow should scroll.");
+ nextTest();
+ // Click the scrollbar.
+ var x = scroller.getBoundingClientRect().width - 5;
+ synthesizeMouse(scroller, x, 40, { type : "mousedown" }, window);
+ synthesizeMouse(scroller, x, 40, { type: "mouseup" }, window);
+ },
+ function() {
+ ok(true, "Clicking the scrollbar should scroll");
+ nextTest();
+ // Click the scrollbar.
+ var x = scroller.getBoundingClientRect().width - 5;
+ var y = scroller.getBoundingClientRect().height - 50;
+ synthesizeMouse(scroller, x, y, { type : "mousedown" }, window);
+ synthesizeMouse(scroller, x, y, { type: "mouseup" }, window);
+ },
+ function() {
+ scroller.onscroll = null;
+ ok(true, "Clicking the scrollbar should scroll");
+ finish();
+ }
+];
+
+document.onmousedown = function () { return false; };
+document.onmouseup = function () { return true; };
+
+
+var scroller;
+var timer = 0;
+
+function failure() {
+ ok(false, scroller.onscroll + " did not run!");
+ scroller.onscroll = null;
+ finish();
+}
+
+function nextTest() {
+ clearTimeout(timer);
+ scroller.onscroll = tests.shift();
+ timer = setTimeout(failure, 2000);
+}
+
+function runTests() {
+ scroller = document.getElementById("scroller");
+ nextTest();
+ window.location.hash = "initialPosition";
+}
+
+function finish() {
+ document.onmousedown = null;
+ document.onmouseup = null;
+ clearTimeout(timer);
+ window.location.hash = "topPosition";
+ SimpleTest.finish();
+}
+
+
+</script>
+</pre>
+<div id="scroller" style="overflow: scroll; width: 100px; height: 150px;">
+<a id="topPosition" name="topPosition">top</a>
+<div style="width: 20000px; height: 20000px;"></div>
+<a id="initialPosition" name="initialPosition">initialPosition</a>
+<div style="width: 20000px; height: 20000px;"></div>
+</div>
+</body>
+</html>
diff --git a/layout/xul/test/test_bug563416.html b/layout/xul/test/test_bug563416.html
new file mode 100644
index 000000000..dd245de0b
--- /dev/null
+++ b/layout/xul/test/test_bug563416.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=563416
+-->
+<head>
+ <title>Test for Bug 563416</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=563416">Mozilla Bug 563416</a>
+<p id="display"><iframe id="test" src='data:text/html,<textarea style="box-sizing:content-box; -moz-appearance:none; height: 0px; padding: 0px;" cols="20" rows="10">hsldkjvmshlkkajskdlfksdjflskdjflskdjflskdjflskdjfddddddddd</textarea>'></iframe></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 563416 **/
+
+var result = -1;
+var expected = -2;
+var i = 0;
+
+function runTest() {
+ i = 0;
+ var frame = document.getElementById('test');
+ frame.onload = function() {
+ var t = frame.contentDocument.documentElement.getElementsByTagName("textarea")[0];
+ expected = t.clientWidth + 10;
+ t.style.width = expected + 'px';
+ result = t.clientWidth;
+ if (i == 0) {
+ i++;
+ setTimeout(function(){frame.contentWindow.location.reload();},0);
+ }
+ else {
+ is(result, expected, "setting style.width changes clientWidth");
+ SimpleTest.finish();
+ }
+ }
+ frame.contentWindow.location.reload();
+}
+
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(runTest);
+
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/layout/xul/test/test_bug703150.xul b/layout/xul/test/test_bug703150.xul
new file mode 100644
index 000000000..fab7d1677
--- /dev/null
+++ b/layout/xul/test/test_bug703150.xul
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ title="Test for Bug 703150">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=703150
+-->
+
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+
+<scrollbar id="scrollbar" curpos="0" maxpos="500"/>
+
+<script class="testbody" type="application/javascript">
+<![CDATA[
+
+var scrollbar = document.getElementById("scrollbar");
+var scrollbarThumb =
+ document.getAnonymousElementByAttribute(scrollbar, "sbattr",
+ "scrollbar-thumb");
+
+function doTest()
+{
+ function mousedownHandler(aEvent)
+ {
+ aEvent.stopPropagation();
+ }
+ window.addEventListener("mousedown", mousedownHandler, true);
+
+ // Wait for finishing reflow...
+ SimpleTest.executeSoon(function () {
+ synthesizeMouseAtCenter(scrollbarThumb, { type: "mousedown" });
+
+ is(scrollbar.getAttribute("curpos"), "0",
+ "scrollbar thumb has been moved already");
+
+ synthesizeMouseAtCenter(scrollbar, { type: "mousemove" });
+
+ ok(scrollbar.getAttribute("curpos") > 0,
+ "scrollbar thumb hasn't been dragged");
+
+ synthesizeMouseAtCenter(scrollbarThumb, { type: "mouseup" });
+
+ window.removeEventListener("mousedown", mousedownHandler, true);
+
+ SimpleTest.finish();
+ });
+}
+
+SimpleTest.waitForExplicitFinish();
+
+]]>
+</script>
+
+<body id="html_body" xmlns="http://www.w3.org/1999/xhtml">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=703150">Mozilla Bug 703150</a>
+<p id="display"></p>
+
+<pre id="test">
+</pre>
+<script>
+addLoadEvent(doTest);
+</script>
+</body>
+
+
+</window>
diff --git a/layout/xul/test/test_bug987230.xul b/layout/xul/test/test_bug987230.xul
new file mode 100644
index 000000000..b2b47f470
--- /dev/null
+++ b/layout/xul/test/test_bug987230.xul
@@ -0,0 +1,125 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=987230
+-->
+<window title="Mozilla Bug 987230"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ onload="SimpleTest.waitForFocus(nextTest, window)">
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=987230"
+ target="_blank">Mozilla Bug 987230</a>
+ </body>
+
+ <vbox>
+ <toolbar>
+ <toolbarbutton id="toolbarbutton-anchor"
+ label="Anchor"
+ consumeanchor="toolbarbutton-anchor"
+ onclick="onAnchorClick(event)"
+ style="padding: 50px !important; list-style-image: url(chrome://branding/content/icon32.png)"/>
+ </toolbar>
+ <spacer flex="1"/>
+ <hbox id="hbox-anchor"
+ style="padding: 20px"
+ onclick="onAnchorClick(event)">
+ <hbox id="inner-anchor"
+ consumeanchor="hbox-anchor"
+ >
+ Another anchor
+ </hbox>
+ </hbox>
+ <spacer flex="1"/>
+ </vbox>
+
+ <panel id="mypopup"
+ type="arrow"
+ onpopupshown="onMyPopupShown(event)"
+ onpopuphidden="onMyPopupHidden(event)">This is a test popup</panel>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+ /** Test for Bug 987230 **/
+ SimpleTest.waitForExplicitFinish();
+
+ SimpleTest.requestCompleteLog();
+
+ const Ci = Components.interfaces;
+ const Cc = Components.classes;
+
+ let platform = navigator.platform.toLowerCase();
+ let isWindows = platform.startsWith("win");
+ let mouseDown = isWindows ? 2 : 1;
+ let mouseUp = isWindows ? 4 : 2;
+ let mouseMove = isWindows ? 1 : 5;
+ let utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils);
+ let scale = utils.screenPixelsPerCSSPixel;
+
+
+ function synthesizeNativeMouseClick(aElement, aOffsetX, aOffsetY) {
+ let rect = aElement.getBoundingClientRect();
+ let win = aElement.ownerDocument.defaultView;
+ let x = aOffsetX + win.mozInnerScreenX + rect.left;
+ let y = aOffsetY + win.mozInnerScreenY + rect.top;
+
+ info("Sending mousedown+up for offsets: " + aOffsetX + ", " + aOffsetY +
+ "; innerscreen: " + win.mozInnerScreenX + ", " + win.mozInnerScreenY +
+ "; rect: " + rect.left + ", " + rect.top + ".");
+ info("Resulting x, y, scale: " + x + ", " + y + ", " + scale);
+ info("Final params: " + (x * scale) + ", " + (y * scale));
+ utils.sendNativeMouseEvent(x * scale, y * scale, mouseDown, 0, null);
+ utils.sendNativeMouseEvent(x * scale, y * scale, mouseUp, 0, null);
+ }
+
+ function onMyPopupHidden(e) {
+ ok(true, "Popup hidden");
+ if (outerAnchor.id == "toolbarbutton-anchor") {
+ popupHasShown = false;
+ outerAnchor = document.getElementById("hbox-anchor");
+ anchor = document.getElementById("inner-anchor");
+ nextTest();
+ } else {
+ //XXXgijs set mouse position back outside the iframe:
+ let frameRect = window.frameElement.getBoundingClientRect();
+ let outsideOfFrameX = (window.mozInnerScreenX + frameRect.width + 100) * scale;
+ let outsideOfFrameY = Math.max(0, window.mozInnerScreenY - 100) * scale;
+
+ info("Mousemove: " + outsideOfFrameX + ", " + outsideOfFrameY +
+ " (from innerscreen " + window.mozInnerScreenX + ", " + window.mozInnerScreenY +
+ " and rect width " + frameRect.width + " and scale " + scale + ")");
+ utils.sendNativeMouseEvent(outsideOfFrameX, outsideOfFrameY, mouseMove, 0, null);
+ SimpleTest.finish();
+ }
+ }
+
+ let popupHasShown = false;
+ function onMyPopupShown(e) {
+ popupHasShown = true;
+ synthesizeNativeMouseClick(outerAnchor, 5, 5);
+ }
+
+ function onAnchorClick(e) {
+ info("click: " + e.target.id);
+ ok(!popupHasShown, "Popup should only be shown once");
+ popup.openPopup(anchor, "bottomcenter topright");
+ }
+
+ let popup = document.getElementById("mypopup");
+ let outerAnchor = document.getElementById("toolbarbutton-anchor");
+ let anchor = document.getAnonymousElementByAttribute(outerAnchor, "class", "toolbarbutton-icon");
+
+ function nextTest(e) {
+ synthesizeMouse(outerAnchor, 5, 5, {});
+ }
+
+ ]]>
+ </script>
+</window>
diff --git a/layout/xul/test/test_popupReflowPos.xul b/layout/xul/test/test_popupReflowPos.xul
new file mode 100644
index 000000000..deeeff62e
--- /dev/null
+++ b/layout/xul/test/test_popupReflowPos.xul
@@ -0,0 +1,76 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<window title="XUL Panel reflow placement test"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript"><![CDATA[
+ SimpleTest.waitForExplicitFinish();
+
+ function openPopup()
+ {
+ synthesizeMouseAtCenter(document.getElementById("thebutton"), {}, window);
+ }
+
+ function popupShown(event)
+ {
+ document.getElementById("parent").className = "";
+
+ var buttonbcr = document.getElementById("thebutton").getBoundingClientRect();
+ var popupbcr = document.getElementById("thepopup").getOuterScreenRect();
+
+ ok(Math.abs(popupbcr.x - window.mozInnerScreenX - buttonbcr.x) < 3, "x pos is correct");
+ ok(Math.abs(popupbcr.y - window.mozInnerScreenY - buttonbcr.bottom) < 3, "y pos is correct");
+
+ event.target.hidePopup();
+ }
+
+ SimpleTest.waitForFocus(openPopup);
+ ]]></script>
+
+ <html:style>
+ .mbox {
+ display: inline-block;
+ width: 33%;
+ height: 50px;
+ background: green;
+ vertical-align: middle;
+ }
+ .orange {
+ background: orange;
+ }
+ .change > .mbox {
+ width: 60px;
+ }
+ </html:style>
+
+ <html:div style="width: 300px; height: 200px;">
+ <html:div id="parent" class="change" style="background: red; border: 1px solid black; width: 300px; height: 200px;">
+ <html:div class="mbox"></html:div>
+ <html:div class="mbox"></html:div>
+ <html:div class="mbox"></html:div>
+ <html:div class="mbox orange">
+
+ <button label="Show" type="menu" id="thebutton">
+ <menupopup id="thepopup" onpopupshown="popupShown(event)" onpopuphidden="SimpleTest.finish()">
+ <menuitem label="New"/>
+ <menuitem label="Open"/>
+ <menuitem label="Save"/>
+ <menuseparator/>
+ <menuitem label="Exit"/>
+ </menupopup>
+ </button>
+
+ </html:div>
+ </html:div>
+ </html:div>
+
+</window>
diff --git a/layout/xul/test/test_popupSizeTo.xul b/layout/xul/test/test_popupSizeTo.xul
new file mode 100644
index 000000000..a135e1980
--- /dev/null
+++ b/layout/xul/test/test_popupSizeTo.xul
@@ -0,0 +1,55 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<!--
+XUL Panel sizeTo tests
+-->
+<window title="XUL Panel sizeTo tests"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript"><![CDATA[
+ SimpleTest.waitForExplicitFinish();
+
+ function openPopup()
+ {
+ document.getElementById("panel").
+ openPopupAtScreen(Math.round(window.mozInnerScreenX) + window.innerWidth - 130,
+ Math.round(window.mozInnerScreenY) + window.innerHeight - 130);
+ }
+
+ function sizeAndCheck(width, height) {
+ var panel = document.getElementById("panel");
+ panel.sizeTo(width, height);
+ is(panel.getBoundingClientRect().width, width, "width is correct");
+ is(panel.getBoundingClientRect().height, height, "height is correct");
+
+ }
+ function popupShown(event)
+ {
+ var panel = document.getElementById("panel");
+ var bcr = panel.getBoundingClientRect();
+ // resize to 10px bigger in both dimensions.
+ sizeAndCheck(bcr.width+10, bcr.height+10);
+ // Same width, different height (based on *new* size from last sizeAndCheck)
+ sizeAndCheck(bcr.width+10, bcr.height);
+ // Same height, different width (also based on *new* size from last sizeAndCheck)
+ sizeAndCheck(bcr.width, bcr.height);
+ event.target.hidePopup();
+ }
+
+ SimpleTest.waitForFocus(openPopup);
+ ]]></script>
+
+<panel id="panel" onpopupshown="popupShown(event)" onpopuphidden="SimpleTest.finish()">
+ <resizer id="resizer" dir="bottomend" width="16" height="16"/>
+ <hbox width="50" height="50" flex="1"/>
+</panel>
+
+</window>
diff --git a/layout/xul/test/test_popupZoom.xul b/layout/xul/test/test_popupZoom.xul
new file mode 100644
index 000000000..b8e15ba1d
--- /dev/null
+++ b/layout/xul/test/test_popupZoom.xul
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<window title="XUL Panel zoom test"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript"><![CDATA[
+ SimpleTest.waitForExplicitFinish();
+
+ var docviewer;
+ var savedzoom;
+
+ function openPopup()
+ {
+ docviewer = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+ .getInterface(Components.interfaces.nsIWebNavigation)
+ .QueryInterface(Components.interfaces.nsIDocShell)
+ .contentViewer;
+ savedzoom = docviewer.fullZoom;
+ docviewer.fullZoom = 2;
+
+ document.getElementById("panel").
+ openPopup(document.getElementById("anchor"), "after_start", 0, 0, false, false, null);
+ }
+
+ function popupShown(event)
+ {
+ var panel = document.getElementById("panel");
+ var panelbcr = panel.getBoundingClientRect();
+ var anchorbcr = document.getElementById("anchor").getBoundingClientRect();
+
+ ok(Math.abs(panelbcr.x - anchorbcr.x) < 3, "x pos is correct");
+ ok(Math.abs(panelbcr.y - anchorbcr.bottom) < 3, "y pos is correct");
+
+ docviewer.fullZoom = savedzoom;
+
+ event.target.hidePopup();
+ }
+
+ SimpleTest.waitForFocus(openPopup);
+ ]]></script>
+
+<description id="anchor" value="Sometext to this some texts"/>
+<panel id="panel" onpopupshown="popupShown(event)" onpopuphidden="SimpleTest.finish()">
+ <resizer id="resizer" dir="bottomend" width="16" height="16"/>
+ <hbox width="50" height="50" flex="1"/>
+</panel>
+
+
+</window>
diff --git a/layout/xul/test/test_resizer.xul b/layout/xul/test/test_resizer.xul
new file mode 100644
index 000000000..2ba971d05
--- /dev/null
+++ b/layout/xul/test/test_resizer.xul
@@ -0,0 +1,94 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<!--
+XUL <resizer> tests
+-->
+<window title="XUL resizer tests"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript"><![CDATA[
+ SimpleTest.waitForExplicitFinish();
+ SimpleTest.ignoreAllUncaughtExceptions();
+
+ function openPopup()
+ {
+ document.getElementById("panel").
+ openPopupAtScreen(Math.round(window.mozInnerScreenX) + window.innerWidth - 130,
+ Math.round(window.mozInnerScreenY) + window.innerHeight - 130);
+ }
+
+ var step = 0;
+ function popupShown(event)
+ {
+ if (step == 0) {
+ // check to make sure that the popup cannot be resized past the edges of
+ // the content area
+ var resizerrect = document.getElementById("resizer").getBoundingClientRect();
+ synthesizeMouse(document.documentElement, resizerrect.left + 5, resizerrect.top + 5, { type:"mousedown" });
+ synthesizeMouse(document.documentElement, resizerrect.left + 2000, resizerrect.top + 2000, { type:"mousemove" });
+
+ // allow a one pixel variance as rounding is always done to the inside
+ // of a rectangle.
+ var popuprect = document.getElementById("panel").getBoundingClientRect();
+ ok(Math.round(popuprect.right) == window.innerWidth ||
+ Math.round(popuprect.right) == window.innerWidth - 1,
+ "resized to content edge width");
+ ok(Math.round(popuprect.bottom) == window.innerHeight ||
+ Math.round(popuprect.bottom) == window.innerHeight - 1,
+ "resized to content edge height");
+
+ resizerrect = document.getElementById("resizer").getBoundingClientRect();
+ synthesizeMouse(document.documentElement, resizerrect.left + 5, resizerrect.top + 5, { type:"mouseup" });
+ }
+ else {
+ // the popup is opened twice. Make sure that for the second time, the
+ // resized popup opens in the same direction as there should still be
+ // room for it
+ var popuprect = document.getElementById("panel").getBoundingClientRect();
+ is(Math.round(popuprect.left), window.innerWidth - 130, "reopen popup left");
+ is(Math.round(popuprect.top), window.innerHeight - 130, "reopen popup top");
+ }
+
+ event.target.hidePopup();
+ }
+
+ function doResizerWindowTests() {
+ step++;
+ if (step == 1) {
+ openPopup();
+ return;
+ }
+
+ if (/Mac/.test(navigator.platform)) {
+ window.open("window_resizer.xul", "_blank", "left=200,top=200,outerWidth=300,outerHeight=300,chrome");
+ }
+ else {
+ // Skip window_resizer.xul tests.
+ todo(false, "We can't test GTK and Windows native drag resizing implementations.");
+ // Run window_resizer_element.xul test only.
+ lastResizerTest();
+ }
+ }
+
+ function lastResizerTest()
+ {
+ window.open("window_resizer_element.xul", "_blank", "left=200,top=200,outerWidth=300,outerHeight=300,chrome");
+ }
+
+ SimpleTest.waitForFocus(openPopup);
+ ]]></script>
+
+<panel id="panel" onpopupshown="popupShown(event)" onpopuphidden="doResizerWindowTests()">
+ <resizer id="resizer" dir="bottomend" width="16" height="16"/>
+ <hbox width="50" height="50" flex="1"/>
+</panel>
+
+</window>
diff --git a/layout/xul/test/test_resizer_incontent.xul b/layout/xul/test/test_resizer_incontent.xul
new file mode 100644
index 000000000..068bd5bb1
--- /dev/null
+++ b/layout/xul/test/test_resizer_incontent.xul
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
+<!--
+This test ensures that a resizer in content doesn't resize the window.
+-->
+<window title="XUL resizer in content test"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript"><![CDATA[
+ SimpleTest.waitForExplicitFinish();
+
+ function testResizer()
+ {
+ var oldScreenX = window.screenX;
+ var oldScreenY = window.screenY;
+ var oldWidth = window.outerWidth;
+ var oldHeight = window.outerHeight;
+ var resizer = document.getElementById("resizer");
+ synthesizeMouseAtCenter(resizer, { type:"mousedown" });
+ synthesizeMouse(resizer, 32, 32, { type:"mousemove" });
+ synthesizeMouse(resizer, 32, 32, { type:"mouseup" });
+ is(window.screenX, oldScreenX, "window not moved for non-chrome window screenX");
+ is(window.screenY, oldScreenY, "window not moved for non-chrome window screenY");
+ is(window.outerWidth, oldWidth, "window not moved for non-chrome window outerWidth");
+ is(window.outerHeight, oldHeight, "window not moved for non-chrome window outerHeight");
+ SimpleTest.finish();
+ }
+
+ SimpleTest.waitForFocus(testResizer);
+ ]]></script>
+
+ <resizer id="resizer" dir="bottomend" width="16" height="16"/>
+
+</window>
diff --git a/layout/xul/test/test_splitter.xul b/layout/xul/test/test_splitter.xul
new file mode 100644
index 000000000..697ad4be8
--- /dev/null
+++ b/layout/xul/test/test_splitter.xul
@@ -0,0 +1,117 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
+<?xml-stylesheet href="data:text/css, hbox { border: 1px solid red; } vbox { border: 1px solid green }" type="text/css"?>
+<!--
+XUL <splitter> collapsing tests
+-->
+<window title="XUL splitter collapsing tests"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ orient="horizontal">
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript"><![CDATA[
+ SimpleTest.waitForExplicitFinish();
+
+ function dragSplitter(offsetX, callback) {
+ var splitterWidth = splitter.boxObject.width;
+ synthesizeMouse(splitter, splitterWidth / 2, 2, {type: "mousedown"});
+ synthesizeMouse(splitter, splitterWidth / 2, 1, {type: "mousemove"});
+ SimpleTest.executeSoon(function() {
+ SimpleTest.is(splitter.getAttribute("state"), "dragging", "The splitter should be dragged");
+ synthesizeMouse(splitter, offsetX, 1, {type: "mousemove"});
+ synthesizeMouse(splitter, offsetX, 1, {type: "mouseup"});
+ SimpleTest.executeSoon(callback);
+ });
+ }
+
+ function shouldBeCollapsed(where) {
+ SimpleTest.is(splitter.getAttribute("state"), "collapsed", "The splitter should be collapsed");
+ SimpleTest.is(splitter.getAttribute("substate"), where, "The splitter should be collapsed " + where);
+ }
+
+ function shouldNotBeCollapsed() {
+ SimpleTest.is(splitter.getAttribute("state"), "", "The splitter should not be collapsed");
+ }
+
+ function runPass(rightCollapsed, leftCollapsed, callback) {
+ var containerWidth = container.boxObject.width;
+ var isRTL = getComputedStyle(splitter, null).direction == "rtl";
+ dragSplitter(containerWidth, function() {
+ if (rightCollapsed) {
+ shouldBeCollapsed(isRTL ? "before" : "after");
+ } else {
+ shouldNotBeCollapsed();
+ }
+ dragSplitter(-containerWidth * 2, function() {
+ if (leftCollapsed) {
+ shouldBeCollapsed(isRTL ? "after" : "before");
+ } else {
+ shouldNotBeCollapsed();
+ }
+ dragSplitter(containerWidth / 2, function() {
+ // the splitter should never be collapsed in the middle
+ shouldNotBeCollapsed();
+ callback();
+ });
+ });
+ });
+ }
+
+ var splitter, container;
+ function runLTRTests(callback) {
+ splitter = document.getElementById("ltr-splitter");
+ container = splitter.parentNode;
+ splitter.setAttribute("collapse", "before");
+ runPass(false, true, function() {
+ splitter.setAttribute("collapse", "after");
+ runPass(true, false, function() {
+ splitter.setAttribute("collapse", "both");
+ runPass(true, true, callback);
+ });
+ });
+ }
+
+ function runRTLTests(callback) {
+ splitter = document.getElementById("rtl-splitter");
+ container = splitter.parentNode;
+ splitter.setAttribute("collapse", "before");
+ runPass(true, false, function() {
+ splitter.setAttribute("collapse", "after");
+ runPass(false, true, function() {
+ splitter.setAttribute("collapse", "both");
+ runPass(true, true, callback);
+ });
+ });
+ }
+
+ function runTests() {
+ runLTRTests(function() {
+ runRTLTests(function() {
+ SimpleTest.finish();
+ });
+ });
+ }
+
+ addLoadEvent(function() {SimpleTest.executeSoon(runTests);});
+ ]]></script>
+
+ <hbox style="max-width: 200px; height: 300px; direction: ltr;">
+ <vbox style="width: 100px; height: 300px;" flex="1"/>
+ <splitter id="ltr-splitter"/>
+ <vbox style="width: 100px; height: 300px;" flex="1"/>
+ </hbox>
+
+ <hbox style="max-width: 200px; height: 300px; direction: rtl;">
+ <vbox style="width: 100px; height: 300px;" flex="1"/>
+ <splitter id="rtl-splitter"/>
+ <vbox style="width: 100px; height: 300px;" flex="1"/>
+ </hbox>
+
+</window>
diff --git a/layout/xul/test/test_stack.xul b/layout/xul/test/test_stack.xul
new file mode 100644
index 000000000..781a6f298
--- /dev/null
+++ b/layout/xul/test/test_stack.xul
@@ -0,0 +1,327 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+
+<window align="start" title="XUL stack tests" onload="runTest()"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <!-- a * before an expected value means an offset from the right or bottom edge -->
+ <stack id="stack">
+ <hbox id="left-top" left="10" top="12" width="20" height="24"
+ expectedleft="10" expectedtop="12" expectedright="30" expectedbottom="36"
+ stackwidth="30" stackheight="36"/>
+ <hbox id="start-top" start="10" top="12" width="20" height="24"
+ expectedleft="10" expectedtop="12" expectedright="30" expectedbottom="36"
+ stackwidth="30" stackheight="36"/>
+ <hbox id="right-bottom" right="10" bottom="12" width="20" height="24"
+ expectedleft="*30" expectedtop="*36" expectedright="*10" expectedbottom="*12"
+ stackwidth="30" stackheight="36"/>
+ <hbox id="end-bottom" end="10" bottom="12" width="20" height="24"
+ expectedleft="*30" expectedtop="*36" expectedright="*10" expectedbottom="*12"
+ stackwidth="30" stackheight="36"/>
+ <hbox id="left-bottom" left="18" bottom="15" width="16" height="19"
+ expectedleft="18" expectedtop="*34" expectedright="34" expectedbottom="*15"
+ stackwidth="34" stackheight="34"/>
+ <hbox id="start-bottom" start="18" bottom="15" width="16" height="19"
+ expectedleft="18" expectedtop="*34" expectedright="34" expectedbottom="*15"
+ stackwidth="34" stackheight="34"/>
+ <hbox id="right-top" right="5" top="8" width="10" height="11"
+ expectedleft="*15" expectedtop="8" expectedright="*5" expectedbottom="19"
+ stackwidth="15" stackheight="19"/>
+ <hbox id="end-top" end="5" top="8" width="10" height="11"
+ expectedleft="*15" expectedtop="8" expectedright="*5" expectedbottom="19"
+ stackwidth="15" stackheight="19"/>
+ <hbox id="left-right" left="12" right="9" width="15" height="6"
+ expectedleft="12" expectedtop="0" expectedright="*9" expectedbottom="*0"
+ stackwidth="36" stackheight="6"/>
+ <hbox id="start-right" start="12" right="9" width="15" height="6"
+ expectedleft="12" expectedtop="0" expectedright="*9" expectedbottom="*0"
+ stackwidth="36" stackheight="6"/>
+ <hbox id="left-end" start="12" end="9" width="15" height="6"
+ expectedleft="12" expectedtop="0" expectedright="*9" expectedbottom="*0"
+ stackwidth="36" stackheight="6"/>
+ <hbox id="start-end" start="12" end="9" width="15" height="6"
+ expectedleft="12" expectedtop="0" expectedright="*9" expectedbottom="*0"
+ stackwidth="36" stackheight="6"/>
+ <hbox id="top-bottom" top="20" bottom="39" width="15" height="6"
+ expectedleft="0" expectedtop="20" expectedright="*0" expectedbottom="*39"
+ stackwidth="15" stackheight="65"/>
+ <hbox id="left-right-top-bottom" style="left: 5px; top: 5px; right: 8px; bottom: 8px;"
+ left="16" top="20" right="20" bottom="35" width="7" height="8"
+ expectedleft="16" expectedtop="20" expectedright="*20" expectedbottom="*35"
+ stackwidth="43" stackheight="63"/>
+ <hbox id="start-right-top-bottom" style="left: 5px; top: 5px; right: 8px; bottom: 8px;"
+ start="16" top="20" right="20" bottom="35" width="7" height="8"
+ expectedleft="16" expectedtop="20" expectedright="*20" expectedbottom="*35"
+ stackwidth="43" stackheight="63"/>
+ <hbox id="left-end-top-bottom" style="left: 5px; top: 5px; right: 8px; bottom: 8px;"
+ left="16" top="20" end="20" bottom="35" width="7" height="8"
+ expectedleft="16" expectedtop="20" expectedright="*20" expectedbottom="*35"
+ stackwidth="43" stackheight="63"/>
+ <hbox id="start-end-top-bottom" style="left: 5px; top: 5px; right: 8px; bottom: 8px;"
+ start="16" top="20" end="20" bottom="35" width="7" height="8"
+ expectedleft="16" expectedtop="20" expectedright="*20" expectedbottom="*35"
+ stackwidth="43" stackheight="63"/>
+ <hbox id="left-right-top-bottom-nosize" left="16" top="20" right="20" bottom="35"
+ expectedleft="16" expectedtop="20" expectedright="*20" expectedbottom="*35"
+ stackwidth="36" stackheight="55"/>
+ <hbox id="start-right-top-bottom-nosize" start="16" top="20" right="20" bottom="35"
+ expectedleft="16" expectedtop="20" expectedright="*20" expectedbottom="*35"
+ stackwidth="36" stackheight="55"/>
+ <hbox id="left-end-top-bottom-nosize" left="16" top="20" end="20" bottom="35"
+ expectedleft="16" expectedtop="20" expectedright="*20" expectedbottom="*35"
+ stackwidth="36" stackheight="55"/>
+ <hbox id="start-end-top-bottom-nosize" start="16" top="20" end="20" bottom="35"
+ expectedleft="16" expectedtop="20" expectedright="*20" expectedbottom="*35"
+ stackwidth="36" stackheight="55"/>
+ <hbox id="none" width="10" height="12" expectedleft="0" expectedtop="0" expectedright="*0" expectedbottom="*0"
+ stackwidth="10" stackheight="12"/>
+ <hbox id="none-nosize" expectedleft="0" expectedtop="0" expectedright="*0" expectedbottom="*0"
+ stackwidth="0" stackheight="0"/>
+ <hbox id="style-left-right-top-bottom"
+ style="left: 17px; top: 20px;" right="20" bottom="35" width="7" height="8"
+ expectedleft="*27" expectedtop="*43" expectedright="*20" expectedbottom="*35"
+ stackwidth="27" stackheight="43"/>
+ <hbox id="style-left-right-top-bottom-nosize"
+ style="left: 16px; top: 20px; right: 20px; bottom: 35px;"
+ expectedleft="0" expectedtop="0" expectedright="*0" expectedbottom="*0"
+ stackwidth="0" stackheight="0"/>
+ <hbox id="left-large-right" left="20" right="1000" height="6"
+ expectedleft="20" expectedtop="0" expectedright="20" expectedbottom="*0"
+ stackwidth="1020" stackheight="6"/>
+ <hbox id="left-top-with-margin" left="8" top="17" width="20" height="24"
+ style="margin: 1px 2px 3px 4px;"
+ expectedleft="12" expectedtop="18" expectedright="32" expectedbottom="42"
+ stackwidth="34" stackheight="45"/>
+ <hbox id="right-bottom-with-margin" right="6" bottom="15" width="10" height="14"
+ style="margin: 1px 2px 3px 4px;"
+ expectedleft="*18" expectedtop="*32" expectedright="*8" expectedbottom="*18"
+ stackwidth="22" stackheight="33"/>
+ <hbox id="left-top-right-bottom-with-margin" left="14" right="6" top="8" bottom="15" width="10" height="14"
+ style="margin: 1px 2px 3px 4px;"
+ expectedleft="18" expectedtop="9" expectedright="*8" expectedbottom="*18"
+ stackwidth="36" stackheight="41"/>
+ <hbox id="none-with-margin"
+ style="margin: 1px 2px 3px 4px;"
+ expectedleft="4" expectedtop="1" expectedright="*2" expectedbottom="*3"
+ stackwidth="6" stackheight="4"/>
+ </stack>
+
+ <stack id="stack-with-size" width="12" height="14">
+ <hbox id="left-top-with-stack-size" left="10" top="12" width="20" height="24"
+ expectedleft="10" expectedtop="12" expectedright="30" expectedbottom="36"/>
+ </stack>
+
+ <stack id="stack-with-start-end" width="30">
+ <hbox id="start-with-start-end" start="10" top="12" width="20" height="24"
+ expectedstart="10" expectedend="30"/>
+ <hbox id="end-width-start-end" end="5" top="12" width="20" height="24"
+ expectedstart="5" expectedend="25"/>
+ <hbox id="start-end-width-start-end" start="12" end="9" width="20" top="12" height="24"
+ expectedstart="12" expectedend="21"/>
+ </stack>
+
+ <stack id="stack-with-border"
+ style="border-left: 4px solid black; border-top: 2px solid black; border-right: 1px solid black; border-bottom: 3px solid black;">
+ <hbox id="left-top-with-border" left="10" top="14" width="20" height="24"
+ expectedleft="14" expectedtop="16" expectedright="34" expectedbottom="40"/>
+ <hbox id="start-top-with-border" start="10" top="14" width="20" height="24"
+ expectedleft="14" expectedtop="16" expectedright="34" expectedbottom="40"/>
+ <hbox id="right-bottom-with-border" right="5" bottom="8" width="6" height="10"
+ expectedleft="*12" expectedtop="*21" expectedright="*6" expectedbottom="*11"/>
+ <hbox id="end-bottom-with-border" end="5" bottom="8" width="6" height="10"
+ expectedleft="*12" expectedtop="*21" expectedright="*6" expectedbottom="*11"/>
+ <hbox id="left-top-right-bottom-with-border" left="12" right="5" top="18" bottom="8"
+ expectedleft="16" expectedtop="20" expectedright="*6" expectedbottom="*11"/>
+ <hbox id="start-top-right-bottom-with-border" start="12" right="5" top="18" bottom="8"
+ expectedleft="16" expectedtop="20" expectedright="*6" expectedbottom="*11"/>
+ <hbox id="left-top-end-bottom-with-border" left="12" end="5" top="18" bottom="8"
+ expectedleft="16" expectedtop="20" expectedright="*6" expectedbottom="*11"/>
+ <hbox id="start-top-end-bottom-with-border" start="12" end="5" top="18" bottom="8"
+ expectedleft="16" expectedtop="20" expectedright="*6" expectedbottom="*11"/>
+ <hbox id="none-with-with-border"
+ expectedleft="4" expectedtop="2" expectedright="*1" expectedbottom="*3"/>
+ </stack>
+
+ <stack id="stack-dyn"/>
+ <stack id="stack-dyn-sized" width="12" height="14"/>
+
+ <body xmlns="http://www.w3.org/1999/xhtml"/>
+
+ <script><![CDATA[
+ SimpleTest.waitForExplicitFinish();
+
+ var stackRect;
+ var dynStack;
+
+ function compareSide(child, actual, side, dyn, direction)
+ {
+ var clientRect = child.getBoundingClientRect();
+ var vertical = (side == "top" || side == "bottom");
+ var expectedval = child.getAttribute("expected" + side);
+ if (expectedval.indexOf("*") == 0)
+ expectedval = (vertical ? stackRect.bottom : stackRect.right) - Number(expectedval.substring(1));
+ else if (direction == "rtl")
+ expectedval = (vertical ? stackRect.top : -stackRect.width + clientRect.right + clientRect.left) + Number(expectedval);
+ else
+ expectedval = (vertical ? stackRect.top : stackRect.left) + Number(expectedval);
+
+ is(+actual, expectedval, child.id + " " + side + (dyn ? " dynamic" : ""));
+ }
+
+ function runTest()
+ {
+ runTestForStack("stack", false);
+ runTestForStack("stack-with-size", false);
+ runTestForStartEndAttributes("stack-with-start-end", "ltr");
+ runTestForStartEndAttributes("stack-with-start-end", "rtl");
+
+ var stackWithSize = $("stack-with-size");
+
+ var sizedStackRect = stackWithSize.getBoundingClientRect();
+ is(sizedStackRect.width, 30, "stack size stretched width");
+ is(sizedStackRect.height, 36, "stack size stretched height");
+
+ // set -moz-stack-sizing: ignore and ensure that the stack does not grow
+ // to include the child
+ var item = $("left-top-with-stack-size");
+ item.style.MozStackSizing = "ignore";
+ var parent = item.parentNode;
+ parent.removeChild(item);
+ parent.appendChild(item);
+
+ sizedStackRect = stackWithSize.getBoundingClientRect();
+ is(sizedStackRect.width, 12, "stack size not stretched width");
+ is(sizedStackRect.height, 14, "stack size not stretched height");
+
+ testPositionChanges(stackWithSize, true);
+ item.style.MozStackSizing = "";
+ testPositionChanges(stackWithSize, false);
+
+ // now test adding stack children dynamically to ensure that
+ // the size of the stack adjusts accordingly
+ dynStack = $("stack-dyn");
+ runTestForStack("stack", true);
+
+ SimpleTest.finish();
+ }
+
+ function runTestForStartEndAttributes(stackid, aDirection)
+ {
+ // Change the direction of the layout to RTL to ensure start/end are
+ // working as expected
+ var stack = $(stackid);
+ stack.style.direction = aDirection;
+
+ var stackRect = stack.getBoundingClientRect();
+ var children = stack.childNodes;
+ for (var c = children.length - 1; c >= 0; c--) {
+ var child = children[c];
+
+ // do tests only for elements that have a rtl-enabled mode
+ if (!child.hasAttribute("start") && !child.hasAttribute("end"))
+ continue;
+
+ var childrect = child.getBoundingClientRect();
+ compareSide(child, childrect.right, "end", false, aDirection);
+ compareSide(child, childrect.left, "start", false, aDirection);
+ }
+
+ // Reset the direction
+ stack.style.direction = "ltr";
+ }
+
+ function runTestForStack(stackid, dyn)
+ {
+ var stack = $(stackid);
+ if (!dyn)
+ stackRect = stack.getBoundingClientRect();
+ var children = stack.childNodes;
+ for (var c = children.length - 1; c >= 0; c--) {
+ var child = children[c];
+ if (dyn) {
+ // for dynamic tests, get the size after appending the child as the
+ // stack size will be effected by it
+ dynStack.appendChild(child);
+ stackRect = dynStack.getBoundingClientRect();
+ is(String(stackRect.width), child.getAttribute("stackwidth"), child.id + " stack width" + (dyn ? " dynamic" : ""));
+ is(String(stackRect.height), child.getAttribute("stackheight"), child.id + " stack height" + (dyn ? " dynamic" : ""));
+ }
+
+ var childrect = child.getBoundingClientRect();
+ compareSide(child, childrect.left, "left", dyn);
+ compareSide(child, childrect.top, "top", dyn);
+ compareSide(child, childrect.right, "right", dyn);
+ compareSide(child, childrect.bottom, "bottom", dyn);
+ if (dyn)
+ dynStack.removeChild(child);
+ }
+ }
+
+ function testPositionChanges(stack, ignoreStackSizing)
+ {
+ var add = ignoreStackSizing ? " ignore stack sizing" : "";
+
+ // ensure that changing left/top/right/bottom/start/end works
+ var stackchild = document.getElementById("left-top-with-stack-size");
+ stackchild.left = 18;
+ is(stackchild.getBoundingClientRect().left, stack.getBoundingClientRect().left + 18, "left changed" + add);
+ is(stack.getBoundingClientRect().width, ignoreStackSizing ? 12 : 38, "left changed stack width" + add);
+
+ stackchild.left = "";
+ stackchild.setAttribute("start", "19");
+ is(stackchild.getBoundingClientRect().left, stack.getBoundingClientRect().left + 19, "left changed" + add);
+ is(stack.getBoundingClientRect().width, ignoreStackSizing ? 12 : 39, "left changed stack width" + add);
+ stackchild.removeAttribute("start");
+ stackchild.left = 18;
+
+ stackchild.top = 22;
+ is(stackchild.getBoundingClientRect().top, stack.getBoundingClientRect().top + 22, "top changed" + add);
+ is(stack.getBoundingClientRect().height, ignoreStackSizing ? 14 : 46, "left changed stack height" + add);
+
+ stackchild.setAttribute("right", "6");
+ is(stackchild.getBoundingClientRect().right, stack.getBoundingClientRect().left + 18, "right changed" + add);
+ // the width is only 12 pixels in ignoreStackSizing mode, so don't check the offset
+ // from the right edge in this case
+ if (!ignoreStackSizing)
+ is(stackchild.getBoundingClientRect().right, stack.getBoundingClientRect().right - 6,
+ "right changed from right edge" + add);
+ is(stack.getBoundingClientRect().width, ignoreStackSizing ? 12 : 24, "right changed stack width" + add);
+
+ stackchild.removeAttribute("right");
+ stackchild.setAttribute("end", "7");
+ is(stackchild.getBoundingClientRect().right, stack.getBoundingClientRect().left + 18, "right changed" + add);
+ // the width is only 12 pixels in ignoreStackSizing mode, so don't check the offset
+ // from the right edge in this case
+ if (!ignoreStackSizing)
+ is(stackchild.getBoundingClientRect().right, stack.getBoundingClientRect().right - 7,
+ "right changed from right edge" + add);
+ is(stack.getBoundingClientRect().width, ignoreStackSizing ? 12 : 25, "right changed stack width" + add);
+ stackchild.removeAttribute("end");
+ stackchild.setAttribute("right", "6");
+
+ stackchild.setAttribute("bottom", "9");
+ is(stackchild.getBoundingClientRect().bottom, stack.getBoundingClientRect().top + 22, "bottom changed" + add);
+ is(stack.getBoundingClientRect().height, ignoreStackSizing ? 14 : 31, "bottom changed stack height" + add);
+ if (!ignoreStackSizing)
+ is(stackchild.getBoundingClientRect().bottom, stack.getBoundingClientRect().bottom - 9,
+ "right changed from bottom edge" + add);
+
+ stackchild.left = "";
+ is(stackchild.getBoundingClientRect().right, stack.getBoundingClientRect().right - 6, "right changed" + add);
+ is(stack.getBoundingClientRect().width, ignoreStackSizing ? 12 : 26, "right changed no left stack width" + add);
+
+ stackchild.removeAttribute("right");
+ is(stackchild.getBoundingClientRect().right, stack.getBoundingClientRect().right, "right cleared" + add);
+ is(stack.getBoundingClientRect().width, 12, "right cleared stack height" + add);
+
+ // reset the values
+ stackchild.removeAttribute("bottom");
+ stackchild.left = 10;
+ stackchild.top = 12;
+ }
+
+
+ ]]></script>
+</window>
diff --git a/layout/xul/test/test_submenuClose.xul b/layout/xul/test/test_submenuClose.xul
new file mode 100644
index 000000000..907736d99
--- /dev/null
+++ b/layout/xul/test/test_submenuClose.xul
@@ -0,0 +1,91 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1181560
+-->
+<window title="Mozilla Bug 1181560"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ onload="SimpleTest.waitForFocus(nextTest, window)">
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1181560"
+ target="_blank">Mozilla Bug 1181560</a>
+ </body>
+
+ <vbox>
+ <menubar>
+ <menu id="menu" label="MyMenu">
+ <menupopup>
+ <menuitem label="A"/>
+ <menu id="b" label="B">
+ <menupopup>
+ <menuitem label="B1"/>
+ </menupopup>
+ </menu>
+ <menu id="c" label="C">
+ <menupopup>
+ <menuitem label="C1"/>
+ </menupopup>
+ </menu>
+ </menupopup>
+ </menu>
+ </menubar>
+ </vbox>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+ /** Test for Bug 1181560 **/
+ SimpleTest.waitForExplicitFinish();
+
+ let menuB, menuC, mainMenu, menuBOpen, menuCOpen;
+ let menuBOpenCount = 0;
+
+ function handleBOpens() {
+ menuBOpenCount++;
+ menuBOpen = true;
+ ok(!menuCOpen, "Menu C should not be open when menu B has opened");
+ if (menuBOpenCount >= 2) {
+ SimpleTest.finish();
+ return;
+ }
+ sendKey("LEFT", window);
+ sendKey("DOWN", window);
+ sendKey("RIGHT", window);
+ }
+
+ function handleBCloses() {
+ menuBOpen = false;
+ }
+
+ function handleCOpens() {
+ menuCOpen = true;
+ ok(!menuBOpen, "Menu B should not be open when menu C has opened");
+ synthesizeMouseAtCenter(menuB, {}, window);
+ }
+
+ function handleCCloses() {
+ menuCOpen = false;
+ }
+
+ function nextTest(e) {
+ mainMenu = document.getElementById("menu");
+ menuB = document.getElementById("b");
+ menuC = document.getElementById("c");
+ menuB.firstChild.addEventListener("popupshown", handleBOpens, false);
+ menuB.firstChild.addEventListener("popuphidden", handleBCloses, false);
+ menuC.firstChild.addEventListener("popupshown", handleCOpens, false);
+ menuC.firstChild.addEventListener("popuphidden", handleCCloses, false);
+ mainMenu.addEventListener("popupshown", ev => {
+ synthesizeMouseAtCenter(menuB, {}, window);
+ });
+ mainMenu.open = true;
+ }
+ ]]>
+ </script>
+</window>
diff --git a/layout/xul/test/test_windowminmaxsize.xul b/layout/xul/test/test_windowminmaxsize.xul
new file mode 100644
index 000000000..5909039cf
--- /dev/null
+++ b/layout/xul/test/test_windowminmaxsize.xul
@@ -0,0 +1,245 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+
+<window title="Window Minimum and Maximum Size Tests" onload="nextTest()"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <script type="application/javascript"
+ src="chrome://mochikit/content/MochiKit/packed.js"/>
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+<panel id="panel" onpopupshown="doPanelTest(this)" onpopuphidden="nextPopupTest(this)"
+ align="start" pack="start" style="-moz-appearance: none; margin: 0; border: 0; padding: 0;">
+ <resizer id="popupresizer" dir="bottomright" flex="1" width="60" height="60"
+ style="-moz-appearance: none; margin: 0; border: 0; padding: 0;"/>
+</panel>
+
+<script>
+<![CDATA[
+
+SimpleTest.waitForExplicitFinish();
+
+var gTestId = -1;
+
+var prefix = "data:application/vnd.mozilla.xul+xml,<?xml-stylesheet href='chrome://global/skin' type='text/css'?><window " +
+ "xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' " +
+ "align='start' pack='start' style='-moz-appearance: none; margin: 0; padding: 0; border: 0; ";
+var suffix = "><resizer dir='bottomright' flex='1' width='150' height='150' style='-moz-appearance: none; margin: 0; border: 0; padding: 0;'/></window>";
+var titledpanel = "<panel noautohide='true' titlebar='normal' minwidth='120' minheight='140'/><label value='Test'/>";
+
+// width and height in the tests below specify the expected size of the window.
+// note, win8 has a minimum inner window size of around 122 pixels. Don't go below this on min-width tests.
+var tests = [
+ { testname: "unconstrained",
+ style: "", attrs: "",
+ width: 150, height: 150 },
+ { testname: "constraint min style",
+ style: "min-width: 180px; min-height: 210px;", attrs: "",
+ width: 180, height: 210 },
+ { testname: "constraint max style",
+ style: "max-width: 125px; max-height: 140px;", attrs: "",
+ width: 125, height: 140 },
+ { testname: "constraint min attributes",
+ style: "", attrs: "minwidth='240' minheight='220'",
+ width: 240, height: 220 },
+ { testname: "constraint min attributes with width and height set",
+ style: "", attrs: "width='190' height='220' minwidth='215' minheight='235'",
+ width: 215, height: 235 },
+ { testname: "constraint max attributes",
+ style: "", attrs: "maxwidth='125' maxheight='95'",
+ width: 125, height: 95 },
+ // this gets the inner width as <window minwidth='210'> makes the box 210 pixels wide
+ { testname: "constraint min width attribute only",
+ style: "", attrs: "minwidth='210'",
+ width: 210, height: 150 },
+ { testname: "constraint max width attribute only",
+ style: "", attrs: "maxwidth='128'",
+ width: 128, height: 150 },
+ { testname: "constraint max width attribute with minheight",
+ style: "", attrs: "maxwidth='195' width='230' height='120' minheight='180'",
+ width: 195, height: 180 },
+ { testname: "constraint minwidth, minheight, maxwidth and maxheight set",
+ style: "", attrs: "minwidth='120' maxwidth='480' minheight='110' maxheight='470'",
+ width: 150, height: 150, last: true }
+];
+
+var popupTests = [
+ { testname: "popup unconstrained",
+ width: 60, height: 60
+ },
+ { testname: "popup with minimum size",
+ minwidth: 150, minheight: 180,
+ width: 150, height: 180
+ },
+ { testname: "popup with maximum size",
+ maxwidth: 50, maxheight: 45,
+ width: 50, height: 45,
+ },
+ { testname: "popup with minimum and size",
+ minwidth: 80, minheight: 70, maxwidth: 250, maxheight: 220,
+ width: 80, height: 70, last: true
+ }
+];
+
+function nextTest()
+{
+ // Run through each of the tests above by opening a simple window with
+ // the attributes or style defined for that test. The comparisons will be
+ // done by windowOpened. gTestId holds the index into the tests array.
+ if (++gTestId >= tests.length) {
+ // Now do the popup tests
+ gTestId = -1;
+ SimpleTest.waitForFocus(function () { nextPopupTest(document.getElementById("panel")) } );
+ }
+ else {
+ tests[gTestId].window = window.open(prefix + tests[gTestId].style + "' " + tests[gTestId].attrs + suffix, "_blank", "chrome,resizable=yes");
+ SimpleTest.waitForFocus(windowOpened, tests[gTestId].window);
+ }
+}
+
+function windowOpened(otherWindow)
+{
+ // Check the width and the width plus one due to bug 696746.
+ ok(otherWindow.innerWidth == tests[gTestId].width ||
+ otherWindow.innerWidth == tests[gTestId].width + 1,
+ tests[gTestId].testname + " width of " + otherWindow.innerWidth + " matches " + tests[gTestId].width);
+ is(otherWindow.innerHeight, tests[gTestId].height, tests[gTestId].testname + " height");
+
+ // On the last test, try moving the resizer to a size larger than the maximum
+ // and smaller than the minimum. This test is only done on Mac as the other
+ // platforms use native resizing.
+ if ('last' in tests[gTestId] && (navigator.platform.indexOf("Mac") == 0)) {
+ var resizer = otherWindow.document.documentElement.firstChild;
+ synthesizeMouse(resizer, 4, 4, { type:"mousedown" }, otherWindow);
+ synthesizeMouse(resizer, 800, 800, { type:"mousemove" }, otherWindow);
+ is(otherWindow.innerWidth, 480, "Width after maximum resize");
+ is(otherWindow.innerHeight, 470, "Height after maximum resize");
+
+ synthesizeMouse(resizer, -100, -100, { type:"mousemove" }, otherWindow);
+ is(otherWindow.innerWidth, 120, "Width after minimum resize");
+ is(otherWindow.innerHeight, 110, "Height after minimum resize");
+
+ synthesizeMouse(resizer, 4, 4, { type:"mouseup" }, otherWindow);
+
+ // Change the minimum and maximum size and try resizing the window again.
+ otherWindow.document.documentElement.minWidth = 140;
+ otherWindow.document.documentElement.minHeight = 130;
+ otherWindow.document.documentElement.maxWidth = 380;
+ otherWindow.document.documentElement.maxHeight = 360;
+
+ synthesizeMouse(resizer, 4, 4, { type:"mousedown" }, otherWindow);
+ synthesizeMouse(resizer, 800, 800, { type:"mousemove" }, otherWindow);
+ is(otherWindow.innerWidth, 380, "Width after changed maximum resize");
+ is(otherWindow.innerHeight, 360, "Height after changed maximum resize");
+
+ synthesizeMouse(resizer, -100, -100, { type:"mousemove" }, otherWindow);
+ is(otherWindow.innerWidth, 140, "Width after changed minimum resize");
+ is(otherWindow.innerHeight, 130, "Height after changed minimum resize");
+
+ synthesizeMouse(resizer, 4, 4, { type:"mouseup" }, otherWindow);
+ }
+
+ otherWindow.close();
+ nextTest();
+}
+
+function doPanelTest(panel)
+{
+ var rect = panel.getBoundingClientRect();
+ is(rect.width, popupTests[gTestId].width, popupTests[gTestId].testname + " width");
+ is(rect.height, popupTests[gTestId].height, popupTests[gTestId].testname + " height");
+
+ if ('last' in popupTests[gTestId]) {
+ var resizer = document.getElementById("popupresizer");
+ synthesizeMouse(resizer, 4, 4, { type:"mousedown" });
+ synthesizeMouse(resizer, 800, 800, { type:"mousemove" });
+
+ rect = panel.getBoundingClientRect();
+ is(rect.width, 250, "Popup width after maximum resize");
+ is(rect.height, 220, "Popup height after maximum resize");
+
+ synthesizeMouse(resizer, -100, -100, { type:"mousemove" });
+
+ rect = panel.getBoundingClientRect();
+ is(rect.width, 80, "Popup width after minimum resize");
+ is(rect.height, 70, "Popup height after minimum resize");
+
+ synthesizeMouse(resizer, 4, 4, { type:"mouseup" });
+ }
+
+ panel.hidePopup();
+}
+
+function nextPopupTest(panel)
+{
+ if (++gTestId >= popupTests.length) {
+ // Next, check a panel that has a titlebar to ensure that it is accounted for
+ // properly in the size.
+ var titledPanelWindow = window.open(prefix + "'>" + titledpanel + "</window>", "_blank", "chrome,resizable=yes");
+ SimpleTest.waitForFocus(titledPanelWindowOpened, titledPanelWindow);
+ }
+ else {
+ function setattr(attr) {
+ if (attr in popupTests[gTestId])
+ panel.setAttribute(attr, popupTests[gTestId][attr]);
+ else
+ panel.removeAttribute(attr);
+ }
+ setattr("minwidth");
+ setattr("minheight");
+ setattr("maxwidth");
+ setattr("maxheight");
+
+ // Remove the flexibility as it causes the resizer to not shrink down
+ // when resizing.
+ if ("last" in popupTests[gTestId])
+ document.getElementById("popupresizer").removeAttribute("flex");
+
+ // Prevent event loop starvation as a result of popup events being
+ // synchronous. See bug 1131576.
+ SimpleTest.executeSoon(() => {
+ // Non-chrome shells require focus to open a popup.
+ SimpleTest.waitForFocus(() => { panel.openPopup() });
+ });
+ }
+}
+
+function titledPanelWindowOpened(panelwindow)
+{
+ var panel = panelwindow.document.documentElement.firstChild;
+ panel.openPopup();
+ panel.addEventListener("popupshown", () => doTitledPanelTest(panel), false);
+ panel.addEventListener("popuphidden", () => done(panelwindow), false);
+}
+
+function doTitledPanelTest(panel)
+{
+ var rect = panel.getBoundingClientRect();
+ is(rect.width, 120, "panel with titlebar width");
+ is(rect.height, 140, "panel with titlebar height");
+ panel.hidePopup();
+}
+
+function done(panelwindow)
+{
+ panelwindow.close();
+ SimpleTest.finish();
+}
+
+]]>
+</script>
+
+<body xmlns="http://www.w3.org/1999/xhtml">
+<p id="display">
+</p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+</pre>
+</body>
+
+</window>
diff --git a/layout/xul/test/window_resizer.xul b/layout/xul/test/window_resizer.xul
new file mode 100644
index 000000000..4e349d125
--- /dev/null
+++ b/layout/xul/test/window_resizer.xul
@@ -0,0 +1,113 @@
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ screenX="200" screenY="200" width="300" height="300"
+ onload="setTimeout(doTest, 0)">
+<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+<script><![CDATA[
+var is = window.opener.SimpleTest.is;
+
+function doTest() {
+ // from test_resizer.xul
+ var expectX = 200;
+ var expectY = 200;
+ var expectXMost = 500;
+ var expectYMost = 500;
+ var screenScale = expectX/window.screenX;
+ var root = document.documentElement;
+
+ var oldScreenX = window.screenX;
+ var oldScreenY = window.screenY;
+ var oldWidth = window.outerWidth;
+ var oldHeight = window.outerHeight;
+
+ function testResizer(dx, dy) {
+ var offset = 20;
+ var scale = 5;
+ // target the centre of the resizer
+ var offsetX = window.innerWidth/2 + (window.innerWidth/3)*dx;
+ var offsetY = window.innerHeight/2 + (window.innerHeight/3)*dy;
+
+ for (var mouseX = -1; mouseX <= 1; ++mouseX) {
+ for (var mouseY = -1; mouseY <= 1; ++mouseY) {
+ var newExpectX = expectX;
+ var newExpectXMost = expectXMost;
+ var newExpectY = expectY;
+ var newExpectYMost = expectYMost;
+ if (dx < 0) {
+ newExpectX += mouseX*scale;
+ } else if (dx > 0) {
+ newExpectXMost += mouseX*scale;
+ }
+ if (dy < 0) {
+ newExpectY += mouseY*scale;
+ } else if (dy > 0) {
+ newExpectYMost += mouseY*scale;
+ }
+
+ synthesizeMouse(root, offsetX, offsetY, { type:"mousedown" });
+ synthesizeMouse(root, offsetX + mouseX*scale, offsetY + mouseY*scale, { type:"mousemove" });
+ is(window.screenX*screenScale, newExpectX,
+ "Bad x for " + dx + "," + dy + " moving " + mouseX + "," + mouseY);
+ is(window.screenY*screenScale, newExpectY,
+ "Bad y for " + dx + "," + dy + " moving " + mouseX + "," + mouseY);
+ is(window.outerWidth, newExpectXMost - newExpectX,
+ "Bad width for " + dx + "," + dy + " moving " + mouseX + "," + mouseY);
+ is(window.outerHeight, newExpectYMost - newExpectY,
+ "Bad height for " + dx + "," + dy + " moving " + mouseX + "," + mouseY);
+
+ // move it back before we release! Adjust for any window movement
+ synthesizeMouse(root, offsetX - (newExpectX - expectX),
+ offsetY - (newExpectY - expectY), { type:"mousemove" });
+ synthesizeMouse(root, offsetX, offsetY, { type:"mouseup" });
+ }
+ }
+ }
+
+ testResizer(-1, -1);
+ testResizer(-1, 0);
+ testResizer(-1, 1);
+ testResizer(0, -1);
+ testResizer(0, 1);
+ testResizer(1, -1);
+ testResizer(1, 0);
+ testResizer(1, 1);
+
+ var resizers = document.getElementsByTagName("resizer");
+ Array.forEach(resizers, function (element) {
+ is(getComputedStyle(element, "").cursor,
+ element.getAttribute("expectedcursor"),
+ "cursor for " + element.dir);
+ });
+
+ // now check the cursors in rtl. The bottomend resizer
+ // should be reversed
+ document.getElementById("bottomend").setAttribute("rtl", "true");
+ Array.forEach(resizers, function (element) {
+ is(getComputedStyle(element, "").cursor,
+ element.dir == "bottomend" ? "sw-resize" :
+ element.getAttribute("expectedcursor"),
+ "cursor for " + element.dir);
+ });
+
+ window.close();
+ window.opener.lastResizerTest();
+}
+]]></script>
+ <hbox id="container" flex="1">
+ <vbox flex="1">
+ <resizer dir="topleft" expectedcursor="nw-resize" flex="1"/>
+ <resizer dir="left" expectedcursor="ew-resize" flex="1"/>
+ <resizer dir="bottomleft" expectedcursor="sw-resize" flex="1"/>
+ </vbox>
+ <vbox flex="1">
+ <resizer dir="top" expectedcursor="ns-resize" flex="1"/>
+ <resizer id="bottomend" dir="bottomend" expectedcursor="se-resize" flex="1"/>
+ <resizer dir="bottom" expectedcursor="ns-resize" flex="1"/>
+ </vbox>
+ <vbox flex="1">
+ <resizer dir="topright" expectedcursor="ne-resize" flex="1"/>
+ <resizer dir="right" expectedcursor="ew-resize" flex="1"/>
+ <resizer dir="bottomright" expectedcursor="se-resize" flex="1"/>
+ </vbox>
+ </hbox>
+</window>
diff --git a/layout/xul/test/window_resizer_element.xul b/layout/xul/test/window_resizer_element.xul
new file mode 100644
index 000000000..b0c58d1a1
--- /dev/null
+++ b/layout/xul/test/window_resizer_element.xul
@@ -0,0 +1,188 @@
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ align="start">
+<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+<script><![CDATA[
+var is = window.opener.SimpleTest.is;
+window.onerror = window.opener.onerror;
+
+const anchorPositions =
+ [ "before_start", "before_end", "after_start", "after_end",
+ "start_before", "start_after", "end_before", "end_after", "overlap", "screen"];
+var currentPosition;
+
+function testResizer(resizerid, noShrink, hResize, vResize, testid)
+{
+ var rect = document.getElementById(resizerid + "-container").getBoundingClientRect();
+ var resizer = document.getElementById(resizerid);
+ var resizerrect = resizer.getBoundingClientRect();
+
+ var originalX = resizerrect.left;
+ var originalY = resizerrect.top;
+
+ const scale = 20;
+ for (var mouseX = -1; mouseX <= 1; ++mouseX) {
+ for (var mouseY = -1; mouseY <= 1; ++mouseY) {
+ var expectedWidth = rect.width + hResize * mouseX * scale;
+ var expectedHeight = rect.height + vResize * mouseY * scale;
+
+ if (noShrink) {
+ if (mouseX == -1)
+ expectedWidth = rect.width;
+ if (mouseY == -1)
+ expectedHeight = rect.height;
+ }
+
+ synthesizeMouse(document.documentElement, originalX + 5, originalY + 5, { type:"mousedown" });
+ synthesizeMouse(document.documentElement, originalX + 5 + mouseX * scale,
+ originalY + 5 + mouseY * scale, { type:"mousemove" });
+
+ var newrect = document.getElementById(resizerid + "-container").getBoundingClientRect();
+ is(Math.round(newrect.width), Math.round(expectedWidth), "resize element " + resizerid +
+ " " + testid + " width moving " + mouseX + "," + mouseY + ",,," + hResize);
+ is(Math.round(newrect.height), Math.round(expectedHeight), "resize element " + resizerid +
+ " " + testid + " height moving " + mouseX + "," + mouseY);
+ // release
+ synthesizeMouse(document.documentElement, originalX + 5 + mouseX * scale,
+ originalY + 5 + mouseY * scale, { type:"mouseup" });
+ // return to the original size
+ synthesizeMouse(document.documentElement, originalX + 5 + mouseX * scale,
+ originalY + 5 + mouseY * scale, { type:"dblclick" });
+ var newrect = document.getElementById(resizerid + "-container").getBoundingClientRect();
+ is(Math.round(newrect.width), Math.round(rect.width), "resize element " + resizerid +
+ " " + testid + " doubleclicking to restore original size");
+ is(Math.round(newrect.height), Math.round(rect.height), "resize element " + resizerid +
+ " " + testid + " doubleclicking to restore original size");
+ }
+ }
+}
+
+function doTest() {
+ // first, check if a resizer with a element attribute set to an element that
+ // does not exist does not cause a problem
+ var resizer = document.getElementById("notfound");
+ synthesizeMouse(resizer, 5, 5, { type:"mousedown" });
+ synthesizeMouse(resizer, 10, 10, { type:"mousemove" });
+ synthesizeMouse(resizer, 5, 5, { type:"mouseup" });
+
+ testResizer("outside", true, 1, 1, "");
+ testResizer("html", true, 1, 1, "");
+ testResizer("inside", true, 1, 1, "");
+ testResizer("inside-large", false, 1, 1, "");
+ testResizer("inside-with-border", true, 1, 1, "");
+
+ document.getElementById("inside-popup-container").
+ openPopupAtScreen(Math.ceil(window.mozInnerScreenX) + 100, Math.ceil(window.mozInnerScreenY) + 100);
+}
+
+function popupShown(event)
+{
+ testResizer("inside-popup", false, 1, 1, "");
+ document.getElementById("inside-popup-container").id = "outside-popup-container";
+ testResizer("outside-popup", false, 1, 1, "");
+
+ var resizerrect = document.getElementById("inside-popup").getBoundingClientRect();
+ synthesizeMouse(document.documentElement, resizerrect.left + 5, resizerrect.top + 5, { type:"mousedown" });
+ synthesizeMouse(document.documentElement, resizerrect.left + 2000, resizerrect.top + 2000, { type:"mousemove" });
+
+ var isMac = (navigator.platform.indexOf("Mac") >= 0);
+ var popuprect = document.getElementById("outside-popup-container").getBoundingClientRect();
+ // subtract 3 due to space left for panel dropshadow
+ is(Math.ceil(window.mozInnerScreenX) + popuprect.right,
+ (isMac ? screen.availLeft + screen.availWidth : screen.left + screen.width) - 3, "resized to edge width");
+ is(Math.ceil(window.mozInnerScreenY) + popuprect.bottom,
+ (isMac ? screen.availTop + screen.availHeight : screen.top + screen.height) - 3, "resized to edge height");
+
+ resizerrect = document.getElementById("inside-popup").getBoundingClientRect();
+ synthesizeMouse(document.documentElement, resizerrect.left + 5, resizerrect.top + 5, { type:"mouseup" });
+
+ event.target.hidePopup();
+}
+
+function popupHidden()
+{
+ if (anchorPositions.length == 0) {
+ window.close();
+ window.opener.SimpleTest.finish();
+ return;
+ }
+
+ currentPosition = anchorPositions.shift();
+ var anchor = document.getElementById("anchor");
+ var popup = document.getElementById("anchored-panel-container");
+
+ if (currentPosition == "screen")
+ popup.openPopupAtScreen(window.screenX + 100, window.screenY + 100);
+ else
+ popup.openPopup(anchor, currentPosition);
+}
+
+function anchoredPopupShown(event)
+{
+ var leftAllowed = (currentPosition.indexOf("end_") == -1 && currentPosition.indexOf("_start") == -1);
+ var rightAllowed = (currentPosition.indexOf("start_") == -1 && currentPosition.indexOf("_end") == -1);
+ var topAllowed = (currentPosition.indexOf("after_") == -1 && currentPosition.indexOf("_before") == -1);
+ var bottomAllowed = (currentPosition.indexOf("before_") == -1 && currentPosition.indexOf("_after") == -1);
+
+ if (currentPosition == "overlap") {
+ leftAllowed = topAllowed = false;
+ rightAllowed = bottomAllowed = true;
+ }
+
+ var resizerTypes = [ "topleft", "top", "topright", "left", "right",
+ "bottomleft", "bottom", "bottomright", "bottomend" ];
+ for (var r = 0; r < resizerTypes.length; r++) {
+ var resizerType = resizerTypes[r];
+ var horiz = 0, vert = 0;
+ if (leftAllowed && resizerType.indexOf("left") >= 0) horiz = -1;
+ else if (rightAllowed && (resizerType.indexOf("right") >= 0 || resizerType == "bottomend")) horiz = 1;
+
+ if (topAllowed && resizerType.indexOf("top") >= 0) vert = -1;
+ else if (bottomAllowed && resizerType.indexOf("bottom") >= 0) vert = 1;
+
+ document.getElementById("anchored-panel").dir = resizerType;
+ testResizer("anchored-panel", false, horiz, vert, currentPosition + " " + resizerType);
+ }
+
+ event.target.hidePopup();
+}
+
+window.opener.SimpleTest.waitForFocus(doTest, window);
+]]></script>
+
+<resizer id="outside" dir="bottomend" element="outside-container"/>
+<resizer id="notfound" dir="bottomend" element="nothing"/>
+<hbox id="outside-container">
+ <hbox minwidth="46" minheight="39"/>
+</hbox>
+<html:div id="html-container" xmlns:html="http://www.w3.org/1999/xhtml">
+ <html:button>One</html:button><html:br/>
+ <resizer id="html" dir="bottomend" element="_parent"/>
+</html:div>
+<hbox id="anchor" align="start" style="margin-left: 100px;">
+ <hbox id="inside-container" align="start">
+ <hbox minwidth="45" minheight="41"/>
+ <resizer id="inside" dir="bottomend" element="_parent"/>
+ </hbox>
+ <hbox id="inside-large-container" width="70" height="70" align="start">
+ <resizer id="inside-large" dir="bottomend" element="_parent"/>
+ </hbox>
+ <hbox id="inside-with-border-container" style="border: 5px solid red; padding: 2px; margin: 2px;" align="start">
+ <hbox minwidth="35" minheight="30"/>
+ <resizer id="inside-with-border" dir="bottomend" element="_parent"/>
+ </hbox>
+</hbox>
+
+<panel id="inside-popup-container" align="start" onpopupshown="popupShown(event)" onpopuphidden="popupHidden()">
+ <resizer id="inside-popup" dir="bottomend"/>
+ <hbox width="50" height="50" flex="1"/>
+</panel>
+<resizer id="outside-popup" dir="bottomend" element="outside-popup-container"/>
+
+<panel id="anchored-panel-container" align="start" onpopupshown="anchoredPopupShown(event)"
+ onpopuphidden="popupHidden()">
+ <hbox width="50" height="50" flex="1"/>
+ <resizer id="anchored-panel" width="20" height="20"/>
+</panel>
+
+</window>