| 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_view_impl.h" | 13 #include "content/renderer/render_view_impl.h" |
| 13 #include "third_party/WebKit/public/web/WebAXObject.h" | 14 #include "third_party/WebKit/public/web/WebAXObject.h" |
| 14 #include "third_party/WebKit/public/web/WebDocument.h" | 15 #include "third_party/WebKit/public/web/WebDocument.h" |
| 15 #include "third_party/WebKit/public/web/WebInputElement.h" | 16 #include "third_party/WebKit/public/web/WebInputElement.h" |
| 16 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 17 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 17 #include "third_party/WebKit/public/web/WebNode.h" | 18 #include "third_party/WebKit/public/web/WebNode.h" |
| 18 #include "third_party/WebKit/public/web/WebView.h" | 19 #include "third_party/WebKit/public/web/WebView.h" |
| 19 #include "ui/accessibility/ax_tree.h" | 20 #include "ui/accessibility/ax_tree.h" |
| 20 | 21 |
| 21 using blink::WebAXObject; | 22 using blink::WebAXObject; |
| 22 using blink::WebDocument; | 23 using blink::WebDocument; |
| 23 using blink::WebNode; | 24 using blink::WebNode; |
| 24 using blink::WebPoint; | 25 using blink::WebPoint; |
| 25 using blink::WebRect; | 26 using blink::WebRect; |
| 26 using blink::WebSize; | 27 using blink::WebSize; |
| 27 using blink::WebView; | 28 using blink::WebView; |
| 28 | 29 |
| 29 namespace content { | 30 namespace content { |
| 30 | 31 |
| 31 RendererAccessibilityComplete::RendererAccessibilityComplete( | 32 RendererAccessibilityComplete::RendererAccessibilityComplete( |
| 32 RenderViewImpl* render_view) | 33 RenderFrameImpl* render_frame) |
| 33 : RendererAccessibility(render_view), | 34 : RendererAccessibility(render_frame), |
| 34 weak_factory_(this), | 35 weak_factory_(this), |
| 35 tree_source_(render_view), | 36 tree_source_(render_frame), |
| 36 serializer_(&tree_source_), | 37 serializer_(&tree_source_), |
| 37 last_scroll_offset_(gfx::Size()), | 38 last_scroll_offset_(gfx::Size()), |
| 38 ack_pending_(false) { | 39 ack_pending_(false) { |
| 39 WebAXObject::enableAccessibility(); | 40 WebAXObject::enableAccessibility(); |
| 40 | 41 |
| 41 #if !defined(OS_ANDROID) | 42 #if !defined(OS_ANDROID) |
| 42 // Skip inline text boxes on Android - since there are no native Android | 43 // 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 | 44 // APIs that compute the bounds of a range of text, it's a waste to |
| 44 // include these in the AX tree. | 45 // include these in the AX tree. |
| 45 WebAXObject::enableInlineTextBoxAccessibility(); | 46 WebAXObject::enableInlineTextBoxAccessibility(); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } | 156 } |
| 156 | 157 |
| 157 void RendererAccessibilityComplete::SendPendingAccessibilityEvents() { | 158 void RendererAccessibilityComplete::SendPendingAccessibilityEvents() { |
| 158 const WebDocument& document = GetMainDocument(); | 159 const WebDocument& document = GetMainDocument(); |
| 159 if (document.isNull()) | 160 if (document.isNull()) |
| 160 return; | 161 return; |
| 161 | 162 |
| 162 if (pending_events_.empty()) | 163 if (pending_events_.empty()) |
| 163 return; | 164 return; |
| 164 | 165 |
| 165 if (render_view_->is_swapped_out()) | 166 if (render_frame_->is_swapped_out()) |
| 166 return; | 167 return; |
| 167 | 168 |
| 168 ack_pending_ = true; | 169 ack_pending_ = true; |
| 169 | 170 |
| 170 // Make a copy of the events, because it's possible that | 171 // Make a copy of the events, because it's possible that |
| 171 // actions inside this loop will cause more events to be | 172 // actions inside this loop will cause more events to be |
| 172 // queued up. | 173 // queued up. |
| 173 std::vector<AccessibilityHostMsg_EventParams> src_events = | 174 std::vector<AccessibilityHostMsg_EventParams> src_events = |
| 174 pending_events_; | 175 pending_events_; |
| 175 pending_events_.clear(); | 176 pending_events_.clear(); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 render_view()->GetWebView()->clearFocusedElement(); | 376 render_view()->GetWebView()->clearFocusedElement(); |
| 376 else | 377 else |
| 377 obj.setFocused(true); | 378 obj.setFocused(true); |
| 378 } | 379 } |
| 379 | 380 |
| 380 void RendererAccessibilityComplete::OnFatalError() { | 381 void RendererAccessibilityComplete::OnFatalError() { |
| 381 CHECK(false) << "Invalid accessibility tree."; | 382 CHECK(false) << "Invalid accessibility tree."; |
| 382 } | 383 } |
| 383 | 384 |
| 384 } // namespace content | 385 } // namespace content |
| OLD | NEW |