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

Side by Side Diff: content/renderer/accessibility/blink_ax_enum_conversion.cc

Issue 1130733006: Adds color, font size, text direction and text styles to the accessibility tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt at exposing style info to the native APIs. Created 5 years, 7 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/renderer/accessibility/blink_ax_enum_conversion.h" 5 #include "content/renderer/accessibility/blink_ax_enum_conversion.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace content { 9 namespace content {
10 10
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 // We can't add an assertion here, that prevents us 386 // We can't add an assertion here, that prevents us
387 // from adding new event enums in Blink. 387 // from adding new event enums in Blink.
388 return ui::AX_EVENT_NONE; 388 return ui::AX_EVENT_NONE;
389 } 389 }
390 } 390 }
391 391
392 ui::AXTextDirection AXTextDirectionFromBlink( 392 ui::AXTextDirection AXTextDirectionFromBlink(
393 blink::WebAXTextDirection text_direction) { 393 blink::WebAXTextDirection text_direction) {
394 switch (text_direction) { 394 switch (text_direction) {
395 case blink::WebAXTextDirectionLR: 395 case blink::WebAXTextDirectionLR:
396 return ui::AX_TEXT_DIRECTION_LR; 396 return ui::AX_TEXT_DIRECTION_LTR;
397 case blink::WebAXTextDirectionRL: 397 case blink::WebAXTextDirectionRL:
398 return ui::AX_TEXT_DIRECTION_RL; 398 return ui::AX_TEXT_DIRECTION_RTL;
399 case blink::WebAXTextDirectionTB: 399 case blink::WebAXTextDirectionTB:
400 return ui::AX_TEXT_DIRECTION_TB; 400 return ui::AX_TEXT_DIRECTION_TTB;
401 case blink::WebAXTextDirectionBT: 401 case blink::WebAXTextDirectionBT:
402 return ui::AX_TEXT_DIRECTION_BT; 402 return ui::AX_TEXT_DIRECTION_BTT;
403 default: 403 default:
404 NOTREACHED(); 404 NOTREACHED();
405 } 405 }
406 406
407 return ui::AX_TEXT_DIRECTION_NONE; 407 return ui::AX_TEXT_DIRECTION_NONE;
408 } 408 }
409 409
410 ui::AXTextStyle AXTextStyleFromBlink(blink::WebAXTextStyle text_style) {
411 unsigned int browser_text_style = ui::AX_TEXT_STYLE_NONE;
412 if (text_style & blink::WebAXTextStyleBold)
413 browser_text_style |= ui::AX_TEXT_STYLE_BOLD;
414 if (text_style & blink::WebAXTextStyleItalic)
415 browser_text_style |= ui::AX_TEXT_STYLE_ITALIC;
416 if (text_style & blink::WebAXTextStyleUnderline)
417 browser_text_style |= ui::AX_TEXT_STYLE_UNDERLINE;
418 if (text_style & blink::WebAXTextStyleLineThrough)
419 browser_text_style |= ui::AX_TEXT_STYLE_LINE_THROUGH;
420 return static_cast<ui::AXTextStyle>(browser_text_style);
421 }
422
410 ui::AXInvalidState AXInvalidStateFromBlink( 423 ui::AXInvalidState AXInvalidStateFromBlink(
411 blink::WebAXInvalidState invalid_state) { 424 blink::WebAXInvalidState invalid_state) {
412 switch (invalid_state) { 425 switch (invalid_state) {
413 case blink::WebAXInvalidStateUndefined: 426 case blink::WebAXInvalidStateUndefined:
414 return ui::AX_INVALID_STATE_NONE; 427 return ui::AX_INVALID_STATE_NONE;
415 case blink::WebAXInvalidStateFalse: 428 case blink::WebAXInvalidStateFalse:
416 return ui::AX_INVALID_STATE_FALSE; 429 return ui::AX_INVALID_STATE_FALSE;
417 case blink::WebAXInvalidStateTrue: 430 case blink::WebAXInvalidStateTrue:
418 return ui::AX_INVALID_STATE_TRUE; 431 return ui::AX_INVALID_STATE_TRUE;
419 case blink::WebAXInvalidStateSpelling: 432 case blink::WebAXInvalidStateSpelling:
(...skipping 23 matching lines...) Expand all
443 case blink::WebAXSortDirectionOther: 456 case blink::WebAXSortDirectionOther:
444 return ui::AX_SORT_DIRECTION_OTHER; 457 return ui::AX_SORT_DIRECTION_OTHER;
445 default: 458 default:
446 NOTREACHED(); 459 NOTREACHED();
447 } 460 }
448 461
449 return ui::AX_SORT_DIRECTION_NONE; 462 return ui::AX_SORT_DIRECTION_NONE;
450 } 463 }
451 464
452 } // Namespace content. 465 } // Namespace content.
OLDNEW
« no previous file with comments | « content/renderer/accessibility/blink_ax_enum_conversion.h ('k') | content/renderer/accessibility/blink_ax_tree_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698