| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 IPC_MESSAGE_HANDLER(AccessibilityMsg_DoDefaultAction, | 66 IPC_MESSAGE_HANDLER(AccessibilityMsg_DoDefaultAction, |
| 67 OnDoDefaultAction) | 67 OnDoDefaultAction) |
| 68 IPC_MESSAGE_HANDLER(AccessibilityMsg_Events_ACK, | 68 IPC_MESSAGE_HANDLER(AccessibilityMsg_Events_ACK, |
| 69 OnEventsAck) | 69 OnEventsAck) |
| 70 IPC_MESSAGE_HANDLER(AccessibilityMsg_ScrollToMakeVisible, | 70 IPC_MESSAGE_HANDLER(AccessibilityMsg_ScrollToMakeVisible, |
| 71 OnScrollToMakeVisible) | 71 OnScrollToMakeVisible) |
| 72 IPC_MESSAGE_HANDLER(AccessibilityMsg_ScrollToPoint, | 72 IPC_MESSAGE_HANDLER(AccessibilityMsg_ScrollToPoint, |
| 73 OnScrollToPoint) | 73 OnScrollToPoint) |
| 74 IPC_MESSAGE_HANDLER(AccessibilityMsg_SetTextSelection, | 74 IPC_MESSAGE_HANDLER(AccessibilityMsg_SetTextSelection, |
| 75 OnSetTextSelection) | 75 OnSetTextSelection) |
| 76 IPC_MESSAGE_HANDLER(AccessibilityMsg_HitTest, OnHitTest) |
| 76 IPC_MESSAGE_HANDLER(AccessibilityMsg_FatalError, OnFatalError) | 77 IPC_MESSAGE_HANDLER(AccessibilityMsg_FatalError, OnFatalError) |
| 77 IPC_MESSAGE_UNHANDLED(handled = false) | 78 IPC_MESSAGE_UNHANDLED(handled = false) |
| 78 IPC_END_MESSAGE_MAP() | 79 IPC_END_MESSAGE_MAP() |
| 79 return handled; | 80 return handled; |
| 80 } | 81 } |
| 81 | 82 |
| 82 void RendererAccessibilityComplete::FocusedNodeChanged(const WebNode& node) { | 83 void RendererAccessibilityComplete::FocusedNodeChanged(const WebNode& node) { |
| 83 const WebDocument& document = GetMainDocument(); | 84 const WebDocument& document = GetMainDocument(); |
| 84 if (document.isNull()) | 85 if (document.isNull()) |
| 85 return; | 86 return; |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 blink::WebNode node = obj.node(); | 331 blink::WebNode node = obj.node(); |
| 331 if (!node.isNull() && node.isElementNode()) { | 332 if (!node.isNull() && node.isElementNode()) { |
| 332 blink::WebElement element = node.to<blink::WebElement>(); | 333 blink::WebElement element = node.to<blink::WebElement>(); |
| 333 blink::WebInputElement* input_element = | 334 blink::WebInputElement* input_element = |
| 334 blink::toWebInputElement(&element); | 335 blink::toWebInputElement(&element); |
| 335 if (input_element && input_element->isTextField()) | 336 if (input_element && input_element->isTextField()) |
| 336 input_element->setSelectionRange(start_offset, end_offset); | 337 input_element->setSelectionRange(start_offset, end_offset); |
| 337 } | 338 } |
| 338 } | 339 } |
| 339 | 340 |
| 341 void RendererAccessibilityComplete::OnHitTest(gfx::Point point) { |
| 342 const WebDocument& document = GetMainDocument(); |
| 343 if (document.isNull()) |
| 344 return; |
| 345 WebAXObject root_obj = document.accessibilityObject(); |
| 346 if (!root_obj.updateBackingStoreAndCheckValidity()) |
| 347 return; |
| 348 |
| 349 WebAXObject obj = root_obj.hitTest(point); |
| 350 if (!obj.isDetached()) |
| 351 HandleAXEvent(obj, ui::AX_EVENT_HOVER); |
| 352 } |
| 353 |
| 340 void RendererAccessibilityComplete::OnEventsAck() { | 354 void RendererAccessibilityComplete::OnEventsAck() { |
| 341 DCHECK(ack_pending_); | 355 DCHECK(ack_pending_); |
| 342 ack_pending_ = false; | 356 ack_pending_ = false; |
| 343 SendPendingAccessibilityEvents(); | 357 SendPendingAccessibilityEvents(); |
| 344 } | 358 } |
| 345 | 359 |
| 346 void RendererAccessibilityComplete::OnSetFocus(int acc_obj_id) { | 360 void RendererAccessibilityComplete::OnSetFocus(int acc_obj_id) { |
| 347 const WebDocument& document = GetMainDocument(); | 361 const WebDocument& document = GetMainDocument(); |
| 348 if (document.isNull()) | 362 if (document.isNull()) |
| 349 return; | 363 return; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 371 render_view()->GetWebView()->clearFocusedElement(); | 385 render_view()->GetWebView()->clearFocusedElement(); |
| 372 else | 386 else |
| 373 obj.setFocused(true); | 387 obj.setFocused(true); |
| 374 } | 388 } |
| 375 | 389 |
| 376 void RendererAccessibilityComplete::OnFatalError() { | 390 void RendererAccessibilityComplete::OnFatalError() { |
| 377 CHECK(false) << "Invalid accessibility tree."; | 391 CHECK(false) << "Invalid accessibility tree."; |
| 378 } | 392 } |
| 379 | 393 |
| 380 } // namespace content | 394 } // namespace content |
| OLD | NEW |