Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/accessibility/renderer_accessibility_complete.h" | 5 #include "content/renderer/accessibility/renderer_accessibility_complete.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "content/renderer/accessibility/blink_ax_enum_conversion.h" | 11 #include "content/renderer/accessibility/blink_ax_enum_conversion.h" |
| 12 #include "content/renderer/render_frame_impl.h" | 12 #include "content/renderer/render_frame_impl.h" |
| 13 #include "content/renderer/render_view_impl.h" | 13 #include "content/renderer/render_view_impl.h" |
| 14 #include "third_party/WebKit/public/web/WebAXObject.h" | 14 #include "third_party/WebKit/public/web/WebAXObject.h" |
| 15 #include "third_party/WebKit/public/web/WebDocument.h" | 15 #include "third_party/WebKit/public/web/WebDocument.h" |
| 16 #include "third_party/WebKit/public/web/WebInputElement.h" | 16 #include "third_party/WebKit/public/web/WebInputElement.h" |
| 17 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 17 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 18 #include "third_party/WebKit/public/web/WebNode.h" | 18 #include "third_party/WebKit/public/web/WebNode.h" |
| 19 #include "third_party/WebKit/public/web/WebSettings.h" | |
| 19 #include "third_party/WebKit/public/web/WebView.h" | 20 #include "third_party/WebKit/public/web/WebView.h" |
| 20 #include "ui/accessibility/ax_tree.h" | 21 #include "ui/accessibility/ax_tree.h" |
| 21 | 22 |
| 22 using blink::WebAXObject; | 23 using blink::WebAXObject; |
| 23 using blink::WebDocument; | 24 using blink::WebDocument; |
| 24 using blink::WebNode; | 25 using blink::WebNode; |
| 25 using blink::WebPoint; | 26 using blink::WebPoint; |
| 26 using blink::WebRect; | 27 using blink::WebRect; |
| 28 using blink::WebSettings; | |
| 27 using blink::WebView; | 29 using blink::WebView; |
| 28 | 30 |
| 29 namespace content { | 31 namespace content { |
| 30 | 32 |
| 31 RendererAccessibilityComplete::RendererAccessibilityComplete( | 33 RendererAccessibilityComplete::RendererAccessibilityComplete( |
| 32 RenderFrameImpl* render_frame) | 34 RenderFrameImpl* render_frame) |
| 33 : RendererAccessibility(render_frame), | 35 : RendererAccessibility(render_frame), |
| 34 weak_factory_(this), | 36 weak_factory_(this), |
| 35 tree_source_(render_frame), | 37 tree_source_(render_frame), |
| 36 serializer_(&tree_source_), | 38 serializer_(&tree_source_), |
| 37 last_scroll_offset_(gfx::Size()), | 39 last_scroll_offset_(gfx::Size()), |
| 38 ack_pending_(false) { | 40 ack_pending_(false) { |
| 39 WebAXObject::enableAccessibility(); | 41 WebAXObject::enableAccessibility(); |
| 42 WebView* web_view = render_frame_->GetRenderView()->GetWebView(); | |
|
dmazzoni
2014/08/22 23:20:11
Wait - why does test_runner call this on the WebFr
aboxhall
2014/08/22 23:23:14
This doesn't have a WebFrame AFAIK. Am I missing s
| |
| 43 WebSettings* settings = web_view->settings(); | |
| 44 settings->setAccessibilityEnabled(true); | |
| 40 | 45 |
| 41 #if !defined(OS_ANDROID) | 46 #if !defined(OS_ANDROID) |
| 42 // Skip inline text boxes on Android - since there are no native Android | 47 // Skip inline text boxes on Android - since there are no native Android |
| 43 // APIs that compute the bounds of a range of text, it's a waste to | 48 // APIs that compute the bounds of a range of text, it's a waste to |
| 44 // include these in the AX tree. | 49 // include these in the AX tree. |
| 45 WebAXObject::enableInlineTextBoxAccessibility(); | 50 WebAXObject::enableInlineTextBoxAccessibility(); |
| 51 settings->setInlineTextBoxAccessibilityEnabled(true); | |
| 46 #endif | 52 #endif |
| 47 | 53 |
| 48 const WebDocument& document = GetMainDocument(); | 54 const WebDocument& document = GetMainDocument(); |
| 49 if (!document.isNull()) { | 55 if (!document.isNull()) { |
| 50 // It's possible that the webview has already loaded a webpage without | 56 // It's possible that the webview has already loaded a webpage without |
| 51 // accessibility being enabled. Initialize the browser's cached | 57 // accessibility being enabled. Initialize the browser's cached |
| 52 // accessibility tree by sending it a notification. | 58 // accessibility tree by sending it a notification. |
| 53 HandleAXEvent(document.accessibilityObject(), | 59 HandleAXEvent(document.accessibilityObject(), |
| 54 ui::AX_EVENT_LAYOUT_COMPLETE); | 60 ui::AX_EVENT_LAYOUT_COMPLETE); |
| 55 } | 61 } |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 403 render_frame_->GetRenderView()->GetWebView()->clearFocusedElement(); | 409 render_frame_->GetRenderView()->GetWebView()->clearFocusedElement(); |
| 404 else | 410 else |
| 405 obj.setFocused(true); | 411 obj.setFocused(true); |
| 406 } | 412 } |
| 407 | 413 |
| 408 void RendererAccessibilityComplete::OnFatalError() { | 414 void RendererAccessibilityComplete::OnFatalError() { |
| 409 CHECK(false) << "Invalid accessibility tree."; | 415 CHECK(false) << "Invalid accessibility tree."; |
| 410 } | 416 } |
| 411 | 417 |
| 412 } // namespace content | 418 } // namespace content |
| OLD | NEW |