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" |
(...skipping 22 matching lines...) Expand all Loading... |
33 namespace content { | 33 namespace content { |
34 | 34 |
35 RendererAccessibilityComplete::RendererAccessibilityComplete( | 35 RendererAccessibilityComplete::RendererAccessibilityComplete( |
36 RenderFrameImpl* render_frame) | 36 RenderFrameImpl* render_frame) |
37 : RendererAccessibility(render_frame), | 37 : RendererAccessibility(render_frame), |
38 weak_factory_(this), | 38 weak_factory_(this), |
39 tree_source_(render_frame), | 39 tree_source_(render_frame), |
40 serializer_(&tree_source_), | 40 serializer_(&tree_source_), |
41 last_scroll_offset_(gfx::Size()), | 41 last_scroll_offset_(gfx::Size()), |
42 ack_pending_(false) { | 42 ack_pending_(false) { |
43 WebAXObject::enableAccessibility(); | |
44 WebView* web_view = render_frame_->GetRenderView()->GetWebView(); | 43 WebView* web_view = render_frame_->GetRenderView()->GetWebView(); |
45 WebSettings* settings = web_view->settings(); | 44 WebSettings* settings = web_view->settings(); |
46 settings->setAccessibilityEnabled(true); | 45 settings->setAccessibilityEnabled(true); |
47 | 46 |
48 #if !defined(OS_ANDROID) | 47 #if !defined(OS_ANDROID) |
49 // Skip inline text boxes on Android - since there are no native Android | 48 // Skip inline text boxes on Android - since there are no native Android |
50 // APIs that compute the bounds of a range of text, it's a waste to | 49 // APIs that compute the bounds of a range of text, it's a waste to |
51 // include these in the AX tree. | 50 // include these in the AX tree. |
52 WebAXObject::enableInlineTextBoxAccessibility(); | |
53 settings->setInlineTextBoxAccessibilityEnabled(true); | 51 settings->setInlineTextBoxAccessibilityEnabled(true); |
54 #endif | 52 #endif |
55 | 53 |
56 const WebDocument& document = GetMainDocument(); | 54 const WebDocument& document = GetMainDocument(); |
57 if (!document.isNull()) { | 55 if (!document.isNull()) { |
58 // 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 |
59 // accessibility being enabled. Initialize the browser's cached | 57 // accessibility being enabled. Initialize the browser's cached |
60 // accessibility tree by sending it a notification. | 58 // accessibility tree by sending it a notification. |
61 HandleAXEvent(document.accessibilityObject(), | 59 HandleAXEvent(document.accessibilityObject(), |
62 ui::AX_EVENT_LAYOUT_COMPLETE); | 60 ui::AX_EVENT_LAYOUT_COMPLETE); |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 render_frame_->GetRenderView()->GetWebView()->clearFocusedElement(); | 409 render_frame_->GetRenderView()->GetWebView()->clearFocusedElement(); |
412 else | 410 else |
413 obj.setFocused(true); | 411 obj.setFocused(true); |
414 } | 412 } |
415 | 413 |
416 void RendererAccessibilityComplete::OnFatalError() { | 414 void RendererAccessibilityComplete::OnFatalError() { |
417 CHECK(false) << "Invalid accessibility tree."; | 415 CHECK(false) << "Invalid accessibility tree."; |
418 } | 416 } |
419 | 417 |
420 } // namespace content | 418 } // namespace content |
OLD | NEW |