Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
michael@0 | 3 | <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" |
michael@0 | 4 | type="text/css"?> |
michael@0 | 5 | |
michael@0 | 6 | <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 7 | title="XUL tree focus testing"> |
michael@0 | 8 | |
michael@0 | 9 | <script type="application/javascript" |
michael@0 | 10 | src="chrome://mochikit/content/MochiKit/packed.js" /> |
michael@0 | 11 | <script type="application/javascript" |
michael@0 | 12 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> |
michael@0 | 13 | <script type="application/javascript" |
michael@0 | 14 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> |
michael@0 | 15 | |
michael@0 | 16 | <script type="application/javascript" |
michael@0 | 17 | src="../treeview.js" /> |
michael@0 | 18 | |
michael@0 | 19 | <script type="application/javascript" |
michael@0 | 20 | src="../common.js" /> |
michael@0 | 21 | <script type="application/javascript" |
michael@0 | 22 | src="../role.js" /> |
michael@0 | 23 | <script type="application/javascript" |
michael@0 | 24 | src="../states.js" /> |
michael@0 | 25 | <script type="application/javascript" |
michael@0 | 26 | src="../events.js" /> |
michael@0 | 27 | |
michael@0 | 28 | <script type="application/javascript"> |
michael@0 | 29 | <![CDATA[ |
michael@0 | 30 | |
michael@0 | 31 | //////////////////////////////////////////////////////////////////////////// |
michael@0 | 32 | // Invokers |
michael@0 | 33 | |
michael@0 | 34 | function focusTree(aTreeID) |
michael@0 | 35 | { |
michael@0 | 36 | var checker = new focusChecker(getFirstTreeItem, aTreeID); |
michael@0 | 37 | this.__proto__ = new synthFocus(aTreeID, [ checker ]); |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | function moveToNextItem(aTreeID) |
michael@0 | 41 | { |
michael@0 | 42 | var checker = new focusChecker(getSecondTreeItem, aTreeID); |
michael@0 | 43 | this.__proto__ = new synthDownKey(aTreeID, [ checker ]); |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | //////////////////////////////////////////////////////////////////////////// |
michael@0 | 47 | // Helpers |
michael@0 | 48 | |
michael@0 | 49 | function getTreeItemAt(aTreeID, aIdx) |
michael@0 | 50 | { return getAccessible(aTreeID).getChildAt(aIdx + 1); } |
michael@0 | 51 | |
michael@0 | 52 | function getFirstTreeItem(aTreeID) |
michael@0 | 53 | { return getTreeItemAt(aTreeID, 0); } |
michael@0 | 54 | |
michael@0 | 55 | function getSecondTreeItem(aTreeID) |
michael@0 | 56 | { return getTreeItemAt(aTreeID, 1); } |
michael@0 | 57 | |
michael@0 | 58 | //////////////////////////////////////////////////////////////////////////// |
michael@0 | 59 | // Test |
michael@0 | 60 | |
michael@0 | 61 | var gQueue = null; |
michael@0 | 62 | |
michael@0 | 63 | //gA11yEventDumpID = "debug"; // debugging |
michael@0 | 64 | //gA11yEventDumpToConsole = true; // debugging |
michael@0 | 65 | |
michael@0 | 66 | function doTest() |
michael@0 | 67 | { |
michael@0 | 68 | gQueue = new eventQueue(); |
michael@0 | 69 | |
michael@0 | 70 | gQueue.push(new focusTree("tree")); |
michael@0 | 71 | gQueue.push(new moveToNextItem("tree")); |
michael@0 | 72 | gQueue.push(new synthFocus("emptytree")); |
michael@0 | 73 | |
michael@0 | 74 | // no focus event for changed current item for unfocused tree |
michael@0 | 75 | gQueue.push(new changeCurrentItem("tree", 0)); |
michael@0 | 76 | |
michael@0 | 77 | gQueue.invoke(); |
michael@0 | 78 | } |
michael@0 | 79 | |
michael@0 | 80 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 81 | addA11yXULTreeLoadEvent(doTest, "tree", new nsTableTreeView(5)); |
michael@0 | 82 | ]]> |
michael@0 | 83 | </script> |
michael@0 | 84 | |
michael@0 | 85 | <hbox flex="1" style="overflow: auto;"> |
michael@0 | 86 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 87 | <a target="_blank" |
michael@0 | 88 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=386821" |
michael@0 | 89 | title="Need better solution for firing delayed event against xul tree"> |
michael@0 | 90 | Mozilla Bug 386821 |
michael@0 | 91 | </a> |
michael@0 | 92 | <a target="_blank" |
michael@0 | 93 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=406308" |
michael@0 | 94 | title="Don't fire accessible focus events if widget is not actually in focus, confuses screen readers"> |
michael@0 | 95 | Mozilla Bug 406308 |
michael@0 | 96 | </a> |
michael@0 | 97 | <p id="display"></p> |
michael@0 | 98 | <div id="content" style="display: none"> |
michael@0 | 99 | </div> |
michael@0 | 100 | <pre id="test"> |
michael@0 | 101 | </pre> |
michael@0 | 102 | </body> |
michael@0 | 103 | |
michael@0 | 104 | <vbox id="debug"/> |
michael@0 | 105 | <tree id="tree" flex="1"> |
michael@0 | 106 | <treecols> |
michael@0 | 107 | <treecol id="col1" flex="1" primary="true" label="column"/> |
michael@0 | 108 | <treecol id="col2" flex="1" label="column 2"/> |
michael@0 | 109 | </treecols> |
michael@0 | 110 | <treechildren id="treechildren"/> |
michael@0 | 111 | </tree> |
michael@0 | 112 | <tree id="emptytree" flex="1"> |
michael@0 | 113 | <treecols> |
michael@0 | 114 | <treecol id="emptytree_col1" flex="1" primary="true" label="column"/> |
michael@0 | 115 | <treecol id="emptytree_col2" flex="1" label="column 2"/> |
michael@0 | 116 | </treecols> |
michael@0 | 117 | <treechildren id="emptytree_treechildren"/> |
michael@0 | 118 | </tree> |
michael@0 | 119 | </hbox> |
michael@0 | 120 | |
michael@0 | 121 | </window> |
michael@0 | 122 |