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 WebView* web_view = render_frame_->GetRenderView()->GetWebView(); |
dmazzoni
2014/08/22 23:20:23
Why does test_runner call this on the WebFrame whi
aboxhall
2014/08/22 23:24:10
How do I get a reference to a WebFrame here?
dmazzoni
2014/08/22 23:31:22
render_frame->GetWebFrame()
| |
42 WebSettings* settings = web_view->settings(); | |
43 settings->setAccessibilityEnabled(true); | |
40 | 44 |
41 #if !defined(OS_ANDROID) | 45 #if !defined(OS_ANDROID) |
42 // Skip inline text boxes on Android - since there are no native Android | 46 // 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 | 47 // APIs that compute the bounds of a range of text, it's a waste to |
44 // include these in the AX tree. | 48 // include these in the AX tree. |
45 WebAXObject::enableInlineTextBoxAccessibility(); | 49 settings->setInlineTextBoxAccessibilityEnabled(true); |
46 #endif | 50 #endif |
47 | 51 |
48 const WebDocument& document = GetMainDocument(); | 52 const WebDocument& document = GetMainDocument(); |
49 if (!document.isNull()) { | 53 if (!document.isNull()) { |
50 // It's possible that the webview has already loaded a webpage without | 54 // It's possible that the webview has already loaded a webpage without |
51 // accessibility being enabled. Initialize the browser's cached | 55 // accessibility being enabled. Initialize the browser's cached |
52 // accessibility tree by sending it a notification. | 56 // accessibility tree by sending it a notification. |
53 HandleAXEvent(document.accessibilityObject(), | 57 HandleAXEvent(document.accessibilityObject(), |
54 ui::AX_EVENT_LAYOUT_COMPLETE); | 58 ui::AX_EVENT_LAYOUT_COMPLETE); |
55 } | 59 } |
(...skipping 347 matching lines...) Loading... | |
403 render_frame_->GetRenderView()->GetWebView()->clearFocusedElement(); | 407 render_frame_->GetRenderView()->GetWebView()->clearFocusedElement(); |
404 else | 408 else |
405 obj.setFocused(true); | 409 obj.setFocused(true); |
406 } | 410 } |
407 | 411 |
408 void RendererAccessibilityComplete::OnFatalError() { | 412 void RendererAccessibilityComplete::OnFatalError() { |
409 CHECK(false) << "Invalid accessibility tree."; | 413 CHECK(false) << "Invalid accessibility tree."; |
410 } | 414 } |
411 | 415 |
412 } // namespace content | 416 } // namespace content |
OLD | NEW |