summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/render_view.cc
diff options
context:
space:
mode:
authordmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-10 19:35:42 +0000
committerdmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-10 19:35:42 +0000
commitfae40a39f0130ab17cb0de4c355341ddd4eb7a00 (patch)
tree67b4660db445dd55e68ef8fe61d2b79a43190ebf /chrome/renderer/render_view.cc
parent611b66af1e3a7d747033fa1bcc75506994f16ac5 (diff)
downloadchromium_src-fae40a39f0130ab17cb0de4c355341ddd4eb7a00.zip
chromium_src-fae40a39f0130ab17cb0de4c355341ddd4eb7a00.tar.gz
chromium_src-fae40a39f0130ab17cb0de4c355341ddd4eb7a00.tar.bz2
Reimplement accessibility of web content by caching the entire
accessibility tree in the browser process. Adds new RPCs for a browser tab to request accessibility info from a renderer; the renderer responds with a complete tree of accessibility metadata for the entire DOM, which is then cached in the RenderWidgetHostView. This part is cross-platform and will help with accessibility on both Windows and Mac OS X. For Windows, MSAA support for web content has been rewritten to use this new cache. Tested in JAWS and NVDA screen readers. Using Chrome with a screen reader is now fast and stable, unlike the previous implementation. However, note that most advanced functionality is still not supported, and much work remains to make Chrome work well with a screen reader. This is a necessary step to improve stability first. BUG=25564 BUG=13291 TEST=See http://codereview.chromium.org/1806001 Review URL: http://codereview.chromium.org/1637018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46842 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_view.cc')
-rw-r--r--chrome/renderer/render_view.cc55
1 files changed, 9 insertions, 46 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 9e23291..4671156 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -75,7 +75,6 @@
#include "skia/ext/image_operations.h"
#include "third_party/cld/encodings/compact_lang_det/win/cld_unicodetext.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/WebCString.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDataSource.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDevToolsAgent.h"
@@ -637,9 +636,6 @@ void RenderView::OnMessageReceived(const IPC::Message& message) {
ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks,
OnGetSerializedHtmlDataForCurrentPageWithLocalLinks)
IPC_MESSAGE_HANDLER(ViewMsg_GetApplicationInfo, OnGetApplicationInfo)
- IPC_MESSAGE_HANDLER(ViewMsg_GetAccessibilityInfo, OnGetAccessibilityInfo)
- IPC_MESSAGE_HANDLER(ViewMsg_ClearAccessibilityInfo,
- OnClearAccessibilityInfo)
IPC_MESSAGE_HANDLER(ViewMsg_ShouldClose, OnMsgShouldClose)
IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage)
IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged)
@@ -685,6 +681,7 @@ void RenderView::OnMessageReceived(const IPC::Message& message) {
OnCustomContextMenuAction)
IPC_MESSAGE_HANDLER(ViewMsg_TranslatePage, OnTranslatePage)
IPC_MESSAGE_HANDLER(ViewMsg_RevertTranslation, OnRevertTranslation)
+ IPC_MESSAGE_HANDLER(ViewMsg_GetAccessibilityTree, OnGetAccessibilityTree)
// Have the super handle all other messages.
IPC_MESSAGE_UNHANDLED(RenderWidget::OnMessageReceived(message))
@@ -1335,14 +1332,10 @@ void RenderView::UpdateURL(WebFrame* frame) {
// we don't want the transition type to persist. Just clear it.
navigation_state->set_transition_type(PageTransition::LINK);
-#if defined(OS_WIN)
if (accessibility_.get()) {
- // Remove accessibility info cache.
+ accessibility_->clear();
accessibility_.reset();
}
-#else
- // TODO(port): accessibility not yet implemented. See http://crbug.com/8288.
-#endif
}
// Tell the embedding application that the title of the active page has changed
@@ -3929,46 +3922,16 @@ void RenderView::OnUpdateBrowserWindowId(int window_id) {
browser_window_id_ = window_id;
}
-void RenderView::OnGetAccessibilityInfo(
- const webkit_glue::WebAccessibility::InParams& in_params,
- webkit_glue::WebAccessibility::OutParams* out_params) {
-#if defined(OS_WIN)
- if (!accessibility_.get()) {
- // TODO(dglazkov): Once implemented for all ports, remove lazy
- // instantiation of accessibility_.
- accessibility_.reset(WebAccessibilityCache::create());
- accessibility_->initialize(webview());
- }
-
- out_params->return_code =
- webkit_glue::WebAccessibility::GetAccObjInfo(accessibility_.get(),
- in_params,
- out_params);
-
-#else // defined(OS_WIN)
- // TODO(port): accessibility not yet implemented
- NOTIMPLEMENTED();
-#endif
-}
-
-void RenderView::OnClearAccessibilityInfo(int acc_obj_id, bool clear_all) {
-#if defined(OS_WIN)
- if (!accessibility_.get()) {
- // If accessibility is not activated, ignore clearing message.
- return;
- }
-
- if (clear_all) {
+void RenderView::OnGetAccessibilityTree() {
+ if (accessibility_.get()) {
accessibility_->clear();
- return;
}
+ accessibility_.reset(WebAccessibilityCache::create());
+ accessibility_->initialize(webview());
- accessibility_->remove(acc_obj_id);
-
-#else // defined(OS_WIN)
- // TODO(port): accessibility not yet implemented
- NOTIMPLEMENTED();
-#endif
+ WebAccessibilityObject src_tree = webview()->accessibilityObject();
+ webkit_glue::WebAccessibility dst_tree(src_tree, accessibility_.get());
+ Send(new ViewHostMsg_AccessibilityTree(routing_id_, dst_tree));
}
void RenderView::OnGetAllSavableResourceLinksForCurrentPage(