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

Unified Diff: webkit/glue/chrome_client_impl.cc

Issue 115374: Adds propagation and handling of render-side focus events, for the benefit of... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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: webkit/glue/chrome_client_impl.cc
===================================================================
--- webkit/glue/chrome_client_impl.cc (revision 16095)
+++ webkit/glue/chrome_client_impl.cc (working copy)
@@ -7,8 +7,11 @@
#include "base/compiler_specific.h"
MSVC_PUSH_WARNING_LEVEL(0);
+#include "AccessibilityObject.h"
+#include "AXObjectCache.h"
#include "Console.h"
#include "Cursor.h"
+#include "Document.h"
#include "DocumentLoader.h"
#include "FloatRect.h"
#include "FileChooser.h"
@@ -16,6 +19,7 @@
#include "FrameView.h"
#include "HitTestResult.h"
#include "IntRect.h"
+#include "Node.h"
#include "Page.h"
#include "PopupMenuChromium.h"
#include "ScriptController.h"
@@ -29,7 +33,6 @@
#include "webkit/glue/chrome_client_impl.h"
-#include "base/logging.h"
#include "base/gfx/rect.h"
#include "googleurl/src/gurl.h"
#include "webkit/api/public/WebInputEvent.h"
@@ -141,6 +144,28 @@
WebViewDelegate* delegate = webview_->delegate();
if (delegate)
delegate->Focus(webview_);
+
+ // If accessibility is enabled, we should notify assistive technology that the
+ // active AccessibilityObject changed.
+ WebCore::Document* doc = webview_->GetFocusedWebCoreFrame()->document();
+
+ if (doc && doc->axObjectCache()->accessibilityEnabled()) {
+ WebCore::Node* focused_node = webview_->GetFocusedNode();
+
+ if (!focused_node) {
+ // Could not retrieve focused Node.
+ return;
+ }
+
+ // Retrieve the focused AccessibilityObject.
+ WebCore::AccessibilityObject* focused_acc_obj =
+ doc->axObjectCache()->getOrCreate(focused_node->renderer());
+
+ // Alert assistive technology that focus changed.
+ if (focused_acc_obj) {
+ delegate->FocusAccessibilityObject(focused_acc_obj);
+ }
+ }
}
void ChromeClientImpl::unfocus() {
@@ -201,7 +226,8 @@
if (input_event->type != WebInputEvent::MouseUp)
return false;
- const WebMouseEvent* mouse_event = static_cast<const WebMouseEvent*>(input_event);
+ const WebMouseEvent* mouse_event =
+ static_cast<const WebMouseEvent*>(input_event);
return (mouse_event->button == WebMouseEvent::ButtonMiddle);
}
@@ -294,7 +320,8 @@
}
WebDevToolsAgentImpl* devtools_agent = webview_->GetWebDevToolsAgentImpl();
if (devtools_agent) {
- devtools_agent->AddMessageToConsole(source, level, message, line_no, source_id);
+ devtools_agent->AddMessageToConsole(source, level, message, line_no,
+ source_id);
}
}

Powered by Google App Engine
This is Rietveld 408576698