summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorzork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-07 00:39:41 +0000
committerzork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-07 00:39:41 +0000
commit2ee0e7564803f87b195d63c497a1101a2b29ab4f (patch)
tree0795001761a54463b710c58799cc41655dd842c0 /chrome/renderer
parent3a51cfdd1775075f13dab50f6d8a9cb04bd6beb9 (diff)
downloadchromium_src-2ee0e7564803f87b195d63c497a1101a2b29ab4f.zip
chromium_src-2ee0e7564803f87b195d63c497a1101a2b29ab4f.tar.gz
chromium_src-2ee0e7564803f87b195d63c497a1101a2b29ab4f.tar.bz2
Revert 46567 - 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 crossplatform 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 TBR=dmazzoni@chromium.org Review URL: http://codereview.chromium.org/2031004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46642 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/render_thread.h2
-rw-r--r--chrome/renderer/render_view.cc55
-rw-r--r--chrome/renderer/render_view.h10
3 files changed, 52 insertions, 15 deletions
diff --git a/chrome/renderer/render_thread.h b/chrome/renderer/render_thread.h
index f2ea2c3..680668c 100644
--- a/chrome/renderer/render_thread.h
+++ b/chrome/renderer/render_thread.h
@@ -261,8 +261,6 @@ class RenderThread : public RenderThreadBase,
void OnGpuChannelEstablished(const IPC::ChannelHandle& channel_handle);
- void OnGetAccessibilityTree();
-
// Gather usage statistics from the in-memory cache and inform our host.
// These functions should be call periodically so that the host can make
// decisions about how to allocation resources using current information.
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 339ae18..2aea82a 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -74,6 +74,7 @@
#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"
@@ -635,6 +636,9 @@ 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)
@@ -680,7 +684,6 @@ 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))
@@ -1331,10 +1334,14 @@ 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()) {
- accessibility_->clear();
+ // Remove accessibility info cache.
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
@@ -3904,16 +3911,46 @@ void RenderView::OnUpdateBrowserWindowId(int window_id) {
browser_window_id_ = window_id;
}
-void RenderView::OnGetAccessibilityTree() {
- if (accessibility_.get()) {
+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) {
accessibility_->clear();
+ return;
}
- accessibility_.reset(WebAccessibilityCache::create());
- accessibility_->initialize(webview());
- WebAccessibilityObject src_tree = webview()->accessibilityObject();
- webkit_glue::WebAccessibility dst_tree(src_tree, accessibility_.get());
- Send(new ViewHostMsg_AccessibilityTree(routing_id_, dst_tree));
+ accessibility_->remove(acc_obj_id);
+
+#else // defined(OS_WIN)
+ // TODO(port): accessibility not yet implemented
+ NOTIMPLEMENTED();
+#endif
}
void RenderView::OnGetAllSavableResourceLinksForCurrentPage(
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 0b4b2ab..bc68296 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -45,7 +45,6 @@
#include "gfx/rect.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h"
#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h"
#include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFrameClient.h"
@@ -497,8 +496,6 @@ class RenderView : public RenderWidget,
// UserScript::DOCUMENT_IDLE.
void OnUserScriptIdleTriggered(WebKit::WebFrame* frame);
- void OnGetAccessibilityTree();
-
#if defined(OS_MACOSX)
// Helper routines for GPU plugin support. Used by the
// WebPluginDelegateProxy, which has a pointer to the RenderView.
@@ -732,6 +729,10 @@ class RenderView : public RenderWidget,
void OnExecuteCode(const ViewMsg_ExecuteCode_Params& params);
void ExecuteCodeImpl(WebKit::WebFrame* frame,
const ViewMsg_ExecuteCode_Params& params);
+ void OnGetAccessibilityInfo(
+ const webkit_glue::WebAccessibility::InParams& in_params,
+ webkit_glue::WebAccessibility::OutParams* out_params);
+ void OnClearAccessibilityInfo(int acc_obj_id, bool clear_all);
void OnExtensionMessageInvoke(const std::string& function_name,
const ListValue& args,
@@ -1062,10 +1063,11 @@ class RenderView : public RenderWidget,
bool decrement_shared_popup_at_destruction_;
// TODO(port): revisit once we have accessibility
-
+#if defined(OS_WIN)
// Handles accessibility requests into the renderer side, as well as
// maintains the cache and other features of the accessibility tree.
scoped_ptr<WebKit::WebAccessibilityCache> accessibility_;
+#endif
// Resource message queue. Used to queue up resource IPCs if we need
// to wait for an ACK from the browser before proceeding.