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

Side by Side Diff: webkit/glue/webaccessibility.cc

Issue 7867018: Add routing id and notification type to accessibility logging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add conversion from int to string. Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « webkit/glue/webaccessibility.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "webkit/glue/webaccessibility.h" 5 #include "webkit/glue/webaccessibility.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityCache .h" 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityCache .h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec t.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec t.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityRole. h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityRole. h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAttribute.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAttribute.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocumentType.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocumentType.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement .h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement .h"
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h"
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNamedNodeMap.h" 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNamedNodeMap.h"
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h"
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h"
25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h"
26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h"
28 28
29 #ifndef NDEBUG
30 #include "content/common/view_messages.h"
31 #endif
32
brettw 2011/09/16 04:52:23 Extra blank line here.
David Tseng 2011/09/19 16:02:45 Done.
33
29 using base::DoubleToString; 34 using base::DoubleToString;
30 using base::IntToString; 35 using base::IntToString;
31 using WebKit::WebAccessibilityCache; 36 using WebKit::WebAccessibilityCache;
32 using WebKit::WebAccessibilityRole; 37 using WebKit::WebAccessibilityRole;
33 using WebKit::WebAccessibilityObject; 38 using WebKit::WebAccessibilityObject;
34 39
35 namespace { 40 namespace {
36 41
37 std::string IntVectorToString(const std::vector<int>& items) { 42 std::string IntVectorToString(const std::vector<int>& items) {
38 std::string str; 43 std::string str;
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 WebAccessibility::WebAccessibility(const WebKit::WebAccessibilityObject& src, 333 WebAccessibility::WebAccessibility(const WebKit::WebAccessibilityObject& src,
329 WebKit::WebAccessibilityCache* cache, 334 WebKit::WebAccessibilityCache* cache,
330 bool include_children) { 335 bool include_children) {
331 Init(src, cache, include_children); 336 Init(src, cache, include_children);
332 } 337 }
333 338
334 WebAccessibility::~WebAccessibility() { 339 WebAccessibility::~WebAccessibility() {
335 } 340 }
336 341
337 #ifndef NDEBUG 342 #ifndef NDEBUG
338 std::string WebAccessibility::DebugString(bool recursive) { 343 std::string WebAccessibility::DebugString(bool recursive,
344 int render_routing_id,
brettw 2011/09/16 04:52:23 These should be aligned with the "bool" on the pre
David Tseng 2011/09/19 16:02:45 Done.
345 int notification) {
339 std::string result; 346 std::string result;
340 static int indent = 0; 347 static int indent = 0;
341 348
349 if (render_routing_id != 0) {
350 ViewHostMsg_AccEvent::Value notification_type =
351 static_cast<ViewHostMsg_AccEvent::Value>(notification);
352 result+= "routing id: ";
brettw 2011/09/16 04:52:23 There should be a space before the "+" on each of
David Tseng 2011/09/19 16:02:45 Done; had done this to minimize spacing (bad style
353 result+= IntToString(render_routing_id);
354 result+= " notification: ";
355
356 switch (notification_type) {
357 case ViewHostMsg_AccEvent::ACTIVE_DESCENDANT_CHANGED:
358 result+= "active descendant changed";
359 break;
360 case ViewHostMsg_AccEvent::ALERT:
361 result+= "alert";
362 break;
363 case ViewHostMsg_AccEvent::CHECK_STATE_CHANGED:
364 result+= "checked state changed";
365 break;
366 case ViewHostMsg_AccEvent::CHILDREN_CHANGED:
367 result+= "children changed";
368 break;
369 case ViewHostMsg_AccEvent::FOCUS_CHANGED:
370 result+= "focus changed";
371 break;
372 case ViewHostMsg_AccEvent::LAYOUT_COMPLETE:
373 result+= "layout complete";
374 break;
375 case ViewHostMsg_AccEvent::LIVE_REGION_CHANGED:
376 result+= "live region changed";
377 break;
378 case ViewHostMsg_AccEvent::LOAD_COMPLETE:
379 result+= "load complete";
380 break;
381 case ViewHostMsg_AccEvent::MENU_LIST_VALUE_CHANGED:
382 result+= "menu list changed";
383 break;
384 case ViewHostMsg_AccEvent::OBJECT_SHOW:
385 result+= "object show";
386 break;
387 case ViewHostMsg_AccEvent::OBJECT_HIDE:
388 result+= "object hide";
389 break;
390 case ViewHostMsg_AccEvent::ROW_COUNT_CHANGED:
391 result+= "row count changed";
392 break;
393 case ViewHostMsg_AccEvent::ROW_COLLAPSED:
394 result+= "row collapsed";
395 break;
396 case ViewHostMsg_AccEvent::ROW_EXPANDED:
397 result+= "row expanded";
398 break;
399 case ViewHostMsg_AccEvent::SCROLLED_TO_ANCHOR:
400 result+= "scrolled to anchor";
401 break;
402 case ViewHostMsg_AccEvent::SELECTED_CHILDREN_CHANGED:
403 result+= "selected children changed";
404 break;
405 case ViewHostMsg_AccEvent::SELECTED_TEXT_CHANGED:
406 result+= "selected text changed";
407 break;
408 case ViewHostMsg_AccEvent::TEXT_INSERTED:
409 result+= "text inserted";
410 break;
411 case ViewHostMsg_AccEvent::TEXT_REMOVED:
412 result+= "text removed";
413 break;
414 case ViewHostMsg_AccEvent::VALUE_CHANGED:
415 result+= "value changed";
416 break;
417 default:
418 NOTREACHED();
419 }
420 }
421
422 result += "\n";
342 for (int i = 0; i < indent; ++i) 423 for (int i = 0; i < indent; ++i)
343 result += " "; 424 result += " ";
344 425
345 result += "id=" + IntToString(id); 426 result += "id=" + IntToString(id);
346 427
347 switch (role) { 428 switch (role) {
348 case ROLE_ALERT: result += " ALERT"; break; 429 case ROLE_ALERT: result += " ALERT"; break;
349 case ROLE_ALERT_DIALOG: result += " ALERT_DIALOG"; break; 430 case ROLE_ALERT_DIALOG: result += " ALERT_DIALOG"; break;
350 case ROLE_ANNOTATION: result += " ANNOTATION"; break; 431 case ROLE_ANNOTATION: result += " ANNOTATION"; break;
351 case ROLE_APPLICATION: result += " APPLICATION"; break; 432 case ROLE_APPLICATION: result += " APPLICATION"; break;
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 if (!line_breaks.empty()) 749 if (!line_breaks.empty())
669 result += " line_breaks=" + IntVectorToString(line_breaks); 750 result += " line_breaks=" + IntVectorToString(line_breaks);
670 751
671 if (!cell_ids.empty()) 752 if (!cell_ids.empty())
672 result += " cell_ids=" + IntVectorToString(cell_ids); 753 result += " cell_ids=" + IntVectorToString(cell_ids);
673 754
674 if (recursive) { 755 if (recursive) {
675 result += "\n"; 756 result += "\n";
676 ++indent; 757 ++indent;
677 for (size_t i = 0; i < children.size(); ++i) 758 for (size_t i = 0; i < children.size(); ++i)
678 result += children[i].DebugString(true); 759 result += children[i].DebugString(true, 0, 0);
679 --indent; 760 --indent;
680 } 761 }
681 762
682 return result; 763 return result;
683 } 764 }
684 #endif // ifndef NDEBUG 765 #endif // ifndef NDEBUG
685 766
686 void WebAccessibility::Init(const WebKit::WebAccessibilityObject& src, 767 void WebAccessibility::Init(const WebKit::WebAccessibilityObject& src,
687 WebKit::WebAccessibilityCache* cache, 768 WebKit::WebAccessibilityCache* cache,
688 bool include_children) { 769 bool include_children) {
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 bool WebAccessibility::IsParentUnignoredOf( 1009 bool WebAccessibility::IsParentUnignoredOf(
929 const WebKit::WebAccessibilityObject& ancestor, 1010 const WebKit::WebAccessibilityObject& ancestor,
930 const WebKit::WebAccessibilityObject& child) { 1011 const WebKit::WebAccessibilityObject& child) {
931 WebKit::WebAccessibilityObject parent = child.parentObject(); 1012 WebKit::WebAccessibilityObject parent = child.parentObject();
932 while (!parent.isNull() && parent.accessibilityIsIgnored()) 1013 while (!parent.isNull() && parent.accessibilityIsIgnored())
933 parent = parent.parentObject(); 1014 parent = parent.parentObject();
934 return parent.equals(ancestor); 1015 return parent.equals(ancestor);
935 } 1016 }
936 1017
937 } // namespace webkit_glue 1018 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/glue/webaccessibility.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698