OLD | NEW |
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" |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 // a WebElement method that returns the original lower cased tagName. | 813 // a WebElement method that returns the original lower cased tagName. |
814 string_attributes[ATTR_HTML_TAG] = | 814 string_attributes[ATTR_HTML_TAG] = |
815 StringToLowerASCII(string16(element.tagName())); | 815 StringToLowerASCII(string16(element.tagName())); |
816 for (unsigned i = 0; i < element.attributes().length(); ++i) { | 816 for (unsigned i = 0; i < element.attributes().length(); ++i) { |
817 string16 name = StringToLowerASCII(string16( | 817 string16 name = StringToLowerASCII(string16( |
818 element.attributes().attributeItem(i).localName())); | 818 element.attributes().attributeItem(i).localName())); |
819 string16 value = element.attributes().attributeItem(i).value(); | 819 string16 value = element.attributes().attributeItem(i).value(); |
820 html_attributes.push_back(std::pair<string16, string16>(name, value)); | 820 html_attributes.push_back(std::pair<string16, string16>(name, value)); |
821 } | 821 } |
822 | 822 |
823 if (element.isFormControlElement()) { | 823 if (role == ROLE_EDITABLE_TEXT || |
824 WebKit::WebFormControlElement form_element = | 824 role == ROLE_TEXTAREA || |
825 element.to<WebKit::WebFormControlElement>(); | 825 role == ROLE_TEXT_FIELD) { |
826 if (form_element.formControlType() == ASCIIToUTF16("text") || | 826 // Jaws gets confused by children of text fields, so we ignore them. |
827 form_element.formControlType() == ASCIIToUTF16("textarea")) { | 827 include_children = false; |
828 // Jaws gets confused by children of text fields, so we ignore them. | |
829 include_children = false; | |
830 | 828 |
831 int_attributes[ATTR_TEXT_SEL_START] = src.selectionStart(); | 829 int_attributes[ATTR_TEXT_SEL_START] = src.selectionStart(); |
832 int_attributes[ATTR_TEXT_SEL_END] = src.selectionEnd(); | 830 int_attributes[ATTR_TEXT_SEL_END] = src.selectionEnd(); |
833 WebKit::WebVector<int> src_line_breaks; | 831 WebKit::WebVector<int> src_line_breaks; |
834 src.lineBreaks(src_line_breaks); | 832 src.lineBreaks(src_line_breaks); |
835 line_breaks.reserve(src_line_breaks.size()); | 833 line_breaks.reserve(src_line_breaks.size()); |
836 for (size_t i = 0; i < src_line_breaks.size(); ++i) | 834 for (size_t i = 0; i < src_line_breaks.size(); ++i) |
837 line_breaks.push_back(src_line_breaks[i]); | 835 line_breaks.push_back(src_line_breaks[i]); |
838 } | |
839 } | 836 } |
840 | 837 |
841 // ARIA role. | 838 // ARIA role. |
842 if (element.hasAttribute("role")) { | 839 if (element.hasAttribute("role")) { |
843 string_attributes[ATTR_ROLE] = element.getAttribute("role"); | 840 string_attributes[ATTR_ROLE] = element.getAttribute("role"); |
844 } | 841 } |
845 | 842 |
846 // Live region attributes | 843 // Live region attributes |
847 if (element.hasAttribute("aria-atomic")) { | 844 if (element.hasAttribute("aria-atomic")) { |
848 bool_attributes[ATTR_LIVE_ATOMIC] = | 845 bool_attributes[ATTR_LIVE_ATOMIC] = |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 bool WebAccessibility::IsParentUnignoredOf( | 1002 bool WebAccessibility::IsParentUnignoredOf( |
1006 const WebKit::WebAccessibilityObject& ancestor, | 1003 const WebKit::WebAccessibilityObject& ancestor, |
1007 const WebKit::WebAccessibilityObject& child) { | 1004 const WebKit::WebAccessibilityObject& child) { |
1008 WebKit::WebAccessibilityObject parent = child.parentObject(); | 1005 WebKit::WebAccessibilityObject parent = child.parentObject(); |
1009 while (!parent.isNull() && parent.accessibilityIsIgnored()) | 1006 while (!parent.isNull() && parent.accessibilityIsIgnored()) |
1010 parent = parent.parentObject(); | 1007 parent = parent.parentObject(); |
1011 return parent.equals(ancestor); | 1008 return parent.equals(ancestor); |
1012 } | 1009 } |
1013 | 1010 |
1014 } // namespace webkit_glue | 1011 } // namespace webkit_glue |
OLD | NEW |