OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/string_util.h" |
7 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityCache.h" | 8 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityCache.h" |
8 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h" | 9 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h" |
9 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityRole.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityRole.h" |
10 #include "third_party/WebKit/WebKit/chromium/public/WebAttribute.h" | 11 #include "third_party/WebKit/WebKit/chromium/public/WebAttribute.h" |
11 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" | 12 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" |
12 #include "third_party/WebKit/WebKit/chromium/public/WebDocumentType.h" | 13 #include "third_party/WebKit/WebKit/chromium/public/WebDocumentType.h" |
13 #include "third_party/WebKit/WebKit/chromium/public/WebElement.h" | 14 #include "third_party/WebKit/WebKit/chromium/public/WebElement.h" |
14 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" | 15 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
15 #include "third_party/WebKit/WebKit/chromium/public/WebNamedNodeMap.h" | 16 #include "third_party/WebKit/WebKit/chromium/public/WebNamedNodeMap.h" |
16 #include "third_party/WebKit/WebKit/chromium/public/WebNode.h" | 17 #include "third_party/WebKit/WebKit/chromium/public/WebNode.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 attributes[ATTR_HELP] = src.helpText(); | 296 attributes[ATTR_HELP] = src.helpText(); |
296 if (src.keyboardShortcut().length()) | 297 if (src.keyboardShortcut().length()) |
297 attributes[ATTR_SHORTCUT] = src.keyboardShortcut(); | 298 attributes[ATTR_SHORTCUT] = src.keyboardShortcut(); |
298 if (src.hasComputedStyle()) | 299 if (src.hasComputedStyle()) |
299 attributes[ATTR_DISPLAY] = src.computedStyleDisplay(); | 300 attributes[ATTR_DISPLAY] = src.computedStyleDisplay(); |
300 | 301 |
301 WebKit::WebNode node = src.node(); | 302 WebKit::WebNode node = src.node(); |
302 | 303 |
303 if (!node.isNull() && node.isElementNode()) { | 304 if (!node.isNull() && node.isElementNode()) { |
304 WebKit::WebElement element = node.to<WebKit::WebElement>(); | 305 WebKit::WebElement element = node.to<WebKit::WebElement>(); |
305 attributes[ATTR_HTML_TAG] = element.tagName(); | 306 // TODO(ctguil): The tagName in WebKit is lower cased but |
| 307 // HTMLElement::nodeName calls localNameUpper. Consider adding |
| 308 // a WebElement method that returns the original lower cased tagName. |
| 309 attributes[ATTR_HTML_TAG] = StringToLowerASCII(string16(element.tagName())); |
306 for (unsigned i = 0; i < element.attributes().length(); i++) { | 310 for (unsigned i = 0; i < element.attributes().length(); i++) { |
307 html_attributes.push_back( | 311 html_attributes.push_back( |
308 std::pair<string16, string16>( | 312 std::pair<string16, string16>( |
309 element.attributes().attributeItem(i).localName(), | 313 element.attributes().attributeItem(i).localName(), |
310 element.attributes().attributeItem(i).value())); | 314 element.attributes().attributeItem(i).value())); |
311 } | 315 } |
312 } | 316 } |
313 | 317 |
314 if (role == WebAccessibility::ROLE_DOCUMENT || | 318 if (role == WebAccessibility::ROLE_DOCUMENT || |
315 role == WebAccessibility::ROLE_WEB_AREA) { | 319 role == WebAccessibility::ROLE_WEB_AREA) { |
(...skipping 23 matching lines...) Expand all Loading... |
339 // The child may be invalid due to issues in webkit accessibility code. | 343 // The child may be invalid due to issues in webkit accessibility code. |
340 // Don't add children are invalid thus preventing a crash. | 344 // Don't add children are invalid thus preventing a crash. |
341 // https://bugs.webkit.org/show_bug.cgi?id=44149 | 345 // https://bugs.webkit.org/show_bug.cgi?id=44149 |
342 // TODO(ctguil): We may want to remove this check as webkit stabilizes. | 346 // TODO(ctguil): We may want to remove this check as webkit stabilizes. |
343 if (child.isValid()) | 347 if (child.isValid()) |
344 children.push_back(WebAccessibility(child, cache)); | 348 children.push_back(WebAccessibility(child, cache)); |
345 } | 349 } |
346 } | 350 } |
347 | 351 |
348 } // namespace webkit_glue | 352 } // namespace webkit_glue |
OLD | NEW |