OLD | NEW |
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 Loading... |
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 Loading... |
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. |
OLD | NEW |