Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3222)

Unified Diff: chrome/browser/renderer_host/render_widget_host_view_win.cc

Issue 6995126: Make web content accessibility tree a descendant of main window's tree again (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_host/render_widget_host_view_win.cc
===================================================================
--- chrome/browser/renderer_host/render_widget_host_view_win.cc (revision 88807)
+++ chrome/browser/renderer_host/render_widget_host_view_win.cc (working copy)
@@ -508,13 +508,6 @@
SetParent(parent_hwnd_);
ShowWindow(SW_SHOW);
- // Save away our HWND in the parent window as a property so that the
- // accessibility code can find it.
- accessibility_prop_.reset(new ViewProp(
- GetParent(),
- views::kViewsNativeHostPropForAccessibility,
- m_hWnd));
-
DidBecomeSelected();
}
@@ -525,8 +518,6 @@
return;
}
- accessibility_prop_.reset();
-
if (::GetFocus() == m_hWnd)
::SetFocus(NULL);
ShowWindow(SW_HIDE);
@@ -786,12 +777,6 @@
props_.push_back(views::SetWindowSupportsRerouteMouseWheel(m_hWnd));
props_.push_back(new ViewProp(m_hWnd, kRenderWidgetHostViewKey,
static_cast<RenderWidgetHostView*>(this)));
- // Save away our HWND in the parent window as a property so that the
- // accessibility code can find it.
- accessibility_prop_.reset(new ViewProp(
- GetParent(),
- views::kViewsNativeHostPropForAccessibility,
- m_hWnd));
return 0;
}
@@ -1627,6 +1612,24 @@
render_widget_host_->routing_id(), acc_obj_id));
}
+IAccessible* RenderWidgetHostViewWin::GetIAccessible() {
+ if (render_widget_host_ && !render_widget_host_->renderer_accessible()) {
+ // Attempt to detect screen readers by sending an event with our custom id.
+ NotifyWinEvent(EVENT_SYSTEM_ALERT, m_hWnd, kIdCustom, CHILDID_SELF);
+ }
+
+ if (!browser_accessibility_manager_.get()) {
+ // 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(
+ BrowserAccessibilityManager::Create(m_hWnd, loading_tree, this));
+ }
+
+ return browser_accessibility_manager_->GetRoot()->toBrowserAccessibilityWin();
+}
+
LRESULT RenderWidgetHostViewWin::OnGetObject(UINT message, WPARAM wparam,
LPARAM lparam, BOOL& handled) {
if (kIdCustom == lparam) {
@@ -1644,25 +1647,10 @@
return static_cast<LRESULT>(0L);
}
- if (render_widget_host_ && !render_widget_host_->renderer_accessible()) {
- // Attempt to detect screen readers by sending an event with our custom id.
- NotifyWinEvent(EVENT_SYSTEM_ALERT, m_hWnd, kIdCustom, CHILDID_SELF);
- }
+ IAccessible* iaccessible = GetIAccessible();
+ if (iaccessible)
+ return LresultFromObject(IID_IAccessible, wparam, iaccessible);
- if (!browser_accessibility_manager_.get()) {
- // 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(
- BrowserAccessibilityManager::Create(m_hWnd, loading_tree, this));
- }
-
- base::win::ScopedComPtr<IAccessible> root(
- browser_accessibility_manager_->GetRoot()->toBrowserAccessibilityWin());
- if (root.get())
- return LresultFromObject(IID_IAccessible, wparam, root.Detach());
-
handled = false;
return static_cast<LRESULT>(0L);
}

Powered by Google App Engine
This is Rietveld 408576698