diff options
author | ctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-16 19:38:46 +0000 |
---|---|---|
committer | ctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-16 19:38:46 +0000 |
commit | 90db7d15b2e3b9be1e9d4131b32bf5616cf11d0f (patch) | |
tree | 4f09079f784cd84f41886bd180ad734392070ad4 /chrome | |
parent | b8b581deebbac10559c9eac7fed935897d0e243b (diff) | |
download | chromium_src-90db7d15b2e3b9be1e9d4131b32bf5616cf11d0f.zip chromium_src-90db7d15b2e3b9be1e9d4131b32bf5616cf11d0f.tar.gz chromium_src-90db7d15b2e3b9be1e9d4131b32bf5616cf11d0f.tar.bz2 |
Remove use of accessible prop service from render_widget_host_view_win.cc
BUG=none
TEST=interactive_iu_tests:AccessibilityWinBrowserTest.TestRendererAccessibilityTree
Review URL: http://codereview.chromium.org/3415008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59693 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
4 files changed, 25 insertions, 49 deletions
diff --git a/chrome/browser/accessibility_win_browsertest.cc b/chrome/browser/accessibility_win_browsertest.cc index 364113d..c1183fd 100644 --- a/chrome/browser/accessibility_win_browsertest.cc +++ b/chrome/browser/accessibility_win_browsertest.cc @@ -6,6 +6,7 @@ #include <vector> #include "base/scoped_comptr_win.h" +#include "chrome/browser/automation/ui_controls.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_window.h" #include "chrome/browser/renderer_host/render_view_host.h" @@ -50,6 +51,10 @@ void AccessibilityWinBrowserTest::SetUpInProcessBrowserTestFixture() { ::SendNotifyMessage( HWND_BROADCAST, WM_SETTINGCHANGE, SPI_GETSCREENREADER, 0); } + + // If the mouse happens to be on the document then it will have the unexpected + // STATE_SYSTEM_HOTTRACKED state. Move it to a non-document location. + ui_controls::SendMouseMove(0, 0); } void AccessibilityWinBrowserTest::TearDownInProcessBrowserTestFixture() { @@ -344,19 +349,17 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, // The initial accessible returned should have state STATE_SYSTEM_BUSY while // the accessibility tree is being requested from the renderer. AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); - document_checker.SetExpectedState(STATE_SYSTEM_BUSY); + document_checker.SetExpectedState( + STATE_SYSTEM_READONLY | STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_FOCUSED | + STATE_SYSTEM_BUSY); document_checker.CheckAccessible(GetRendererAccessible()); - // Wait for the initial accessibility tree to load. + // Wait for the initial accessibility tree to load. Busy state should clear. ui_test_utils::WaitForNotification( NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); - - // TODO(ctguil): Fix: We should not be expecting busy state here. - if (0) { - // Run when above todo is fixed. - document_checker.SetExpectedState(0L); - document_checker.CheckAccessible(GetRendererAccessible()); - } + document_checker.SetExpectedState( + STATE_SYSTEM_READONLY | STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_FOCUSED); + document_checker.CheckAccessible(GetRendererAccessible()); GURL tree_url( "data:text/html,<html><head><title>Accessibility Win Test</title></head>" diff --git a/chrome/browser/browser_accessibility_win.cc b/chrome/browser/browser_accessibility_win.cc index adb539f..2c19deb 100644 --- a/chrome/browser/browser_accessibility_win.cc +++ b/chrome/browser/browser_accessibility_win.cc @@ -1106,6 +1106,8 @@ void BrowserAccessibility::InitRoleAndState(LONG web_role, state_ |= STATE_SYSTEM_READONLY; if ((web_state >> WebAccessibility::STATE_TRAVERSED) & 1) state_ |= STATE_SYSTEM_TRAVERSED; + if ((web_state >> WebAccessibility::STATE_BUSY) & 1) + state_ |= STATE_SYSTEM_BUSY; if ((web_state >> WebAccessibility::STATE_UNAVAILABLE) & 1) state_ |= STATE_SYSTEM_UNAVAILABLE; diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index 027f16f..a88ae19 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -1566,44 +1566,18 @@ LRESULT RenderWidgetHostViewWin::OnGetObject(UINT message, WPARAM wparam, if (!browser_accessibility_manager_.get()) { render_widget_host_->EnableRendererAccessibility(); - if (!loading_accessible_.get()) { - // Create IAccessible to return while waiting for the accessibility tree - // from the renderer. - HRESULT hr = ::CreateStdAccessibleObject( - m_hWnd, OBJID_CLIENT, IID_IAccessible, - reinterpret_cast<void **>(&loading_accessible_)); - - // Annotate with STATE_SYSTEM_BUSY to indicate that the page is loading. - // We annotate the HWND, not the loading_accessible IAccessible, but the - // IAccessible will reflect the state annotation. - ScopedComPtr<IAccPropServices> pAccPropServices; - hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER, - IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices)); - if (SUCCEEDED(hr)) { - VARIANT var; - var.vt = VT_I4; - var.lVal = STATE_SYSTEM_BUSY; - pAccPropServices->SetHwndProp( - m_hWnd, OBJID_CLIENT, CHILDID_SELF, PROPID_ACC_STATE, var); - - // Annotate with ROLE_SYSTEM_DOCUMENT, indicates page is a document. - var.lVal = ROLE_SYSTEM_DOCUMENT; - pAccPropServices->SetHwndProp( - m_hWnd, OBJID_CLIENT, CHILDID_SELF, PROPID_ACC_ROLE, var); - } - } + // Return busy document tree while renderer accessibility tree loads. + webkit_glue::WebAccessibility loading_tree; + loading_tree.role = WebAccessibility::ROLE_DOCUMENT; + loading_tree.state = (1 << WebAccessibility::STATE_BUSY); + browser_accessibility_manager_.reset( + new BrowserAccessibilityManager(m_hWnd, loading_tree, this)); + } - if (loading_accessible_.get()) { - return LresultFromObject( - IID_IAccessible, wparam, - static_cast<IAccessible*>(loading_accessible_)); - } - } else { - BrowserAccessibility* root = browser_accessibility_manager_->GetRoot(); - if (root) { - return LresultFromObject(IID_IAccessible, wparam, - static_cast<IAccessible*>(root->NewReference())); - } + BrowserAccessibility* root = browser_accessibility_manager_->GetRoot(); + if (root) { + return LresultFromObject(IID_IAccessible, wparam, + static_cast<IAccessible*>(root->NewReference())); } handled = false; diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.h b/chrome/browser/renderer_host/render_widget_host_view_win.h index 11ea7ee..8f00a38 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.h +++ b/chrome/browser/renderer_host/render_widget_host_view_win.h @@ -259,9 +259,6 @@ class RenderWidgetHostViewWin // Whether the window should be activated. bool IsActivatable() const; - // MSAA IAccessible returned while page contents is loading. - ScopedComPtr<IAccessible> loading_accessible_; - // The associated Model. RenderWidgetHost* render_widget_host_; |