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