summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-23 05:45:13 +0000
committerctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-23 05:45:13 +0000
commitfd63f8fddb02be680677289d22d4571fef5fe257 (patch)
treeb70ac7d2d3283a9be0e42cbbe894b9edf304ffc9
parent9d2951f6037aafcdae278d117b54027421937bac (diff)
downloadchromium_src-fd63f8fddb02be680677289d22d4571fef5fe257.zip
chromium_src-fd63f8fddb02be680677289d22d4571fef5fe257.tar.gz
chromium_src-fd63f8fddb02be680677289d22d4571fef5fe257.tar.bz2
Store lower case tag names within web accessibility.
This is similar to the behavior of firefox. BUG=none TEST=browser_tests:RendererAccessibilityBrowserTest.TestCrossPlatformAccessibilityTree TEST=interactive_ui_tests:AccessibilityWinBrowserTest.* Review URL: http://codereview.chromium.org/3435019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60259 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/accessibility_win_browsertest.cc10
-rw-r--r--chrome/browser/browser_accessibility_win.cc2
-rw-r--r--chrome/browser/renderer_host/test/renderer_accessibility_browsertest.cc6
-rw-r--r--webkit/glue/webaccessibility.cc6
4 files changed, 14 insertions, 10 deletions
diff --git a/chrome/browser/accessibility_win_browsertest.cc b/chrome/browser/accessibility_win_browsertest.cc
index d94246a..c66bf2f 100644
--- a/chrome/browser/accessibility_win_browsertest.cc
+++ b/chrome/browser/accessibility_win_browsertest.cc
@@ -347,7 +347,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest,
// Check the browser's copy of the renderer accessibility tree.
AccessibleChecker button_checker(L"push", ROLE_SYSTEM_PUSHBUTTON, L"push");
AccessibleChecker checkbox_checker(L"", ROLE_SYSTEM_CHECKBUTTON, L"");
- AccessibleChecker body_checker(L"", L"BODY", L"");
+ AccessibleChecker body_checker(L"", L"body", L"");
AccessibleChecker document2_checker(
L"Accessibility Win Test", ROLE_SYSTEM_DOCUMENT, L"");
body_checker.AppendExpectedChild(&button_checker);
@@ -387,7 +387,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest,
AccessibleChecker checkbox_checker(L"", ROLE_SYSTEM_CHECKBUTTON, L"");
checkbox_checker.SetExpectedState(
STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_READONLY);
- AccessibleChecker body_checker(L"", L"BODY", L"");
+ AccessibleChecker body_checker(L"", L"body", L"");
AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L"");
body_checker.AppendExpectedChild(&checkbox_checker);
document_checker.AppendExpectedChild(&body_checker);
@@ -415,7 +415,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest,
NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED);
// Check the browser's copy of the renderer accessibility tree.
- AccessibleChecker body_checker(L"", L"BODY", L"");
+ AccessibleChecker body_checker(L"", L"body", L"");
AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L"");
document_checker.AppendExpectedChild(&body_checker);
document_checker.CheckAccessible(GetRendererAccessible());
@@ -451,10 +451,10 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest,
// Check the browser's copy of the renderer accessibility tree.
AccessibleChecker static_text_checker(L"", ROLE_SYSTEM_TEXT, L"old value");
- AccessibleChecker text_field_div_checker(L"", L"DIV", L"");
+ AccessibleChecker text_field_div_checker(L"", L"div", L"");
AccessibleChecker text_field_checker(L"", ROLE_SYSTEM_TEXT, L"old value");
text_field_checker.SetExpectedState(STATE_SYSTEM_FOCUSABLE);
- AccessibleChecker body_checker(L"", L"BODY", L"");
+ AccessibleChecker body_checker(L"", L"body", L"");
AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L"");
text_field_div_checker.AppendExpectedChild(&static_text_checker);
text_field_checker.AppendExpectedChild(&text_field_div_checker);
diff --git a/chrome/browser/browser_accessibility_win.cc b/chrome/browser/browser_accessibility_win.cc
index 2c19deb..2b85fbc 100644
--- a/chrome/browser/browser_accessibility_win.cc
+++ b/chrome/browser/browser_accessibility_win.cc
@@ -1174,7 +1174,7 @@ void BrowserAccessibility::InitRoleAndState(LONG web_role,
case WebAccessibility::ROLE_GROUP:
GetAttribute(WebAccessibility::ATTR_HTML_TAG, &role_name_);
if (role_name_.empty())
- role_name_ = L"DIV";
+ role_name_ = L"div";
ia2_role_ = IA2_ROLE_SECTION;
break;
case WebAccessibility::ROLE_HEADING:
diff --git a/chrome/browser/renderer_host/test/renderer_accessibility_browsertest.cc b/chrome/browser/renderer_host/test/renderer_accessibility_browsertest.cc
index 6939dff..b12c6a7 100644
--- a/chrome/browser/renderer_host/test/renderer_accessibility_browsertest.cc
+++ b/chrome/browser/renderer_host/test/renderer_accessibility_browsertest.cc
@@ -106,7 +106,7 @@ IN_PROC_BROWSER_TEST_F(RendererAccessibilityBrowserTest,
ASSERT_EQ(1U, tree.children.size());
const WebAccessibility& body = tree.children[0];
EXPECT_EQ(WebAccessibility::ROLE_GROUP, body.role);
- EXPECT_STREQ("BODY", GetAttr(body, WebAccessibility::ATTR_HTML_TAG).c_str());
+ EXPECT_STREQ("body", GetAttr(body, WebAccessibility::ATTR_HTML_TAG).c_str());
EXPECT_STREQ("block", GetAttr(body, WebAccessibility::ATTR_DISPLAY).c_str());
// Check properties of the two children of the BODY element.
@@ -115,7 +115,7 @@ IN_PROC_BROWSER_TEST_F(RendererAccessibilityBrowserTest,
const WebAccessibility& button = body.children[0];
EXPECT_EQ(WebAccessibility::ROLE_BUTTON, button.role);
EXPECT_STREQ(
- "INPUT", GetAttr(button, WebAccessibility::ATTR_HTML_TAG).c_str());
+ "input", GetAttr(button, WebAccessibility::ATTR_HTML_TAG).c_str());
EXPECT_STREQ("push", UTF16ToUTF8(button.name).c_str());
EXPECT_STREQ(
"inline-block", GetAttr(button, WebAccessibility::ATTR_DISPLAY).c_str());
@@ -128,7 +128,7 @@ IN_PROC_BROWSER_TEST_F(RendererAccessibilityBrowserTest,
const WebAccessibility& checkbox = body.children[1];
EXPECT_EQ(WebAccessibility::ROLE_CHECKBOX, checkbox.role);
EXPECT_STREQ(
- "INPUT", GetAttr(checkbox, WebAccessibility::ATTR_HTML_TAG).c_str());
+ "input", GetAttr(checkbox, WebAccessibility::ATTR_HTML_TAG).c_str());
EXPECT_STREQ(
"inline-block",
GetAttr(checkbox, WebAccessibility::ATTR_DISPLAY).c_str());
diff --git a/webkit/glue/webaccessibility.cc b/webkit/glue/webaccessibility.cc
index 2e75f19..ecb7a25 100644
--- a/webkit/glue/webaccessibility.cc
+++ b/webkit/glue/webaccessibility.cc
@@ -4,6 +4,7 @@
#include "webkit/glue/webaccessibility.h"
+#include "base/string_util.h"
#include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityCache.h"
#include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h"
#include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityRole.h"
@@ -302,7 +303,10 @@ void WebAccessibility::Init(const WebKit::WebAccessibilityObject& src,
if (!node.isNull() && node.isElementNode()) {
WebKit::WebElement element = node.to<WebKit::WebElement>();
- attributes[ATTR_HTML_TAG] = element.tagName();
+ // TODO(ctguil): The tagName in WebKit is lower cased but
+ // HTMLElement::nodeName calls localNameUpper. Consider adding
+ // a WebElement method that returns the original lower cased tagName.
+ attributes[ATTR_HTML_TAG] = StringToLowerASCII(string16(element.tagName()));
for (unsigned i = 0; i < element.attributes().length(); i++) {
html_attributes.push_back(
std::pair<string16, string16>(