OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_tree_source.h" | 5 #include "content/renderer/accessibility/blink_ax_tree_source.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 | 426 |
427 if (src.canSetValueAttribute()) | 427 if (src.canSetValueAttribute()) |
428 dst->AddBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE, true); | 428 dst->AddBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE, true); |
429 | 429 |
430 if (!src.url().isEmpty()) | 430 if (!src.url().isEmpty()) |
431 dst->AddStringAttribute(ui::AX_ATTR_URL, src.url().string().utf8()); | 431 dst->AddStringAttribute(ui::AX_ATTR_URL, src.url().string().utf8()); |
432 | 432 |
433 // The following set of attributes are only accessed when the accessibility | 433 // The following set of attributes are only accessed when the accessibility |
434 // mode is set to screen reader mode, otherwise only the more basic | 434 // mode is set to screen reader mode, otherwise only the more basic |
435 // attributes are populated. | 435 // attributes are populated. |
436 if (accessibility_mode_ & ACCESSIBILITY_MODE_FLAG_SCREEN_READER) { | 436 if (accessibility_mode_.has_mode(AccessibilityMode::kScreenReader)) { |
437 blink::WebString web_placeholder = src.placeholder(nameFrom); | 437 blink::WebString web_placeholder = src.placeholder(nameFrom); |
438 if (!web_placeholder.isEmpty()) | 438 if (!web_placeholder.isEmpty()) |
439 dst->AddStringAttribute(ui::AX_ATTR_PLACEHOLDER, web_placeholder.utf8()); | 439 dst->AddStringAttribute(ui::AX_ATTR_PLACEHOLDER, web_placeholder.utf8()); |
440 | 440 |
441 if (dst->role == ui::AX_ROLE_COLOR_WELL) | 441 if (dst->role == ui::AX_ROLE_COLOR_WELL) |
442 dst->AddIntAttribute(ui::AX_ATTR_COLOR_VALUE, src.colorValue()); | 442 dst->AddIntAttribute(ui::AX_ATTR_COLOR_VALUE, src.colorValue()); |
443 | 443 |
444 // Text attributes. | 444 // Text attributes. |
445 if (src.backgroundColor()) | 445 if (src.backgroundColor()) |
446 dst->AddIntAttribute(ui::AX_ATTR_BACKGROUND_COLOR, src.backgroundColor()); | 446 dst->AddIntAttribute(ui::AX_ATTR_BACKGROUND_COLOR, src.backgroundColor()); |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 // The majority of the rest of this code computes attributes needed for | 743 // The majority of the rest of this code computes attributes needed for |
744 // all modes, not just for screen readers. | 744 // all modes, not just for screen readers. |
745 | 745 |
746 WebNode node = src.node(); | 746 WebNode node = src.node(); |
747 bool is_iframe = false; | 747 bool is_iframe = false; |
748 | 748 |
749 if (!node.isNull() && node.isElementNode()) { | 749 if (!node.isNull() && node.isElementNode()) { |
750 WebElement element = node.to<WebElement>(); | 750 WebElement element = node.to<WebElement>(); |
751 is_iframe = element.hasHTMLTagName("iframe"); | 751 is_iframe = element.hasHTMLTagName("iframe"); |
752 | 752 |
753 if (accessibility_mode_ & ACCESSIBILITY_MODE_FLAG_HTML) { | 753 if (accessibility_mode_.has_mode(AccessibilityMode::kHTML)) { |
754 // TODO(ctguil): The tagName in WebKit is lower cased but | 754 // TODO(ctguil): The tagName in WebKit is lower cased but |
755 // HTMLElement::nodeName calls localNameUpper. Consider adding | 755 // HTMLElement::nodeName calls localNameUpper. Consider adding |
756 // a WebElement method that returns the original lower cased tagName. | 756 // a WebElement method that returns the original lower cased tagName. |
757 dst->AddStringAttribute( | 757 dst->AddStringAttribute( |
758 ui::AX_ATTR_HTML_TAG, | 758 ui::AX_ATTR_HTML_TAG, |
759 base::ToLowerASCII(element.tagName().utf8())); | 759 base::ToLowerASCII(element.tagName().utf8())); |
760 for (unsigned i = 0; i < element.attributeCount(); ++i) { | 760 for (unsigned i = 0; i < element.attributeCount(); ++i) { |
761 std::string name = base::ToLowerASCII( | 761 std::string name = base::ToLowerASCII( |
762 element.attributeLocalName(i).utf8()); | 762 element.attributeLocalName(i).utf8()); |
763 std::string value = element.attributeValue(i).utf8(); | 763 std::string value = element.attributeValue(i).utf8(); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 return WebAXObject(); | 861 return WebAXObject(); |
862 | 862 |
863 WebDocument document = render_frame_->GetWebFrame()->document(); | 863 WebDocument document = render_frame_->GetWebFrame()->document(); |
864 if (!document.isNull()) | 864 if (!document.isNull()) |
865 return document.accessibilityObject(); | 865 return document.accessibilityObject(); |
866 | 866 |
867 return WebAXObject(); | 867 return WebAXObject(); |
868 } | 868 } |
869 | 869 |
870 } // namespace content | 870 } // namespace content |
OLD | NEW |