OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | |
5 /** | 4 /** |
6 * @constructor | 5 * @unrestricted |
7 * @extends {WebInspector.AccessibilitySubPane} | |
8 */ | 6 */ |
9 WebInspector.AXNodeSubPane = function() | 7 WebInspector.AXNodeSubPane = class extends WebInspector.AccessibilitySubPane { |
10 { | 8 constructor() { |
11 WebInspector.AccessibilitySubPane.call(this, WebInspector.UIString("Computed
Properties")); | 9 super(WebInspector.UIString('Computed Properties')); |
12 | 10 |
13 this._noNodeInfo = this.createInfo(WebInspector.UIString("No accessibility n
ode")); | 11 this._noNodeInfo = this.createInfo(WebInspector.UIString('No accessibility n
ode')); |
14 this._ignoredInfo = this.createInfo(WebInspector.UIString("Accessibility nod
e not exposed"), "ax-ignored-info hidden"); | 12 this._ignoredInfo = |
| 13 this.createInfo(WebInspector.UIString('Accessibility node not exposed'),
'ax-ignored-info hidden'); |
15 | 14 |
16 this._treeOutline = this.createTreeOutline(); | 15 this._treeOutline = this.createTreeOutline(); |
17 this._ignoredReasonsTree = this.createTreeOutline(); | 16 this._ignoredReasonsTree = this.createTreeOutline(); |
18 | 17 |
19 this.element.classList.add("accessibility-computed"); | 18 this.element.classList.add('accessibility-computed'); |
20 }; | 19 } |
21 | 20 |
22 | 21 /** |
23 WebInspector.AXNodeSubPane.prototype = { | 22 * @param {?WebInspector.AccessibilityNode} axNode |
| 23 * @override |
| 24 */ |
| 25 setAXNode(axNode) { |
| 26 if (this._axNode === axNode) |
| 27 return; |
| 28 this._axNode = axNode; |
| 29 |
| 30 var treeOutline = this._treeOutline; |
| 31 treeOutline.removeChildren(); |
| 32 var ignoredReasons = this._ignoredReasonsTree; |
| 33 ignoredReasons.removeChildren(); |
| 34 |
| 35 if (!axNode) { |
| 36 treeOutline.element.classList.add('hidden'); |
| 37 this._ignoredInfo.classList.add('hidden'); |
| 38 ignoredReasons.element.classList.add('hidden'); |
| 39 |
| 40 this._noNodeInfo.classList.remove('hidden'); |
| 41 this.element.classList.add('ax-ignored-node-pane'); |
| 42 |
| 43 return; |
| 44 } |
| 45 |
| 46 if (axNode.ignored()) { |
| 47 this._noNodeInfo.classList.add('hidden'); |
| 48 treeOutline.element.classList.add('hidden'); |
| 49 this.element.classList.add('ax-ignored-node-pane'); |
| 50 |
| 51 this._ignoredInfo.classList.remove('hidden'); |
| 52 ignoredReasons.element.classList.remove('hidden'); |
| 53 /** |
| 54 * @param {!AccessibilityAgent.AXProperty} property |
| 55 */ |
| 56 function addIgnoredReason(property) { |
| 57 ignoredReasons.appendChild(new WebInspector.AXNodeIgnoredReasonTreeEleme
nt( |
| 58 property, /** @type {!WebInspector.AccessibilityNode} */ (axNode))); |
| 59 } |
| 60 var ignoredReasonsArray = /** @type {!Array<!AccessibilityAgent.AXProperty
>} */ (axNode.ignoredReasons()); |
| 61 for (var reason of ignoredReasonsArray) |
| 62 addIgnoredReason(reason); |
| 63 if (!ignoredReasons.firstChild()) |
| 64 ignoredReasons.element.classList.add('hidden'); |
| 65 return; |
| 66 } |
| 67 this.element.classList.remove('ax-ignored-node-pane'); |
| 68 |
| 69 this._ignoredInfo.classList.add('hidden'); |
| 70 ignoredReasons.element.classList.add('hidden'); |
| 71 this._noNodeInfo.classList.add('hidden'); |
| 72 |
| 73 treeOutline.element.classList.remove('hidden'); |
| 74 |
24 /** | 75 /** |
25 * @param {?WebInspector.AccessibilityNode} axNode | 76 * @param {!AccessibilityAgent.AXProperty} property |
26 * @override | |
27 */ | 77 */ |
28 setAXNode: function(axNode) | 78 function addProperty(property) { |
29 { | 79 treeOutline.appendChild(new WebInspector.AXNodePropertyTreePropertyElement
( |
30 if (this._axNode === axNode) | 80 property, /** @type {!WebInspector.AccessibilityNode} */ (axNode))); |
31 return; | 81 } |
32 this._axNode = axNode; | 82 |
33 | 83 for (var property of axNode.coreProperties()) |
34 var treeOutline = this._treeOutline; | 84 addProperty(property); |
35 treeOutline.removeChildren(); | 85 |
36 var ignoredReasons = this._ignoredReasonsTree; | 86 var roleProperty = /** @type {!AccessibilityAgent.AXProperty} */ ({name: 'ro
le', value: axNode.role()}); |
37 ignoredReasons.removeChildren(); | 87 addProperty(roleProperty); |
38 | 88 |
39 if (!axNode) { | 89 var propertyMap = {}; |
40 treeOutline.element.classList.add("hidden"); | 90 var propertiesArray = /** @type {!Array.<!AccessibilityAgent.AXProperty>} */
(axNode.properties()); |
41 this._ignoredInfo.classList.add("hidden"); | 91 for (var property of propertiesArray) |
42 ignoredReasons.element.classList.add("hidden"); | 92 propertyMap[property.name] = property; |
43 | 93 |
44 this._noNodeInfo.classList.remove("hidden"); | 94 for (var propertySet |
45 this.element.classList.add("ax-ignored-node-pane"); | 95 of [AccessibilityAgent.AXWidgetAttributes, AccessibilityAgent.AXWid
getStates, |
46 | 96 AccessibilityAgent.AXGlobalStates, AccessibilityAgent.AXLiveReg
ionAttributes, |
47 return; | 97 AccessibilityAgent.AXRelationshipAttributes]) { |
48 } | 98 for (var propertyKey in propertySet) { |
49 | 99 var property = propertySet[propertyKey]; |
50 if (axNode.ignored()) { | 100 if (property in propertyMap) |
51 this._noNodeInfo.classList.add("hidden"); | 101 addProperty(propertyMap[property]); |
52 treeOutline.element.classList.add("hidden"); | 102 } |
53 this.element.classList.add("ax-ignored-node-pane"); | 103 } |
54 | 104 } |
55 this._ignoredInfo.classList.remove("hidden"); | 105 |
56 ignoredReasons.element.classList.remove("hidden"); | 106 /** |
57 /** | 107 * @override |
58 * @param {!AccessibilityAgent.AXProperty} property | 108 * @param {?WebInspector.DOMNode} node |
59 */ | 109 */ |
60 function addIgnoredReason(property) | 110 setNode(node) { |
61 { | 111 super.setNode(node); |
62 ignoredReasons.appendChild(new WebInspector.AXNodeIgnoredReasonT
reeElement(property, /** @type {!WebInspector.AccessibilityNode} */ (axNode))); | 112 this._axNode = null; |
63 } | 113 } |
64 var ignoredReasonsArray = /** @type {!Array<!AccessibilityAgent.AXPr
operty>} */(axNode.ignoredReasons()); | |
65 for (var reason of ignoredReasonsArray) | |
66 addIgnoredReason(reason); | |
67 if (!ignoredReasons.firstChild()) | |
68 ignoredReasons.element.classList.add("hidden"); | |
69 return; | |
70 } | |
71 this.element.classList.remove("ax-ignored-node-pane"); | |
72 | |
73 this._ignoredInfo.classList.add("hidden"); | |
74 ignoredReasons.element.classList.add("hidden"); | |
75 this._noNodeInfo.classList.add("hidden"); | |
76 | |
77 treeOutline.element.classList.remove("hidden"); | |
78 | |
79 /** | |
80 * @param {!AccessibilityAgent.AXProperty} property | |
81 */ | |
82 function addProperty(property) | |
83 { | |
84 treeOutline.appendChild(new WebInspector.AXNodePropertyTreePropertyE
lement(property, /** @type {!WebInspector.AccessibilityNode} */ (axNode))); | |
85 } | |
86 | |
87 for (var property of axNode.coreProperties()) | |
88 addProperty(property); | |
89 | |
90 var roleProperty = /** @type {!AccessibilityAgent.AXProperty} */ ({name:
"role", value: axNode.role()}); | |
91 addProperty(roleProperty); | |
92 | |
93 var propertyMap = {}; | |
94 var propertiesArray = /** @type {!Array.<!AccessibilityAgent.AXProperty>
} */ (axNode.properties()); | |
95 for (var property of propertiesArray) | |
96 propertyMap[property.name] = property; | |
97 | |
98 for (var propertySet of [AccessibilityAgent.AXWidgetAttributes, Accessib
ilityAgent.AXWidgetStates, AccessibilityAgent.AXGlobalStates, AccessibilityAgent
.AXLiveRegionAttributes, AccessibilityAgent.AXRelationshipAttributes]) { | |
99 for (var propertyKey in propertySet) { | |
100 var property = propertySet[propertyKey]; | |
101 if (property in propertyMap) | |
102 addProperty(propertyMap[property]); | |
103 } | |
104 } | |
105 }, | |
106 | |
107 /** | |
108 * @override | |
109 * @param {?WebInspector.DOMNode} node | |
110 */ | |
111 setNode: function(node) | |
112 { | |
113 WebInspector.AccessibilitySubPane.prototype.setNode.call(this, node); | |
114 this._axNode = null; | |
115 }, | |
116 | |
117 __proto__: WebInspector.AccessibilitySubPane.prototype | |
118 }; | 114 }; |
119 | 115 |
120 /** | 116 /** |
121 * @constructor | 117 * @unrestricted |
122 * @param {!WebInspector.AccessibilityNode} axNode | |
123 * @extends {TreeElement} | |
124 */ | 118 */ |
125 WebInspector.AXNodePropertyTreeElement = function(axNode) | 119 WebInspector.AXNodePropertyTreeElement = class extends TreeElement { |
126 { | 120 /** |
| 121 * @param {!WebInspector.AccessibilityNode} axNode |
| 122 */ |
| 123 constructor(axNode) { |
127 // Pass an empty title, the title gets made later in onattach. | 124 // Pass an empty title, the title gets made later in onattach. |
128 TreeElement.call(this, ""); | 125 super(''); |
129 this._axNode = axNode; | 126 this._axNode = axNode; |
130 }; | 127 } |
131 | 128 |
132 /** | 129 /** |
133 * @param {?AccessibilityAgent.AXValueType} type | 130 * @param {?AccessibilityAgent.AXValueType} type |
134 * @param {string} value | 131 * @param {string} value |
135 * @return {!Element} | 132 * @return {!Element} |
136 */ | 133 */ |
137 WebInspector.AXNodePropertyTreeElement.createSimpleValueElement = function(type,
value) | 134 static createSimpleValueElement(type, value) { |
138 { | |
139 var valueElement; | 135 var valueElement; |
140 var AXValueType = AccessibilityAgent.AXValueType; | 136 var AXValueType = AccessibilityAgent.AXValueType; |
141 if (!type || type === AXValueType.ValueUndefined || type === AXValueType.Com
putedString) | 137 if (!type || type === AXValueType.ValueUndefined || type === AXValueType.Com
putedString) |
142 valueElement = createElement("span"); | 138 valueElement = createElement('span'); |
143 else | 139 else |
144 valueElement = createElementWithClass("span", "monospace"); | 140 valueElement = createElementWithClass('span', 'monospace'); |
145 var valueText; | 141 var valueText; |
146 var isStringProperty = type && WebInspector.AXNodePropertyTreeElement.String
Properties.has(type); | 142 var isStringProperty = type && WebInspector.AXNodePropertyTreeElement.String
Properties.has(type); |
147 if (isStringProperty) { | 143 if (isStringProperty) { |
148 // Render \n as a nice unicode cr symbol. | 144 // Render \n as a nice unicode cr symbol. |
149 valueText = "\"" + value.replace(/\n/g, "\u21B5") + "\""; | 145 valueText = '"' + value.replace(/\n/g, '\u21B5') + '"'; |
150 valueElement._originalTextContent = value; | 146 valueElement._originalTextContent = value; |
151 } else { | 147 } else { |
152 valueText = String(value); | 148 valueText = String(value); |
153 } | 149 } |
154 | 150 |
155 if (type && type in WebInspector.AXNodePropertyTreeElement.TypeStyles) | 151 if (type && type in WebInspector.AXNodePropertyTreeElement.TypeStyles) |
156 valueElement.classList.add(WebInspector.AXNodePropertyTreeElement.TypeSt
yles[type]); | 152 valueElement.classList.add(WebInspector.AXNodePropertyTreeElement.TypeStyl
es[type]); |
157 | 153 |
158 valueElement.setTextContentTruncatedIfNeeded(valueText || ""); | 154 valueElement.setTextContentTruncatedIfNeeded(valueText || ''); |
159 | 155 |
160 valueElement.title = String(value) || ""; | 156 valueElement.title = String(value) || ''; |
161 | 157 |
162 return valueElement; | 158 return valueElement; |
163 }; | 159 } |
164 | 160 |
165 /** | 161 /** |
166 * @param {string} tooltip | 162 * @param {string} tooltip |
167 * @return {!Element} | 163 * @return {!Element} |
168 */ | 164 */ |
169 WebInspector.AXNodePropertyTreeElement.createExclamationMark = function(tooltip) | 165 static createExclamationMark(tooltip) { |
170 { | 166 var exclamationElement = createElement('label', 'dt-icon-label'); |
171 var exclamationElement = createElement("label", "dt-icon-label"); | 167 exclamationElement.type = 'warning-icon'; |
172 exclamationElement.type = "warning-icon"; | |
173 exclamationElement.title = tooltip; | 168 exclamationElement.title = tooltip; |
174 return exclamationElement; | 169 return exclamationElement; |
175 }; | 170 } |
| 171 |
| 172 /** |
| 173 * @param {string} name |
| 174 */ |
| 175 appendNameElement(name) { |
| 176 var nameElement = createElement('span'); |
| 177 var AXAttributes = WebInspector.AccessibilityStrings.AXAttributes; |
| 178 if (name in AXAttributes) { |
| 179 nameElement.textContent = WebInspector.UIString(AXAttributes[name].name); |
| 180 nameElement.title = AXAttributes[name].description; |
| 181 nameElement.classList.add('ax-readable-name'); |
| 182 } else { |
| 183 nameElement.textContent = name; |
| 184 nameElement.classList.add('ax-name'); |
| 185 nameElement.classList.add('monospace'); |
| 186 } |
| 187 this.listItemElement.appendChild(nameElement); |
| 188 } |
| 189 |
| 190 /** |
| 191 * @param {!AccessibilityAgent.AXValue} value |
| 192 * @return {?Element} |
| 193 */ |
| 194 appendValueElement(value) { |
| 195 var AXValueType = AccessibilityAgent.AXValueType; |
| 196 if (value.type === AXValueType.Idref || value.type === AXValueType.Node || v
alue.type === AXValueType.IdrefList || |
| 197 value.type === AXValueType.NodeList) { |
| 198 this.appendRelatedNodeListValueElement(value); |
| 199 if (!value.value) |
| 200 return null; |
| 201 } else if (value.sources) { |
| 202 var sources = value.sources; |
| 203 for (var i = 0; i < sources.length; i++) { |
| 204 var source = sources[i]; |
| 205 var child = new WebInspector.AXValueSourceTreeElement(source, this._axNo
de); |
| 206 this.appendChild(child); |
| 207 } |
| 208 this.expand(); |
| 209 } |
| 210 var element = WebInspector.AXNodePropertyTreeElement.createSimpleValueElemen
t(value.type, String(value.value)); |
| 211 this.listItemElement.appendChild(element); |
| 212 return element; |
| 213 } |
| 214 |
| 215 /** |
| 216 * @param {!AccessibilityAgent.AXRelatedNode} relatedNode |
| 217 * @param {number} index |
| 218 */ |
| 219 appendRelatedNode(relatedNode, index) { |
| 220 var deferredNode = new WebInspector.DeferredDOMNode(this._axNode.target(), r
elatedNode.backendNodeId); |
| 221 var nodeTreeElement = new WebInspector.AXRelatedNodeSourceTreeElement({defer
redNode: deferredNode}, relatedNode); |
| 222 this.appendChild(nodeTreeElement); |
| 223 } |
| 224 |
| 225 /** |
| 226 * @param {!AccessibilityAgent.AXRelatedNode} relatedNode |
| 227 */ |
| 228 appendRelatedNodeInline(relatedNode) { |
| 229 var deferredNode = new WebInspector.DeferredDOMNode(this._axNode.target(), r
elatedNode.backendNodeId); |
| 230 var linkedNode = new WebInspector.AXRelatedNodeElement({deferredNode: deferr
edNode}, relatedNode); |
| 231 this.listItemElement.appendChild(linkedNode.render()); |
| 232 } |
| 233 |
| 234 /** |
| 235 * @param {!AccessibilityAgent.AXValue} value |
| 236 */ |
| 237 appendRelatedNodeListValueElement(value) { |
| 238 if (value.relatedNodes.length === 1 && !value.value) { |
| 239 this.appendRelatedNodeInline(value.relatedNodes[0]); |
| 240 return; |
| 241 } |
| 242 |
| 243 value.relatedNodes.forEach(this.appendRelatedNode, this); |
| 244 if (value.relatedNodes.length <= 3) |
| 245 this.expand(); |
| 246 else |
| 247 this.collapse(); |
| 248 } |
| 249 }; |
| 250 |
176 | 251 |
177 /** @type {!Object<string, string>} */ | 252 /** @type {!Object<string, string>} */ |
178 WebInspector.AXNodePropertyTreeElement.TypeStyles = { | 253 WebInspector.AXNodePropertyTreeElement.TypeStyles = { |
179 attribute: "ax-value-string", | 254 attribute: 'ax-value-string', |
180 boolean: "object-value-boolean", | 255 boolean: 'object-value-boolean', |
181 booleanOrUndefined: "object-value-boolean", | 256 booleanOrUndefined: 'object-value-boolean', |
182 computedString: "ax-readable-string", | 257 computedString: 'ax-readable-string', |
183 idref: "ax-value-string", | 258 idref: 'ax-value-string', |
184 idrefList: "ax-value-string", | 259 idrefList: 'ax-value-string', |
185 integer: "object-value-number", | 260 integer: 'object-value-number', |
186 internalRole: "ax-internal-role", | 261 internalRole: 'ax-internal-role', |
187 number: "ax-value-number", | 262 number: 'ax-value-number', |
188 role: "ax-role", | 263 role: 'ax-role', |
189 string: "ax-value-string", | 264 string: 'ax-value-string', |
190 tristate: "object-value-boolean", | 265 tristate: 'object-value-boolean', |
191 valueUndefined: "ax-value-undefined" | 266 valueUndefined: 'ax-value-undefined' |
192 }; | 267 }; |
193 | 268 |
194 /** @type {!Set.<!AccessibilityAgent.AXValueType>} */ | 269 /** @type {!Set.<!AccessibilityAgent.AXValueType>} */ |
195 WebInspector.AXNodePropertyTreeElement.StringProperties = new Set([ | 270 WebInspector.AXNodePropertyTreeElement.StringProperties = new Set([ |
196 AccessibilityAgent.AXValueType.String, | 271 AccessibilityAgent.AXValueType.String, AccessibilityAgent.AXValueType.Computed
String, |
197 AccessibilityAgent.AXValueType.ComputedString, | 272 AccessibilityAgent.AXValueType.IdrefList, AccessibilityAgent.AXValueType.Idref |
198 AccessibilityAgent.AXValueType.IdrefList, | |
199 AccessibilityAgent.AXValueType.Idref | |
200 ]); | 273 ]); |
201 | 274 |
202 WebInspector.AXNodePropertyTreeElement.prototype = { | |
203 /** | |
204 * @param {string} name | |
205 */ | |
206 appendNameElement: function(name) | |
207 { | |
208 var nameElement = createElement("span"); | |
209 var AXAttributes = WebInspector.AccessibilityStrings.AXAttributes; | |
210 if (name in AXAttributes) { | |
211 nameElement.textContent = WebInspector.UIString(AXAttributes[name].n
ame); | |
212 nameElement.title = AXAttributes[name].description; | |
213 nameElement.classList.add("ax-readable-name"); | |
214 } else { | |
215 nameElement.textContent = name; | |
216 nameElement.classList.add("ax-name"); | |
217 nameElement.classList.add("monospace"); | |
218 } | |
219 this.listItemElement.appendChild(nameElement); | |
220 }, | |
221 | |
222 /** | |
223 * @param {!AccessibilityAgent.AXValue} value | |
224 * @return {?Element} | |
225 */ | |
226 appendValueElement: function(value) | |
227 { | |
228 var AXValueType = AccessibilityAgent.AXValueType; | |
229 if (value.type === AXValueType.Idref || value.type === AXValueType.Node
|| | |
230 value.type === AXValueType.IdrefList || value.type === AXValueType.N
odeList) { | |
231 this.appendRelatedNodeListValueElement(value); | |
232 if (!value.value) | |
233 return null; | |
234 } else if (value.sources) { | |
235 var sources = value.sources; | |
236 for (var i = 0; i < sources.length; i++) { | |
237 var source = sources[i]; | |
238 var child = new WebInspector.AXValueSourceTreeElement(source, th
is._axNode); | |
239 this.appendChild(child); | |
240 } | |
241 this.expand(); | |
242 } | |
243 var element = WebInspector.AXNodePropertyTreeElement.createSimpleValueEl
ement(value.type, String(value.value)); | |
244 this.listItemElement.appendChild(element); | |
245 return element; | |
246 }, | |
247 | |
248 /** | |
249 * @param {!AccessibilityAgent.AXRelatedNode} relatedNode | |
250 * @param {number} index | |
251 */ | |
252 appendRelatedNode: function(relatedNode, index) | |
253 { | |
254 var deferredNode = new WebInspector.DeferredDOMNode(this._axNode.target(
), relatedNode.backendNodeId); | |
255 var nodeTreeElement = new WebInspector.AXRelatedNodeSourceTreeElement({
deferredNode: deferredNode }, relatedNode); | |
256 this.appendChild(nodeTreeElement); | |
257 }, | |
258 | |
259 /** | |
260 * @param {!AccessibilityAgent.AXRelatedNode} relatedNode | |
261 */ | |
262 appendRelatedNodeInline: function(relatedNode) | |
263 { | |
264 var deferredNode = new WebInspector.DeferredDOMNode(this._axNode.target(
), relatedNode.backendNodeId); | |
265 var linkedNode = new WebInspector.AXRelatedNodeElement({ deferredNode: d
eferredNode }, relatedNode); | |
266 this.listItemElement.appendChild(linkedNode.render()); | |
267 }, | |
268 | |
269 /** | |
270 * @param {!AccessibilityAgent.AXValue} value | |
271 */ | |
272 appendRelatedNodeListValueElement: function(value) | |
273 { | |
274 if (value.relatedNodes.length === 1 && !value.value) { | |
275 this.appendRelatedNodeInline(value.relatedNodes[0]); | |
276 return; | |
277 } | |
278 | |
279 value.relatedNodes.forEach(this.appendRelatedNode, this); | |
280 if (value.relatedNodes.length <= 3) | |
281 this.expand(); | |
282 else | |
283 this.collapse(); | |
284 }, | |
285 | |
286 __proto__: TreeElement.prototype | |
287 }; | |
288 | |
289 /** | 275 /** |
290 * @constructor | 276 * @unrestricted |
291 * @extends {WebInspector.AXNodePropertyTreeElement} | |
292 * @param {!AccessibilityAgent.AXProperty} property | |
293 * @param {!WebInspector.AccessibilityNode} axNode | |
294 */ | 277 */ |
295 WebInspector.AXNodePropertyTreePropertyElement = function(property, axNode) | 278 WebInspector.AXNodePropertyTreePropertyElement = class extends WebInspector.AXNo
dePropertyTreeElement { |
296 { | 279 /** |
297 WebInspector.AXNodePropertyTreeElement.call(this, axNode); | 280 * @param {!AccessibilityAgent.AXProperty} property |
| 281 * @param {!WebInspector.AccessibilityNode} axNode |
| 282 */ |
| 283 constructor(property, axNode) { |
| 284 super(axNode); |
298 | 285 |
299 this._property = property; | 286 this._property = property; |
300 this.toggleOnClick = true; | 287 this.toggleOnClick = true; |
301 this.selectable = false; | 288 this.selectable = false; |
302 | 289 |
303 this.listItemElement.classList.add("property"); | 290 this.listItemElement.classList.add('property'); |
304 }; | 291 } |
305 | 292 |
306 WebInspector.AXNodePropertyTreePropertyElement.prototype = { | 293 /** |
307 /** | 294 * @override |
308 * @override | 295 */ |
309 */ | 296 onattach() { |
310 onattach: function() | 297 this._update(); |
311 { | 298 } |
312 this._update(); | 299 |
313 }, | 300 _update() { |
314 | 301 this.listItemElement.removeChildren(); |
315 _update: function() | 302 |
316 { | 303 this.appendNameElement(this._property.name); |
317 this.listItemElement.removeChildren(); | 304 |
318 | 305 this.listItemElement.createChild('span', 'separator').textContent = ':\u00A0
'; |
319 this.appendNameElement(this._property.name); | 306 |
320 | 307 var valueElement = this.appendValueElement(this._property.value); |
321 this.listItemElement.createChild("span", "separator").textContent = ":\u
00A0"; | 308 if (this._property.name === 'name') |
322 | 309 valueElement.classList.add('ax-computed-text'); |
323 var valueElement = this.appendValueElement(this._property.value); | 310 } |
324 if (this._property.name === "name") | |
325 valueElement.classList.add("ax-computed-text"); | |
326 }, | |
327 | |
328 __proto__: WebInspector.AXNodePropertyTreeElement.prototype | |
329 }; | 311 }; |
330 | 312 |
331 /** | 313 /** |
332 * @constructor | 314 * @unrestricted |
333 * @extends {WebInspector.AXNodePropertyTreeElement} | |
334 * @param {!AccessibilityAgent.AXValueSource} source | |
335 * @param {!WebInspector.AccessibilityNode} axNode | |
336 */ | 315 */ |
337 WebInspector.AXValueSourceTreeElement = function(source, axNode) | 316 WebInspector.AXValueSourceTreeElement = class extends WebInspector.AXNodePropert
yTreeElement { |
338 { | 317 /** |
339 WebInspector.AXNodePropertyTreeElement.call(this, axNode); | 318 * @param {!AccessibilityAgent.AXValueSource} source |
| 319 * @param {!WebInspector.AccessibilityNode} axNode |
| 320 */ |
| 321 constructor(source, axNode) { |
| 322 super(axNode); |
340 this._source = source; | 323 this._source = source; |
341 this.selectable = false; | 324 this.selectable = false; |
342 }; | 325 } |
343 | 326 |
344 WebInspector.AXValueSourceTreeElement.prototype = { | 327 /** |
345 /** | 328 * @override |
346 * @override | 329 */ |
347 */ | 330 onattach() { |
348 onattach: function() | 331 this._update(); |
349 { | 332 } |
350 this._update(); | 333 |
351 }, | 334 /** |
352 | 335 * @param {!AccessibilityAgent.AXRelatedNode} relatedNode |
353 /** | 336 * @param {number} index |
354 * @param {!AccessibilityAgent.AXRelatedNode} relatedNode | 337 * @param {string} idref |
355 * @param {number} index | 338 */ |
356 * @param {string} idref | 339 appendRelatedNodeWithIdref(relatedNode, index, idref) { |
357 */ | 340 var deferredNode = new WebInspector.DeferredDOMNode(this._axNode.target(), r
elatedNode.backendNodeId); |
358 appendRelatedNodeWithIdref: function(relatedNode, index, idref) | 341 var nodeTreeElement = |
359 { | 342 new WebInspector.AXRelatedNodeSourceTreeElement({deferredNode: deferredN
ode, idref: idref}, relatedNode); |
360 var deferredNode = new WebInspector.DeferredDOMNode(this._axNode.target(
), relatedNode.backendNodeId); | 343 this.appendChild(nodeTreeElement); |
361 var nodeTreeElement = new WebInspector.AXRelatedNodeSourceTreeElement({
deferredNode: deferredNode, idref: idref }, relatedNode); | 344 } |
362 this.appendChild(nodeTreeElement); | 345 |
363 }, | 346 /** |
364 | 347 * @param {!AccessibilityAgent.AXValue} value |
365 /** | 348 */ |
366 * @param {!AccessibilityAgent.AXValue} value | 349 appendIDRefValueElement(value) { |
367 */ | 350 var relatedNodes = value.relatedNodes; |
368 appendIDRefValueElement: function(value) | 351 var numNodes = relatedNodes.length; |
369 { | 352 var valueElement; |
370 var relatedNodes = value.relatedNodes; | 353 |
371 var numNodes = relatedNodes.length; | 354 var idrefs = value.value.trim().split(/\s+/); |
372 var valueElement; | 355 if (idrefs.length === 1) { |
373 | 356 var idref = idrefs[0]; |
374 var idrefs = value.value.trim().split(/\s+/); | 357 var matchingNode = relatedNodes.find(node => node.idref === idref); |
375 if (idrefs.length === 1) { | 358 if (matchingNode) { |
376 var idref = idrefs[0]; | 359 this.appendRelatedNodeWithIdref(matchingNode, 0, idref); |
377 var matchingNode = relatedNodes.find(node => node.idref === idref); | 360 } else { |
378 if (matchingNode) { | 361 this.listItemElement.appendChild(new WebInspector.AXRelatedNodeElement({
idref: idref}).render()); |
379 this.appendRelatedNodeWithIdref(matchingNode, 0, idref); | 362 } |
380 } else { | 363 } else { |
381 this.listItemElement.appendChild(new WebInspector.AXRelatedNodeE
lement({ idref: idref }).render()); | 364 // TODO(aboxhall): exclamation mark if not idreflist type |
382 } | 365 for (var i = 0; i < idrefs.length; ++i) { |
| 366 var idref = idrefs[i]; |
| 367 var matchingNode = relatedNodes.find(node => node.idref === idref); |
| 368 if (matchingNode) { |
| 369 this.appendRelatedNodeWithIdref(matchingNode, i, idref); |
383 } else { | 370 } else { |
384 // TODO(aboxhall): exclamation mark if not idreflist type | 371 this.appendChild(new WebInspector.AXRelatedNodeSourceTreeElement({idre
f: idref})); |
385 for (var i = 0; i < idrefs.length; ++i) { | |
386 var idref = idrefs[i]; | |
387 var matchingNode = relatedNodes.find(node => node.idref === idre
f); | |
388 if (matchingNode) { | |
389 this.appendRelatedNodeWithIdref(matchingNode, i, idref); | |
390 } else { | |
391 this.appendChild(new WebInspector.AXRelatedNodeSourceTreeEle
ment({ idref: idref })); | |
392 } | |
393 } | |
394 } | 372 } |
395 }, | 373 } |
396 | 374 } |
397 /** | 375 } |
398 * @param {!AccessibilityAgent.AXValue} value | 376 |
399 * @override | 377 /** |
400 */ | 378 * @param {!AccessibilityAgent.AXValue} value |
401 appendRelatedNodeListValueElement: function(value) | 379 * @override |
402 { | 380 */ |
403 var relatedNodes = value.relatedNodes; | 381 appendRelatedNodeListValueElement(value) { |
404 var numNodes = relatedNodes.length; | 382 var relatedNodes = value.relatedNodes; |
405 | 383 var numNodes = relatedNodes.length; |
406 if (value.type === AccessibilityAgent.AXValueType.IdrefList || | 384 |
407 value.type === AccessibilityAgent.AXValueType.Idref) { | 385 if (value.type === AccessibilityAgent.AXValueType.IdrefList || |
408 this.appendIDRefValueElement(value); | 386 value.type === AccessibilityAgent.AXValueType.Idref) { |
| 387 this.appendIDRefValueElement(value); |
| 388 } else { |
| 389 super.appendRelatedNodeListValueElement(value); |
| 390 } |
| 391 |
| 392 if (numNodes <= 3) |
| 393 this.expand(); |
| 394 else |
| 395 this.collapse(); |
| 396 } |
| 397 |
| 398 /** |
| 399 * @param {!AccessibilityAgent.AXValueSource} source |
| 400 */ |
| 401 appendSourceNameElement(source) { |
| 402 var nameElement = createElement('span'); |
| 403 var AXValueSourceType = AccessibilityAgent.AXValueSourceType; |
| 404 var type = source.type; |
| 405 var name; |
| 406 switch (type) { |
| 407 case AXValueSourceType.Attribute: |
| 408 case AXValueSourceType.Placeholder: |
| 409 case AXValueSourceType.RelatedElement: |
| 410 if (source.nativeSource) { |
| 411 var AXNativeSourceTypes = WebInspector.AccessibilityStrings.AXNativeSo
urceTypes; |
| 412 var nativeSource = source.nativeSource; |
| 413 nameElement.textContent = WebInspector.UIString(AXNativeSourceTypes[na
tiveSource].name); |
| 414 nameElement.title = WebInspector.UIString(AXNativeSourceTypes[nativeSo
urce].description); |
| 415 nameElement.classList.add('ax-readable-name'); |
| 416 break; |
| 417 } |
| 418 nameElement.textContent = source.attribute; |
| 419 nameElement.classList.add('ax-name'); |
| 420 nameElement.classList.add('monospace'); |
| 421 break; |
| 422 default: |
| 423 var AXSourceTypes = WebInspector.AccessibilityStrings.AXSourceTypes; |
| 424 if (type in AXSourceTypes) { |
| 425 nameElement.textContent = WebInspector.UIString(AXSourceTypes[type].na
me); |
| 426 nameElement.title = WebInspector.UIString(AXSourceTypes[type].descript
ion); |
| 427 nameElement.classList.add('ax-readable-name'); |
409 } else { | 428 } else { |
410 WebInspector.AXNodePropertyTreeElement.prototype.appendRelatedNodeLi
stValueElement.call(this, value); | 429 console.warn(type, 'not in AXSourceTypes'); |
| 430 nameElement.textContent = WebInspector.UIString(type); |
411 } | 431 } |
412 | 432 } |
413 if (numNodes <= 3) | 433 this.listItemElement.appendChild(nameElement); |
414 this.expand(); | 434 } |
415 else | 435 |
416 this.collapse(); | 436 _update() { |
417 }, | 437 this.listItemElement.removeChildren(); |
418 | 438 |
419 /** | 439 if (this._source.invalid) { |
420 * @param {!AccessibilityAgent.AXValueSource} source | 440 var exclamationMark = |
421 */ | 441 WebInspector.AXNodePropertyTreeElement.createExclamationMark(WebInspec
tor.UIString('Invalid source.')); |
422 appendSourceNameElement: function(source) | 442 this.listItemElement.appendChild(exclamationMark); |
423 { | 443 this.listItemElement.classList.add('ax-value-source-invalid'); |
424 var nameElement = createElement("span"); | 444 } else if (this._source.superseded) { |
425 var AXValueSourceType = AccessibilityAgent.AXValueSourceType; | 445 this.listItemElement.classList.add('ax-value-source-unused'); |
426 var type = source.type; | 446 } |
427 var name; | 447 |
428 switch (type) { | 448 this.appendSourceNameElement(this._source); |
429 case AXValueSourceType.Attribute: | 449 |
430 case AXValueSourceType.Placeholder: | 450 this.listItemElement.createChild('span', 'separator').textContent = ':\u00a0
'; |
431 case AXValueSourceType.RelatedElement: | 451 |
432 if (source.nativeSource) { | 452 if (this._source.attributeValue) { |
433 var AXNativeSourceTypes = WebInspector.AccessibilityStrings.AXNa
tiveSourceTypes; | 453 this.appendValueElement(this._source.attributeValue); |
434 var nativeSource = source.nativeSource; | 454 this.listItemElement.createTextChild('\u00a0'); |
435 nameElement.textContent = WebInspector.UIString(AXNativeSourceTy
pes[nativeSource].name); | 455 } else if (this._source.nativeSourceValue) { |
436 nameElement.title = WebInspector.UIString(AXNativeSourceTypes[na
tiveSource].description); | 456 this.appendValueElement(this._source.nativeSourceValue); |
437 nameElement.classList.add("ax-readable-name"); | 457 this.listItemElement.createTextChild('\u00a0'); |
438 break; | 458 } else if (this._source.value) { |
439 } | 459 this.appendValueElement(this._source.value); |
440 nameElement.textContent = source.attribute; | 460 } else { |
441 nameElement.classList.add("ax-name"); | 461 var valueElement = WebInspector.AXNodePropertyTreeElement.createSimpleValu
eElement( |
442 nameElement.classList.add("monospace"); | 462 AccessibilityAgent.AXValueType.ValueUndefined, WebInspector.UIString('
Not specified')); |
443 break; | 463 this.listItemElement.appendChild(valueElement); |
444 default: | 464 this.listItemElement.classList.add('ax-value-source-unused'); |
445 var AXSourceTypes = WebInspector.AccessibilityStrings.AXSourceTypes; | 465 } |
446 if (type in AXSourceTypes) { | 466 |
447 nameElement.textContent = WebInspector.UIString(AXSourceTypes[ty
pe].name); | 467 if (this._source.value && this._source.superseded) |
448 nameElement.title = WebInspector.UIString(AXSourceTypes[type].de
scription); | 468 this.listItemElement.classList.add('ax-value-source-superseded'); |
449 nameElement.classList.add("ax-readable-name"); | 469 } |
450 } else { | 470 |
451 console.warn(type, "not in AXSourceTypes"); | 471 /** |
452 nameElement.textContent = WebInspector.UIString(type); | 472 * @param {!AccessibilityAgent.AXValue} value |
453 } | 473 * @return {!Element} |
454 } | 474 * @override |
455 this.listItemElement.appendChild(nameElement); | 475 */ |
456 }, | 476 appendValueElement(value) { |
457 | 477 var element = super.appendValueElement(value); |
458 _update: function() | 478 if (!element) { |
459 { | 479 element = WebInspector.AXNodePropertyTreeElement.createSimpleValueElement(
value.type, String(value.value)); |
460 this.listItemElement.removeChildren(); | 480 this.listItemElement.appendChild(element); |
461 | 481 } |
462 if (this._source.invalid) { | 482 return element; |
463 var exclamationMark = WebInspector.AXNodePropertyTreeElement.createE
xclamationMark(WebInspector.UIString("Invalid source.")); | 483 } |
464 this.listItemElement.appendChild(exclamationMark); | |
465 this.listItemElement.classList.add("ax-value-source-invalid"); | |
466 } else if (this._source.superseded) { | |
467 this.listItemElement.classList.add("ax-value-source-unused"); | |
468 } | |
469 | |
470 this.appendSourceNameElement(this._source); | |
471 | |
472 this.listItemElement.createChild("span", "separator").textContent = ":\u
00a0"; | |
473 | |
474 if (this._source.attributeValue) { | |
475 this.appendValueElement(this._source.attributeValue); | |
476 this.listItemElement.createTextChild("\u00a0"); | |
477 } else if (this._source.nativeSourceValue) { | |
478 this.appendValueElement(this._source.nativeSourceValue); | |
479 this.listItemElement.createTextChild("\u00a0"); | |
480 } else if (this._source.value) { | |
481 this.appendValueElement(this._source.value); | |
482 } else { | |
483 var valueElement = WebInspector.AXNodePropertyTreeElement.createSimp
leValueElement(AccessibilityAgent.AXValueType.ValueUndefined, WebInspector.UIStr
ing("Not specified")); | |
484 this.listItemElement.appendChild(valueElement); | |
485 this.listItemElement.classList.add("ax-value-source-unused"); | |
486 } | |
487 | |
488 if (this._source.value && this._source.superseded) | |
489 this.listItemElement.classList.add("ax-value-source-superseded"); | |
490 }, | |
491 | |
492 /** | |
493 * @param {!AccessibilityAgent.AXValue} value | |
494 * @return {!Element} | |
495 * @override | |
496 */ | |
497 appendValueElement: function(value) | |
498 { | |
499 var element = WebInspector.AXNodePropertyTreeElement.prototype.appendVal
ueElement.call(this, value); | |
500 if (!element) { | |
501 element = WebInspector.AXNodePropertyTreeElement.createSimpleValueEl
ement(value.type, String(value.value)); | |
502 this.listItemElement.appendChild(element); | |
503 } | |
504 return element; | |
505 }, | |
506 | |
507 __proto__: WebInspector.AXNodePropertyTreeElement.prototype | |
508 }; | 484 }; |
509 | 485 |
510 /** | 486 /** |
511 * @constructor | 487 * @unrestricted |
512 * @param {{deferredNode: (!WebInspector.DeferredDOMNode|undefined), idref: (str
ing|undefined)}} node | |
513 * @param {!AccessibilityAgent.AXRelatedNode=} value | |
514 * @extends {TreeElement} | |
515 */ | 488 */ |
516 WebInspector.AXRelatedNodeSourceTreeElement = function(node, value) | 489 WebInspector.AXRelatedNodeSourceTreeElement = class extends TreeElement { |
517 { | 490 /** |
518 TreeElement.call(this, ""); | 491 * @param {{deferredNode: (!WebInspector.DeferredDOMNode|undefined), idref: (s
tring|undefined)}} node |
| 492 * @param {!AccessibilityAgent.AXRelatedNode=} value |
| 493 */ |
| 494 constructor(node, value) { |
| 495 super(''); |
519 | 496 |
520 this._value = value; | 497 this._value = value; |
521 this._axRelatedNodeElement = new WebInspector.AXRelatedNodeElement(node, val
ue); | 498 this._axRelatedNodeElement = new WebInspector.AXRelatedNodeElement(node, val
ue); |
522 this.selectable = false; | 499 this.selectable = false; |
523 }; | 500 } |
524 | 501 |
525 WebInspector.AXRelatedNodeSourceTreeElement.prototype = { | 502 /** |
526 /** | 503 * @override |
527 * @override | 504 */ |
528 */ | 505 onattach() { |
529 onattach: function() | 506 this.listItemElement.appendChild(this._axRelatedNodeElement.render()); |
530 { | 507 if (!this._value) |
531 this.listItemElement.appendChild(this._axRelatedNodeElement.render()); | 508 return; |
532 if (!this._value) | 509 |
533 return; | 510 if (this._value.text) |
534 | 511 this.listItemElement.appendChild(WebInspector.AXNodePropertyTreeElement.cr
eateSimpleValueElement( |
535 if (this._value.text) | 512 AccessibilityAgent.AXValueType.ComputedString, this._value.text)); |
536 this.listItemElement.appendChild(WebInspector.AXNodePropertyTreeElem
ent.createSimpleValueElement(AccessibilityAgent.AXValueType.ComputedString, this
._value.text)); | 513 } |
537 }, | 514 }; |
538 | |
539 __proto__: TreeElement.prototype | |
540 }; | |
541 | |
542 | 515 |
543 /** | 516 /** |
544 * @constructor | 517 * @unrestricted |
545 * @param {{deferredNode: (!WebInspector.DeferredDOMNode|undefined), idref: (str
ing|undefined)}} node | |
546 * @param {!AccessibilityAgent.AXRelatedNode=} value | |
547 */ | 518 */ |
548 WebInspector.AXRelatedNodeElement = function(node, value) | 519 WebInspector.AXRelatedNodeElement = class { |
549 { | 520 /** |
| 521 * @param {{deferredNode: (!WebInspector.DeferredDOMNode|undefined), idref: (s
tring|undefined)}} node |
| 522 * @param {!AccessibilityAgent.AXRelatedNode=} value |
| 523 */ |
| 524 constructor(node, value) { |
550 this._deferredNode = node.deferredNode; | 525 this._deferredNode = node.deferredNode; |
551 this._idref = node.idref; | 526 this._idref = node.idref; |
552 this._value = value; | 527 this._value = value; |
553 }; | 528 } |
554 | 529 |
555 WebInspector.AXRelatedNodeElement.prototype = { | 530 /** |
| 531 * @return {!Element} |
| 532 */ |
| 533 render() { |
| 534 var element = createElement('span'); |
| 535 var valueElement; |
| 536 |
556 /** | 537 /** |
557 * @return {!Element} | 538 * @param {?WebInspector.DOMNode} node |
| 539 * @this {!WebInspector.AXRelatedNodeElement} |
558 */ | 540 */ |
559 render: function() | 541 function onNodeResolved(node) { |
560 { | 542 valueElement.appendChild(WebInspector.DOMPresentationUtils.linkifyNodeRefe
rence(node, this._idref)); |
561 var element = createElement("span"); | 543 } |
562 var valueElement; | 544 |
563 | 545 if (this._deferredNode) { |
564 /** | 546 valueElement = createElement('span'); |
565 * @param {?WebInspector.DOMNode} node | 547 element.appendChild(valueElement); |
566 * @this {!WebInspector.AXRelatedNodeElement} | 548 this._deferredNode.resolve(onNodeResolved.bind(this)); |
567 */ | 549 } else if (this._idref) { |
568 function onNodeResolved(node) | 550 element.classList.add('invalid'); |
569 { | 551 valueElement = |
570 valueElement.appendChild(WebInspector.DOMPresentationUtils.linkifyNo
deReference(node, this._idref)); | 552 WebInspector.AXNodePropertyTreeElement.createExclamationMark(WebInspec
tor.UIString('No node with this ID.')); |
571 } | 553 valueElement.createTextChild(this._idref); |
572 | 554 element.appendChild(valueElement); |
573 if (this._deferredNode) { | 555 } |
574 valueElement = createElement("span"); | 556 |
575 element.appendChild(valueElement); | 557 return element; |
576 this._deferredNode.resolve(onNodeResolved.bind(this)); | 558 } |
577 } else if (this._idref) { | |
578 element.classList.add("invalid"); | |
579 valueElement = WebInspector.AXNodePropertyTreeElement.createExclamat
ionMark(WebInspector.UIString("No node with this ID.")); | |
580 valueElement.createTextChild(this._idref); | |
581 element.appendChild(valueElement); | |
582 } | |
583 | |
584 return element; | |
585 } | |
586 }; | 559 }; |
587 | 560 |
588 /** | 561 /** |
589 * @constructor | 562 * @unrestricted |
590 * @extends {WebInspector.AXNodePropertyTreeElement} | |
591 * @param {!AccessibilityAgent.AXProperty} property | |
592 * @param {!WebInspector.AccessibilityNode} axNode | |
593 */ | 563 */ |
594 WebInspector.AXNodeIgnoredReasonTreeElement = function(property, axNode) | 564 WebInspector.AXNodeIgnoredReasonTreeElement = class extends WebInspector.AXNodeP
ropertyTreeElement { |
595 { | 565 /** |
596 WebInspector.AXNodePropertyTreeElement.call(this, axNode); | 566 * @param {!AccessibilityAgent.AXProperty} property |
| 567 * @param {!WebInspector.AccessibilityNode} axNode |
| 568 */ |
| 569 constructor(property, axNode) { |
| 570 super(axNode); |
597 this._property = property; | 571 this._property = property; |
598 this._axNode = axNode; | 572 this._axNode = axNode; |
599 this.toggleOnClick = true; | 573 this.toggleOnClick = true; |
600 this.selectable = false; | 574 this.selectable = false; |
601 }; | 575 } |
602 | 576 |
603 WebInspector.AXNodeIgnoredReasonTreeElement.prototype = { | 577 /** |
604 /** | 578 * @param {?string} reason |
605 * @override | 579 * @param {?WebInspector.AccessibilityNode} axNode |
606 */ | 580 * @return {?Element} |
607 onattach: function() | 581 */ |
608 { | 582 static createReasonElement(reason, axNode) { |
609 this.listItemElement.removeChildren(); | |
610 | |
611 this._reasonElement = WebInspector.AXNodeIgnoredReasonTreeElement.create
ReasonElement(this._property.name, this._axNode); | |
612 this.listItemElement.appendChild(this._reasonElement); | |
613 | |
614 var value = this._property.value; | |
615 if (value.type === AccessibilityAgent.AXValueType.Idref) | |
616 this.appendRelatedNodeListValueElement(value); | |
617 }, | |
618 | |
619 __proto__: WebInspector.AXNodePropertyTreeElement.prototype | |
620 }; | |
621 | |
622 /** | |
623 * @param {?string} reason | |
624 * @param {?WebInspector.AccessibilityNode} axNode | |
625 * @return {?Element} | |
626 */ | |
627 WebInspector.AXNodeIgnoredReasonTreeElement.createReasonElement = function(reaso
n, axNode) | |
628 { | |
629 var reasonElement = null; | 583 var reasonElement = null; |
630 switch (reason) { | 584 switch (reason) { |
631 case "activeModalDialog": | 585 case 'activeModalDialog': |
632 reasonElement = WebInspector.formatLocalized("Element is hidden by activ
e modal dialog:\u00a0", []); | 586 reasonElement = WebInspector.formatLocalized('Element is hidden by activ
e modal dialog:\u00a0', []); |
633 break; | 587 break; |
634 case "ancestorDisallowsChild": | 588 case 'ancestorDisallowsChild': |
635 reasonElement = WebInspector.formatLocalized("Element is not permitted a
s child of ", []); | 589 reasonElement = WebInspector.formatLocalized('Element is not permitted a
s child of ', []); |
636 break; | 590 break; |
637 // http://www.w3.org/TR/wai-aria/roles#childrenArePresentational | 591 // http://www.w3.org/TR/wai-aria/roles#childrenArePresentational |
638 case "ancestorIsLeafNode": | 592 case 'ancestorIsLeafNode': |
639 reasonElement = WebInspector.formatLocalized("Ancestor's children are al
l presentational:\u00a0", []); | 593 reasonElement = WebInspector.formatLocalized('Ancestor\'s children are a
ll presentational:\u00a0', []); |
640 break; | 594 break; |
641 case "ariaHidden": | 595 case 'ariaHidden': |
642 var ariaHiddenSpan = createElement("span", "source-code").textContent =
"aria-hidden"; | 596 var ariaHiddenSpan = createElement('span', 'source-code').textContent =
'aria-hidden'; |
643 reasonElement = WebInspector.formatLocalized("Element is %s.", [ ariaHid
denSpan ]); | 597 reasonElement = WebInspector.formatLocalized('Element is %s.', [ariaHidd
enSpan]); |
644 break; | 598 break; |
645 case "ariaHiddenRoot": | 599 case 'ariaHiddenRoot': |
646 var ariaHiddenSpan = createElement("span", "source-code").textContent =
"aria-hidden"; | 600 var ariaHiddenSpan = createElement('span', 'source-code').textContent =
'aria-hidden'; |
647 var trueSpan = createElement("span", "source-code").textContent = "true"
; | 601 var trueSpan = createElement('span', 'source-code').textContent = 'true'
; |
648 reasonElement = WebInspector.formatLocalized("%s is %s on ancestor:\u00a
0", [ ariaHiddenSpan, trueSpan ]); | 602 reasonElement = WebInspector.formatLocalized('%s is %s on ancestor:\u00a
0', [ariaHiddenSpan, trueSpan]); |
649 break; | 603 break; |
650 case "emptyAlt": | 604 case 'emptyAlt': |
651 reasonElement = WebInspector.formatLocalized("Element has empty alt text
.", []); | 605 reasonElement = WebInspector.formatLocalized('Element has empty alt text
.', []); |
652 break; | 606 break; |
653 case "emptyText": | 607 case 'emptyText': |
654 reasonElement = WebInspector.formatLocalized("No text content.", []); | 608 reasonElement = WebInspector.formatLocalized('No text content.', []); |
655 break; | 609 break; |
656 case "inert": | 610 case 'inert': |
657 reasonElement = WebInspector.formatLocalized("Element is inert.", []); | 611 reasonElement = WebInspector.formatLocalized('Element is inert.', []); |
658 break; | 612 break; |
659 case "inheritsPresentation": | 613 case 'inheritsPresentation': |
660 reasonElement = WebInspector.formatLocalized("Element inherits presentat
ional role from\u00a0", []); | 614 reasonElement = WebInspector.formatLocalized('Element inherits presentat
ional role from\u00a0', []); |
661 break; | 615 break; |
662 case "labelContainer": | 616 case 'labelContainer': |
663 reasonElement = WebInspector.formatLocalized("Part of label element:\u00
a0", []); | 617 reasonElement = WebInspector.formatLocalized('Part of label element:\u00
a0', []); |
664 break; | 618 break; |
665 case "labelFor": | 619 case 'labelFor': |
666 reasonElement = WebInspector.formatLocalized("Label for\u00a0", []); | 620 reasonElement = WebInspector.formatLocalized('Label for\u00a0', []); |
667 break; | 621 break; |
668 case "notRendered": | 622 case 'notRendered': |
669 reasonElement = WebInspector.formatLocalized("Element is not rendered.",
[]); | 623 reasonElement = WebInspector.formatLocalized('Element is not rendered.',
[]); |
670 break; | 624 break; |
671 case "notVisible": | 625 case 'notVisible': |
672 reasonElement = WebInspector.formatLocalized("Element is not visible.",
[]); | 626 reasonElement = WebInspector.formatLocalized('Element is not visible.',
[]); |
673 break; | 627 break; |
674 case "presentationalRole": | 628 case 'presentationalRole': |
675 var rolePresentationSpan = createElement("span", "source-code").textCont
ent = "role=" + axNode.role().value; | 629 var rolePresentationSpan = createElement('span', 'source-code').textCont
ent = 'role=' + axNode.role().value; |
676 reasonElement = WebInspector.formatLocalized("Element has %s.", [ rolePr
esentationSpan ]); | 630 reasonElement = WebInspector.formatLocalized('Element has %s.', [rolePre
sentationSpan]); |
677 break; | 631 break; |
678 case "probablyPresentational": | 632 case 'probablyPresentational': |
679 reasonElement = WebInspector.formatLocalized("Element is presentational.
", []); | 633 reasonElement = WebInspector.formatLocalized('Element is presentational.
', []); |
680 break; | 634 break; |
681 case "staticTextUsedAsNameFor": | 635 case 'staticTextUsedAsNameFor': |
682 reasonElement = WebInspector.formatLocalized("Static text node is used a
s name for\u00a0", []); | 636 reasonElement = WebInspector.formatLocalized('Static text node is used a
s name for\u00a0', []); |
683 break; | 637 break; |
684 case "uninteresting": | 638 case 'uninteresting': |
685 reasonElement = WebInspector.formatLocalized("Element not interesting fo
r accessibility.", []); | 639 reasonElement = WebInspector.formatLocalized('Element not interesting fo
r accessibility.', []); |
686 break; | 640 break; |
687 } | 641 } |
688 if (reasonElement) | 642 if (reasonElement) |
689 reasonElement.classList.add("ax-reason"); | 643 reasonElement.classList.add('ax-reason'); |
690 return reasonElement; | 644 return reasonElement; |
691 }; | 645 } |
| 646 |
| 647 /** |
| 648 * @override |
| 649 */ |
| 650 onattach() { |
| 651 this.listItemElement.removeChildren(); |
| 652 |
| 653 this._reasonElement = |
| 654 WebInspector.AXNodeIgnoredReasonTreeElement.createReasonElement(this._pr
operty.name, this._axNode); |
| 655 this.listItemElement.appendChild(this._reasonElement); |
| 656 |
| 657 var value = this._property.value; |
| 658 if (value.type === AccessibilityAgent.AXValueType.Idref) |
| 659 this.appendRelatedNodeListValueElement(value); |
| 660 } |
| 661 }; |
| 662 |
| 663 |
OLD | NEW |