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="Accessible XUL tree hierarchy tests"> |
michael@0 | 8 | |
michael@0 | 9 | <script type="application/javascript" |
michael@0 | 10 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> |
michael@0 | 11 | |
michael@0 | 12 | <script type="application/javascript" |
michael@0 | 13 | src="../treeview.js" /> |
michael@0 | 14 | |
michael@0 | 15 | <script type="application/javascript" |
michael@0 | 16 | src="../common.js" /> |
michael@0 | 17 | <script type="application/javascript" |
michael@0 | 18 | src="../role.js" /> |
michael@0 | 19 | <script type="application/javascript" |
michael@0 | 20 | src="../events.js" /> |
michael@0 | 21 | |
michael@0 | 22 | <script type="application/javascript"> |
michael@0 | 23 | <![CDATA[ |
michael@0 | 24 | //////////////////////////////////////////////////////////////////////////// |
michael@0 | 25 | // Accessible tree testers |
michael@0 | 26 | |
michael@0 | 27 | function getTreeItemAccTree(aTableRole, acolumnCount) |
michael@0 | 28 | { |
michael@0 | 29 | var treeItemRole; |
michael@0 | 30 | switch (aTableRole) { |
michael@0 | 31 | case ROLE_LIST: |
michael@0 | 32 | treeItemRole = ROLE_LISTITEM; |
michael@0 | 33 | break; |
michael@0 | 34 | case ROLE_OUTLINE: |
michael@0 | 35 | treeItemRole = ROLE_OUTLINEITEM; |
michael@0 | 36 | break; |
michael@0 | 37 | case ROLE_TABLE: case ROLE_TREE_TABLE: |
michael@0 | 38 | treeItemRole = ROLE_ROW; |
michael@0 | 39 | break; |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | var accTree = { |
michael@0 | 43 | role: treeItemRole, |
michael@0 | 44 | children: [] |
michael@0 | 45 | }; |
michael@0 | 46 | |
michael@0 | 47 | if (aTableRole == ROLE_TABLE || aTableRole == ROLE_TREE_TABLE) { |
michael@0 | 48 | for (var idx = 0; idx < acolumnCount; idx++) { |
michael@0 | 49 | var cellAccTree = { |
michael@0 | 50 | role: ROLE_GRID_CELL, |
michael@0 | 51 | children: [] |
michael@0 | 52 | }; |
michael@0 | 53 | accTree.children.push(cellAccTree); |
michael@0 | 54 | } |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | return accTree; |
michael@0 | 58 | } |
michael@0 | 59 | |
michael@0 | 60 | function testAccessibleTreeFor(aTree, aRole) |
michael@0 | 61 | { |
michael@0 | 62 | var accTreeForColumns = { |
michael@0 | 63 | role: ROLE_LIST, |
michael@0 | 64 | children: [] |
michael@0 | 65 | }; |
michael@0 | 66 | |
michael@0 | 67 | var accTreeForTree = { |
michael@0 | 68 | role: aRole, |
michael@0 | 69 | children: [ |
michael@0 | 70 | accTreeForColumns |
michael@0 | 71 | ] |
michael@0 | 72 | }; |
michael@0 | 73 | |
michael@0 | 74 | var treeBoxObject = aTree.treeBoxObject; |
michael@0 | 75 | var view = treeBoxObject.view; |
michael@0 | 76 | var columnCount = treeBoxObject.columns.count; |
michael@0 | 77 | |
michael@0 | 78 | for (var idx = 0; idx < columnCount; idx++) |
michael@0 | 79 | accTreeForColumns.children.push({ COLUMNHEADER: [ ] }); |
michael@0 | 80 | if (!aTree.hasAttribute("hidecolumnpicker")) |
michael@0 | 81 | accTreeForColumns.children.push({ PUSHBUTTON: [ { MENUPOPUP: [] } ] }); |
michael@0 | 82 | |
michael@0 | 83 | for (var idx = 0; idx < view.rowCount; idx++) |
michael@0 | 84 | accTreeForTree.children.push(getTreeItemAccTree(aRole, columnCount)); |
michael@0 | 85 | |
michael@0 | 86 | testAccessibleTree(aTree, accTreeForTree); |
michael@0 | 87 | } |
michael@0 | 88 | |
michael@0 | 89 | /** |
michael@0 | 90 | * Event queue invoker object to test accessible tree for XUL tree element. |
michael@0 | 91 | */ |
michael@0 | 92 | function treeChecker(aID, aView, aRole) |
michael@0 | 93 | { |
michael@0 | 94 | this.DOMNode = getNode(aID); |
michael@0 | 95 | |
michael@0 | 96 | this.invoke = function invoke() |
michael@0 | 97 | { |
michael@0 | 98 | this.DOMNode.treeBoxObject.view = aView; |
michael@0 | 99 | } |
michael@0 | 100 | this.check = function check(aEvent) |
michael@0 | 101 | { |
michael@0 | 102 | testAccessibleTreeFor(this.DOMNode, aRole); |
michael@0 | 103 | } |
michael@0 | 104 | this.getID = function getID() |
michael@0 | 105 | { |
michael@0 | 106 | return "Tree testing of " + aID; |
michael@0 | 107 | } |
michael@0 | 108 | } |
michael@0 | 109 | |
michael@0 | 110 | //////////////////////////////////////////////////////////////////////////// |
michael@0 | 111 | // Test |
michael@0 | 112 | |
michael@0 | 113 | // gA11yEventDumpID = "debug"; |
michael@0 | 114 | var gQueue = null; |
michael@0 | 115 | |
michael@0 | 116 | function doTest() |
michael@0 | 117 | { |
michael@0 | 118 | var gQueue = new eventQueue(EVENT_REORDER); |
michael@0 | 119 | |
michael@0 | 120 | gQueue.push(new treeChecker("list", new nsTableTreeView(3), ROLE_LIST)); |
michael@0 | 121 | gQueue.push(new treeChecker("tree", new nsTreeTreeView(), ROLE_OUTLINE)); |
michael@0 | 122 | gQueue.push(new treeChecker("table", new nsTableTreeView(3), ROLE_TABLE)); |
michael@0 | 123 | gQueue.push(new treeChecker("treetable", new nsTreeTreeView(), ROLE_TREE_TABLE)); |
michael@0 | 124 | |
michael@0 | 125 | gQueue.invoke(); // Will call SimpleTest.finish() |
michael@0 | 126 | } |
michael@0 | 127 | |
michael@0 | 128 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 129 | addA11yLoadEvent(doTest); |
michael@0 | 130 | ]]> |
michael@0 | 131 | </script> |
michael@0 | 132 | |
michael@0 | 133 | <hbox flex="1" style="overflow: auto;"> |
michael@0 | 134 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 135 | <a target="_blank" |
michael@0 | 136 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=503727" |
michael@0 | 137 | title="Reorganize implementation of XUL tree accessibility"> |
michael@0 | 138 | Mozilla Bug 503727 |
michael@0 | 139 | </a><br/> |
michael@0 | 140 | <p id="display"></p> |
michael@0 | 141 | <div id="content" style="display: none"> |
michael@0 | 142 | </div> |
michael@0 | 143 | <pre id="test"> |
michael@0 | 144 | </pre> |
michael@0 | 145 | </body> |
michael@0 | 146 | |
michael@0 | 147 | <vbox flex="1"> |
michael@0 | 148 | <tree id="list" flex="1" hidecolumnpicker="true"> |
michael@0 | 149 | <treecols> |
michael@0 | 150 | <treecol id="col" flex="1" hideheader="true"/> |
michael@0 | 151 | </treecols> |
michael@0 | 152 | <treechildren/> |
michael@0 | 153 | </tree> |
michael@0 | 154 | |
michael@0 | 155 | <tree id="tree" flex="1"> |
michael@0 | 156 | <treecols> |
michael@0 | 157 | <treecol id="col" flex="1" primary="true" label="column"/> |
michael@0 | 158 | </treecols> |
michael@0 | 159 | <treechildren/> |
michael@0 | 160 | </tree> |
michael@0 | 161 | |
michael@0 | 162 | <tree id="table" flex="1"> |
michael@0 | 163 | <treecols> |
michael@0 | 164 | <treecol id="col1" flex="1" label="column"/> |
michael@0 | 165 | <treecol id="col2" flex="1" label="column 2"/> |
michael@0 | 166 | </treecols> |
michael@0 | 167 | <treechildren/> |
michael@0 | 168 | </tree> |
michael@0 | 169 | |
michael@0 | 170 | <tree id="treetable" flex="1"> |
michael@0 | 171 | <treecols> |
michael@0 | 172 | <treecol id="col1" flex="1" primary="true" label="column"/> |
michael@0 | 173 | <treecol id="col2" flex="1" label="column 2"/> |
michael@0 | 174 | </treecols> |
michael@0 | 175 | <treechildren/> |
michael@0 | 176 | </tree> |
michael@0 | 177 | |
michael@0 | 178 | <vbox id="debug"/> |
michael@0 | 179 | </vbox> |
michael@0 | 180 | </hbox> |
michael@0 | 181 | |
michael@0 | 182 | </window> |
michael@0 | 183 |