diff options
author | ctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-28 19:42:11 +0000 |
---|---|---|
committer | ctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-28 19:42:11 +0000 |
commit | b55a0a0069b756e27ddf72672dccc7571277ba66 (patch) | |
tree | ef91a143648fac2da157cc31e0019842571402ea | |
parent | 1388f567ce007e1cd8da596bd6ff7ab4a5d42c36 (diff) | |
download | chromium_src-b55a0a0069b756e27ddf72672dccc7571277ba66.zip chromium_src-b55a0a0069b756e27ddf72672dccc7571277ba66.tar.gz chromium_src-b55a0a0069b756e27ddf72672dccc7571277ba66.tar.bz2 |
Revert 60832 - Ensure browser cache of the renderer tree contains an accessibility object before sending an accessibility notification.
I accidentally commit the wrong change.
BUG=46209
TEST=interative_ui_tests:AccessibilityWinBrowserTest.TestNotificationChildrenChanged2
Review URL: http://codereview.chromium.org/3506004
TBR=ctguil@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60833 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/accessibility_win_browsertest.cc | 37 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 18 |
2 files changed, 18 insertions, 37 deletions
diff --git a/chrome/browser/accessibility_win_browsertest.cc b/chrome/browser/accessibility_win_browsertest.cc index 4baf66f..68abd21 100644 --- a/chrome/browser/accessibility_win_browsertest.cc +++ b/chrome/browser/accessibility_win_browsertest.cc @@ -479,30 +479,31 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, } IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, - TestNotificationChildrenChanged2) { + TestNotificationFocusChanged) { // The role attribute causes the node to be in the accessibility tree. GURL tree_url( - "data:text/html,<div role=group style='visibility: hidden'>text" - "</div>"); + "data:text/html,<div role=group tabindex='-1'></div>"); browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED); GetRendererAccessible(); ui_test_utils::WaitForNotification( NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); - // Check the accessible tree of the browser. + // Check the browser's copy of the renderer accessibility tree. + AccessibleChecker div_checker(L"", L"div", L""); + div_checker.SetExpectedState( + STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_OFFSCREEN | STATE_SYSTEM_READONLY); AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); + document_checker.AppendExpectedChild(&div_checker); document_checker.CheckAccessible(GetRendererAccessible()); - // Change the children of the document body. - ExecuteScript(L"document.body.children[0].style.visibility='visible'"); + // Focus the div in the document + ExecuteScript(L"document.body.children[0].focus()"); ui_test_utils::WaitForNotification( NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); // Check that the accessibility tree of the browser has been updated. - AccessibleChecker static_text_checker(L"", ROLE_SYSTEM_TEXT, L"text"); - AccessibleChecker div_checker(L"", L"div", L""); - document_checker.AppendExpectedChild(&div_checker); - div_checker.AppendExpectedChild(&static_text_checker); + div_checker.SetExpectedState( + STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_READONLY | STATE_SYSTEM_FOCUSED); document_checker.CheckAccessible(GetRendererAccessible()); // TODO(ctguil): The renderer should notify the browser when focus is cleared. @@ -523,26 +524,24 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, // document_checker.CheckAccessible(GetRendererAccessible()); } +// http://crbug.com/46209 IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, - TestNotificationFocusChanged) { + DISABLED_TestNotificationChildrenChanged2) { // The role attribute causes the node to be in the accessibility tree. GURL tree_url( - "data:text/html,<div role=group tabindex='-1'></div>"); + "data:text/html,<div role=group style='visibility: hidden'>text" + "</div>"); browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED); GetRendererAccessible(); ui_test_utils::WaitForNotification( NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); - // Check the browser's copy of the renderer accessibility tree. - AccessibleChecker div_checker(L"", L"div", L""); - div_checker.SetExpectedState( - STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_OFFSCREEN | STATE_SYSTEM_READONLY); + // Check the accessible tree of the browser. AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); - document_checker.AppendExpectedChild(&div_checker); document_checker.CheckAccessible(GetRendererAccessible()); - // Focus the div in the document - ExecuteScript(L"document.body.children[0].focus()"); + // Change the children of the document body. + ExecuteScript(L"document.body.children[0].style.visibility='visible'"); ui_test_utils::WaitForNotification( NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 095c39f..02e67ea 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -5483,24 +5483,6 @@ void RenderView::postAccessibilityNotification( accessibility_->initialize(webview()); } - if (!accessibility_->isCached(obj)) { - // The browser doesn't know about objects that are not in the cache. Send a - // children change for the first accestor that actually is in the cache. - WebAccessibilityObject parent = obj; - while (parent.isValid() && !accessibility_->isCached(parent)) - parent = parent.parentObject(); - - DCHECK(parent.isValid() && accessibility_->isCached(parent)); - if (!parent.isValid()) - return; - postAccessibilityNotification( - parent, WebKit::WebAccessibilityNotificationChildrenChanged); - - // The parent's children change takes care of the child's children change. - if (notification == WebKit::WebAccessibilityNotificationChildrenChanged) - return; - } - // Add the accessibility object to our cache and ensure it's valid. if (accessibility_->addOrGetId(obj) < 0) return; |