OLD | NEW |
---|---|
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 "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" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec t.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec t.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityRole. h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityRole. h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAttribute.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAttribute.h" |
jamesr
2012/04/20 21:06:33
delete this #include too if it's unused
dmazzoni
2012/04/20 21:10:22
Done.
| |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocumentType.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocumentType.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement .h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement .h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" |
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNamedNodeMap.h" | |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" |
23 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" |
24 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" |
25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
26 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" |
27 | 26 |
28 using base::DoubleToString; | 27 using base::DoubleToString; |
29 using base::IntToString; | 28 using base::IntToString; |
30 using WebKit::WebAccessibilityRole; | 29 using WebKit::WebAccessibilityRole; |
31 using WebKit::WebAccessibilityObject; | 30 using WebKit::WebAccessibilityObject; |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
750 | 749 |
751 if (!node.isNull() && node.isElementNode()) { | 750 if (!node.isNull() && node.isElementNode()) { |
752 WebKit::WebElement element = node.to<WebKit::WebElement>(); | 751 WebKit::WebElement element = node.to<WebKit::WebElement>(); |
753 is_iframe = (element.tagName() == ASCIIToUTF16("IFRAME")); | 752 is_iframe = (element.tagName() == ASCIIToUTF16("IFRAME")); |
754 | 753 |
755 // TODO(ctguil): The tagName in WebKit is lower cased but | 754 // TODO(ctguil): The tagName in WebKit is lower cased but |
756 // HTMLElement::nodeName calls localNameUpper. Consider adding | 755 // HTMLElement::nodeName calls localNameUpper. Consider adding |
757 // a WebElement method that returns the original lower cased tagName. | 756 // a WebElement method that returns the original lower cased tagName. |
758 string_attributes[ATTR_HTML_TAG] = | 757 string_attributes[ATTR_HTML_TAG] = |
759 StringToLowerASCII(string16(element.tagName())); | 758 StringToLowerASCII(string16(element.tagName())); |
760 for (unsigned i = 0; i < element.attributes().length(); ++i) { | 759 for (unsigned i = 0; i < element.attributeCount(); ++i) { |
761 string16 name = StringToLowerASCII(string16( | 760 string16 name = StringToLowerASCII(string16( |
762 element.attributes().attributeItem(i).localName())); | 761 element.attributeLocalName(i))); |
763 string16 value = element.attributes().attributeItem(i).value(); | 762 string16 value = element.attributeValue(i); |
764 html_attributes.push_back(std::pair<string16, string16>(name, value)); | 763 html_attributes.push_back(std::pair<string16, string16>(name, value)); |
765 } | 764 } |
766 | 765 |
767 if (role == ROLE_EDITABLE_TEXT || | 766 if (role == ROLE_EDITABLE_TEXT || |
768 role == ROLE_TEXTAREA || | 767 role == ROLE_TEXTAREA || |
769 role == ROLE_TEXT_FIELD) { | 768 role == ROLE_TEXT_FIELD) { |
770 // Jaws gets confused by children of text fields, so we ignore them. | 769 // Jaws gets confused by children of text fields, so we ignore them. |
771 include_children = false; | 770 include_children = false; |
772 | 771 |
773 int_attributes[ATTR_TEXT_SEL_START] = src.selectionStart(); | 772 int_attributes[ATTR_TEXT_SEL_START] = src.selectionStart(); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
954 bool WebAccessibility::IsParentUnignoredOf( | 953 bool WebAccessibility::IsParentUnignoredOf( |
955 const WebKit::WebAccessibilityObject& ancestor, | 954 const WebKit::WebAccessibilityObject& ancestor, |
956 const WebKit::WebAccessibilityObject& child) { | 955 const WebKit::WebAccessibilityObject& child) { |
957 WebKit::WebAccessibilityObject parent = child.parentObject(); | 956 WebKit::WebAccessibilityObject parent = child.parentObject(); |
958 while (!parent.isNull() && parent.accessibilityIsIgnored()) | 957 while (!parent.isNull() && parent.accessibilityIsIgnored()) |
959 parent = parent.parentObject(); | 958 parent = parent.parentObject(); |
960 return parent.equals(ancestor); | 959 return parent.equals(ancestor); |
961 } | 960 } |
962 | 961 |
963 } // namespace webkit_glue | 962 } // namespace webkit_glue |
OLD | NEW |