Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(892)

Side by Side Diff: Source/devtools/front_end/accessibility/AccessibilitySidebarView.js

Issue 1156223002: Show human-readable names for accessibility properties (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: pfeldman review comments Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.ThrottledElementsSidebarView} 7 * @extends {WebInspector.ThrottledElementsSidebarView}
8 */ 8 */
9 WebInspector.AccessibilitySidebarView = function() 9 WebInspector.AccessibilitySidebarView = function()
10 { 10 {
11 WebInspector.ThrottledElementsSidebarView.call(this); 11 WebInspector.ThrottledElementsSidebarView.call(this);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 * @extends {WebInspector.AccessibilitySubPane} 197 * @extends {WebInspector.AccessibilitySubPane}
198 */ 198 */
199 WebInspector.AXComputedTextSubPane = function() 199 WebInspector.AXComputedTextSubPane = function()
200 { 200 {
201 WebInspector.AccessibilitySubPane.call(this, WebInspector.UIString("Computed Text")); 201 WebInspector.AccessibilitySubPane.call(this, WebInspector.UIString("Computed Text"));
202 202
203 this._computedTextElement = this.bodyElement.createChild("div", "ax-computed -text hidden"); 203 this._computedTextElement = this.bodyElement.createChild("div", "ax-computed -text hidden");
204 204
205 this._noTextInfo = this.createInfo(WebInspector.UIString("No computed text") ); 205 this._noTextInfo = this.createInfo(WebInspector.UIString("No computed text") );
206 this._noNodeInfo = this.createInfo(WebInspector.UIString("No accessibility n ode")); 206 this._noNodeInfo = this.createInfo(WebInspector.UIString("No accessibility n ode"));
207 this._treeOutline = this.createTreeOutline("monospace"); 207 this._treeOutline = this.createTreeOutline();
208 }; 208 };
209 209
210 210
211 WebInspector.AXComputedTextSubPane.prototype = { 211 WebInspector.AXComputedTextSubPane.prototype = {
212 /** 212 /**
213 * @param {?AccessibilityAgent.AXNode} axNode 213 * @param {?AccessibilityAgent.AXNode} axNode
214 * @override 214 * @override
215 */ 215 */
216 setAXNode: function(axNode) 216 setAXNode: function(axNode)
217 { 217 {
(...skipping 13 matching lines...) Expand all
231 this._noNodeInfo.classList.remove("hidden"); 231 this._noNodeInfo.classList.remove("hidden");
232 return; 232 return;
233 } 233 }
234 this._noNodeInfo.classList.add("hidden"); 234 this._noNodeInfo.classList.add("hidden");
235 235
236 this._computedTextElement.removeChildren(); 236 this._computedTextElement.removeChildren();
237 237
238 // TODO(aboxhall): include contents where appropriate (requires protocol change) 238 // TODO(aboxhall): include contents where appropriate (requires protocol change)
239 this._computedTextElement.classList.toggle("hidden", !axNode.name || !ax Node.name.value); 239 this._computedTextElement.classList.toggle("hidden", !axNode.name || !ax Node.name.value);
240 if (axNode.name && axNode.name.value) 240 if (axNode.name && axNode.name.value)
241 this._computedTextElement.textContent = axNode.name.value; 241 this._computedTextElement.createChild("div").textContent = axNode.na me.value;
242 242
243 var foundProperty = false; 243 var foundProperty = false;
244 /** 244 /**
245 * @param {!AccessibilityAgent.AXProperty} property 245 * @param {!AccessibilityAgent.AXProperty} property
246 */ 246 */
247 function addProperty(property) 247 function addProperty(property)
248 { 248 {
249 foundProperty = true; 249 foundProperty = true;
250 treeOutline.appendChild(new WebInspector.AXNodePropertyTreeElement(p roperty, target)); 250 treeOutline.appendChild(new WebInspector.AXNodePropertyTreeElement(p roperty, target));
251 } 251 }
(...skipping 27 matching lines...) Expand all
279 * @constructor 279 * @constructor
280 * @extends {WebInspector.AccessibilitySubPane} 280 * @extends {WebInspector.AccessibilitySubPane}
281 */ 281 */
282 WebInspector.AXNodeSubPane = function() 282 WebInspector.AXNodeSubPane = function()
283 { 283 {
284 WebInspector.AccessibilitySubPane.call(this, WebInspector.UIString("Accessib ility Node")); 284 WebInspector.AccessibilitySubPane.call(this, WebInspector.UIString("Accessib ility Node"));
285 285
286 this._noNodeInfo = this.createInfo(WebInspector.UIString("No accessibility n ode")); 286 this._noNodeInfo = this.createInfo(WebInspector.UIString("No accessibility n ode"));
287 this._ignoredInfo = this.createInfo(WebInspector.UIString("Accessibility nod e not exposed"), "ax-ignored-info hidden"); 287 this._ignoredInfo = this.createInfo(WebInspector.UIString("Accessibility nod e not exposed"), "ax-ignored-info hidden");
288 288
289 this._treeOutline = this.createTreeOutline('monospace'); 289 this._treeOutline = this.createTreeOutline();
290 this._ignoredReasonsTree = this.createTreeOutline(); 290 this._ignoredReasonsTree = this.createTreeOutline();
291 }; 291 };
292 292
293 293
294 WebInspector.AXNodeSubPane.prototype = { 294 WebInspector.AXNodeSubPane.prototype = {
295 /** 295 /**
296 * @param {?AccessibilityAgent.AXNode} axNode 296 * @param {?AccessibilityAgent.AXNode} axNode
297 * @override 297 * @override
298 */ 298 */
299 setAXNode: function(axNode) 299 setAXNode: function(axNode)
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 WebInspector.AXNodePropertyTreeElement.populateWithNode = function(treeNode, axN ode, target) 444 WebInspector.AXNodePropertyTreeElement.populateWithNode = function(treeNode, axN ode, target)
445 { 445 {
446 } 446 }
447 447
448 /** 448 /**
449 * @param {?string} name 449 * @param {?string} name
450 * @return {!Element} 450 * @return {!Element}
451 */ 451 */
452 WebInspector.AXNodePropertyTreeElement.createNameElement = function(name) 452 WebInspector.AXNodePropertyTreeElement.createNameElement = function(name)
453 { 453 {
454 var nameElement = createElementWithClass("span", "ax-name"); 454 var nameElement = createElement("span");
455 if (/^\s|\s$|^$|\n/.test(name)) 455 var AXAttributes = WebInspector.AccessibilityStrings.AXAttributes;
456 nameElement.createTextChildren("\"", name.replace(/\n/g, "\u21B5"), "\"" ); 456 if (name in AXAttributes) {
457 else 457 nameElement.textContent = WebInspector.UIString(AXAttributes[name].name) ;
458 nameElement.title = WebInspector.UIString(AXAttributes[name].description );
459 nameElement.classList.add("ax-readable-name");
460 } else {
458 nameElement.textContent = name; 461 nameElement.textContent = name;
462 nameElement.classList.add("ax-name");
463 }
459 return nameElement; 464 return nameElement;
460 } 465 }
461 466
462 /** 467 /**
463 * @param {!AccessibilityAgent.AXValue} value 468 * @param {!AccessibilityAgent.AXValue} value
464 * @param {!WebInspector.Target} target 469 * @param {!WebInspector.Target} target
465 * @return {?Element} 470 * @return {?Element}
466 */ 471 */
467 WebInspector.AXNodePropertyTreeElement.createRelationshipValueElement = function (value, target) 472 WebInspector.AXNodePropertyTreeElement.createRelationshipValueElement = function (value, target)
468 { 473 {
(...skipping 12 matching lines...) Expand all
481 return valueElement; 486 return valueElement;
482 } 487 }
483 488
484 /** 489 /**
485 * @param {!AccessibilityAgent.AXValue} value 490 * @param {!AccessibilityAgent.AXValue} value
486 * @param {!Element} parentElement 491 * @param {!Element} parentElement
487 * @return {!Element} 492 * @return {!Element}
488 */ 493 */
489 WebInspector.AXNodePropertyTreeElement.createValueElement = function(value, pare ntElement) 494 WebInspector.AXNodePropertyTreeElement.createValueElement = function(value, pare ntElement)
490 { 495 {
491 var valueElement = createElementWithClass("span", "object-value"); 496 var valueElement = createElementWithClass("span", "monospace");
492 var type = value.type; 497 var type = value.type;
493 var prefix; 498 var prefix;
494 var valueText; 499 var valueText;
495 var suffix; 500 var suffix;
496 if (type === "string") { 501 if (type === "string") {
497 // Render \n as a nice unicode cr symbol. 502 // Render \n as a nice unicode cr symbol.
498 prefix = "\""; 503 prefix = "\"";
499 valueText = value.value.replace(/\n/g, "\u21B5"); 504 valueText = value.value.replace(/\n/g, "\u21B5");
500 suffix = "\""; 505 suffix = "\"";
501 valueElement._originalTextContent = "\"" + value.value + "\""; 506 valueElement._originalTextContent = "\"" + value.value + "\"";
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 reasonElement = WebInspector.formatLocalized("Static text node is used a s name for ", [], ""); 673 reasonElement = WebInspector.formatLocalized("Static text node is used a s name for ", [], "");
669 break; 674 break;
670 case "uninteresting": 675 case "uninteresting":
671 reasonElement = WebInspector.formatLocalized("Element not interesting fo r accessibility.", [], "") 676 reasonElement = WebInspector.formatLocalized("Element not interesting fo r accessibility.", [], "")
672 break; 677 break;
673 } 678 }
674 if (reasonElement) 679 if (reasonElement)
675 reasonElement.classList.add("ax-reason"); 680 reasonElement.classList.add("ax-reason");
676 return reasonElement; 681 return reasonElement;
677 } 682 }
OLDNEW
« no previous file with comments | « Source/devtools/devtools.gypi ('k') | Source/devtools/front_end/accessibility/AccessibilityStrings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698