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/WebFrame.h" |
16 #include "third_party/WebKit/public/web/WebInputElement.h" | 17 #include "third_party/WebKit/public/web/WebInputElement.h" |
17 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 18 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
18 #include "third_party/WebKit/public/web/WebNode.h" | 19 #include "third_party/WebKit/public/web/WebNode.h" |
| 20 #include "third_party/WebKit/public/web/WebSettings.h" |
19 #include "third_party/WebKit/public/web/WebView.h" | 21 #include "third_party/WebKit/public/web/WebView.h" |
20 #include "ui/accessibility/ax_tree.h" | 22 #include "ui/accessibility/ax_tree.h" |
21 | 23 |
22 using blink::WebAXObject; | 24 using blink::WebAXObject; |
23 using blink::WebDocument; | 25 using blink::WebDocument; |
| 26 using blink::WebFrame; |
24 using blink::WebNode; | 27 using blink::WebNode; |
25 using blink::WebPoint; | 28 using blink::WebPoint; |
26 using blink::WebRect; | 29 using blink::WebRect; |
| 30 using blink::WebSettings; |
27 using blink::WebView; | 31 using blink::WebView; |
28 | 32 |
29 namespace content { | 33 namespace content { |
30 | 34 |
31 RendererAccessibilityComplete::RendererAccessibilityComplete( | 35 RendererAccessibilityComplete::RendererAccessibilityComplete( |
32 RenderFrameImpl* render_frame) | 36 RenderFrameImpl* render_frame) |
33 : RendererAccessibility(render_frame), | 37 : RendererAccessibility(render_frame), |
34 weak_factory_(this), | 38 weak_factory_(this), |
35 tree_source_(render_frame), | 39 tree_source_(render_frame), |
36 serializer_(&tree_source_), | 40 serializer_(&tree_source_), |
37 last_scroll_offset_(gfx::Size()), | 41 last_scroll_offset_(gfx::Size()), |
38 ack_pending_(false) { | 42 ack_pending_(false) { |
39 WebAXObject::enableAccessibility(); | 43 WebAXObject::enableAccessibility(); |
| 44 WebView* web_view = render_frame_->GetRenderView()->GetWebView(); |
| 45 WebSettings* settings = web_view->settings(); |
| 46 settings->setAccessibilityEnabled(true); |
40 | 47 |
41 #if !defined(OS_ANDROID) | 48 #if !defined(OS_ANDROID) |
42 // Skip inline text boxes on Android - since there are no native Android | 49 // 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 | 50 // APIs that compute the bounds of a range of text, it's a waste to |
44 // include these in the AX tree. | 51 // include these in the AX tree. |
45 WebAXObject::enableInlineTextBoxAccessibility(); | 52 WebAXObject::enableInlineTextBoxAccessibility(); |
| 53 settings->setInlineTextBoxAccessibilityEnabled(true); |
46 #endif | 54 #endif |
47 | 55 |
48 const WebDocument& document = GetMainDocument(); | 56 const WebDocument& document = GetMainDocument(); |
49 if (!document.isNull()) { | 57 if (!document.isNull()) { |
50 // It's possible that the webview has already loaded a webpage without | 58 // It's possible that the webview has already loaded a webpage without |
51 // accessibility being enabled. Initialize the browser's cached | 59 // accessibility being enabled. Initialize the browser's cached |
52 // accessibility tree by sending it a notification. | 60 // accessibility tree by sending it a notification. |
53 HandleAXEvent(document.accessibilityObject(), | 61 HandleAXEvent(document.accessibilityObject(), |
54 ui::AX_EVENT_LAYOUT_COMPLETE); | 62 ui::AX_EVENT_LAYOUT_COMPLETE); |
55 } | 63 } |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 render_frame_->GetRenderView()->GetWebView()->clearFocusedElement(); | 411 render_frame_->GetRenderView()->GetWebView()->clearFocusedElement(); |
404 else | 412 else |
405 obj.setFocused(true); | 413 obj.setFocused(true); |
406 } | 414 } |
407 | 415 |
408 void RendererAccessibilityComplete::OnFatalError() { | 416 void RendererAccessibilityComplete::OnFatalError() { |
409 CHECK(false) << "Invalid accessibility tree."; | 417 CHECK(false) << "Invalid accessibility tree."; |
410 } | 418 } |
411 | 419 |
412 } // namespace content | 420 } // namespace content |
OLD | NEW |