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

Side by Side Diff: content/common/accessibility_node_data.cc

Issue 25943003: Support accessible inline text boxes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/common/accessibility_node_data.h" 5 #include "content/common/accessibility_node_data.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 void AccessibilityNodeData::AddIntListAttribute( 64 void AccessibilityNodeData::AddIntListAttribute(
65 IntListAttribute attribute, const std::vector<int32>& value) { 65 IntListAttribute attribute, const std::vector<int32>& value) {
66 intlist_attributes.push_back(std::make_pair(attribute, value)); 66 intlist_attributes.push_back(std::make_pair(attribute, value));
67 } 67 }
68 68
69 void AccessibilityNodeData::SetName(std::string name) { 69 void AccessibilityNodeData::SetName(std::string name) {
70 string_attributes.push_back(std::make_pair(ATTR_NAME, name)); 70 string_attributes.push_back(std::make_pair(ATTR_NAME, name));
71 } 71 }
72 72
73 void AccessibilityNodeData::SetValue(std::string value) {
74 string_attributes.push_back(std::make_pair(ATTR_VALUE, value));
75 }
76
73 AccessibilityNodeDataTreeNode::AccessibilityNodeDataTreeNode() 77 AccessibilityNodeDataTreeNode::AccessibilityNodeDataTreeNode()
74 : AccessibilityNodeData() { 78 : AccessibilityNodeData() {
75 } 79 }
76 80
77 AccessibilityNodeDataTreeNode::~AccessibilityNodeDataTreeNode() { 81 AccessibilityNodeDataTreeNode::~AccessibilityNodeDataTreeNode() {
78 } 82 }
79 83
80 AccessibilityNodeDataTreeNode& AccessibilityNodeDataTreeNode::operator=( 84 AccessibilityNodeDataTreeNode& AccessibilityNodeDataTreeNode::operator=(
81 const AccessibilityNodeData& src) { 85 const AccessibilityNodeData& src) {
82 AccessibilityNodeData::operator=(src); 86 AccessibilityNodeData::operator=(src);
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 break; 371 break;
368 case ATTR_COLOR_VALUE_RED: 372 case ATTR_COLOR_VALUE_RED:
369 result += " color_value_red=" + value; 373 result += " color_value_red=" + value;
370 break; 374 break;
371 case ATTR_COLOR_VALUE_GREEN: 375 case ATTR_COLOR_VALUE_GREEN:
372 result += " color_value_green=" + value; 376 result += " color_value_green=" + value;
373 break; 377 break;
374 case ATTR_COLOR_VALUE_BLUE: 378 case ATTR_COLOR_VALUE_BLUE:
375 result += " color_value_blue=" + value; 379 result += " color_value_blue=" + value;
376 break; 380 break;
381 case ATTR_TEXT_DIRECTION:
382 switch (value) {
383 case WebKit::WebAXTextDirectionLR:
384 default:
385 result += " text_direction=lr";
386 break;
387 case WebKit::WebAXTextDirectionRL:
388 result += " text_direction=rl";
389 break;
390 case WebKit::WebAXTextDirectionTB:
391 result += " text_direction=tb";
392 break;
393 case WebKit::WebAXTextDirectionBT:
394 result += " text_direction=bt";
395 break;
396 }
397 break;
377 } 398 }
378 } 399 }
379 400
380 for (size_t i = 0; i < string_attributes.size(); ++i) { 401 for (size_t i = 0; i < string_attributes.size(); ++i) {
381 std::string value = string_attributes[i].second; 402 std::string value = string_attributes[i].second;
382 switch (string_attributes[i].first) { 403 switch (string_attributes[i].first) {
383 case ATTR_DOC_URL: 404 case ATTR_DOC_URL:
384 result += " doc_url=" + value; 405 result += " doc_url=" + value;
385 break; 406 break;
386 case ATTR_DOC_TITLE: 407 case ATTR_DOC_TITLE:
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 break; 523 break;
503 case ATTR_LINE_BREAKS: 524 case ATTR_LINE_BREAKS:
504 result += " line_breaks=" + IntVectorToString(values); 525 result += " line_breaks=" + IntVectorToString(values);
505 break; 526 break;
506 case ATTR_CELL_IDS: 527 case ATTR_CELL_IDS:
507 result += " cell_ids=" + IntVectorToString(values); 528 result += " cell_ids=" + IntVectorToString(values);
508 break; 529 break;
509 case ATTR_UNIQUE_CELL_IDS: 530 case ATTR_UNIQUE_CELL_IDS:
510 result += " unique_cell_ids=" + IntVectorToString(values); 531 result += " unique_cell_ids=" + IntVectorToString(values);
511 break; 532 break;
533 case ATTR_CHARACTER_OFFSETS:
534 result += " character_offsets=" + IntVectorToString(values);
535 break;
536 case ATTR_WORD_STARTS:
537 result += " word_starts=" + IntVectorToString(values);
538 break;
539 case ATTR_WORD_ENDS:
540 result += " word_ends=" + IntVectorToString(values);
541 break;
512 } 542 }
513 } 543 }
514 544
515 if (!child_ids.empty()) 545 if (!child_ids.empty())
516 result += " child_ids=" + IntVectorToString(child_ids); 546 result += " child_ids=" + IntVectorToString(child_ids);
517 547
518 return result; 548 return result;
519 } 549 }
520 550
521 std::string AccessibilityNodeDataTreeNode::DebugString(bool recursive) const { 551 std::string AccessibilityNodeDataTreeNode::DebugString(bool recursive) const {
(...skipping 13 matching lines...) Expand all
535 result += children[i].DebugString(true); 565 result += children[i].DebugString(true);
536 --indent; 566 --indent;
537 } 567 }
538 568
539 return result; 569 return result;
540 } 570 }
541 571
542 #endif // ifndef NDEBUG 572 #endif // ifndef NDEBUG
543 573
544 } // namespace content 574 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698