| 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 blink::WebNode node = obj.node(); | 337 blink::WebNode node = obj.node(); |
| 337 if (!node.isNull() && node.isElementNode()) { | 338 if (!node.isNull() && node.isElementNode()) { |
| 338 blink::WebElement element = node.to<blink::WebElement>(); | 339 blink::WebElement element = node.to<blink::WebElement>(); |
| 339 blink::WebInputElement* input_element = | 340 blink::WebInputElement* input_element = |
| 340 blink::toWebInputElement(&element); | 341 blink::toWebInputElement(&element); |
| 341 if (input_element && input_element->isTextField()) | 342 if (input_element && input_element->isTextField()) |
| 342 input_element->setSelectionRange(start_offset, end_offset); | 343 input_element->setSelectionRange(start_offset, end_offset); |
| 343 } | 344 } |
| 344 } | 345 } |
| 345 | 346 |
| 347 void RendererAccessibilityComplete::OnHitTest(gfx::Point point) { |
| 348 const WebDocument& document = GetMainDocument(); |
| 349 if (document.isNull()) |
| 350 return; |
| 351 WebAXObject root_obj = document.accessibilityObject(); |
| 352 if (!root_obj.updateBackingStoreAndCheckValidity()) |
| 353 return; |
| 354 |
| 355 WebAXObject obj = root_obj.hitTest(point); |
| 356 if (!obj.isDetached()) |
| 357 HandleAXEvent(obj, ui::AX_EVENT_HOVER); |
| 358 } |
| 359 |
| 346 void RendererAccessibilityComplete::OnEventsAck() { | 360 void RendererAccessibilityComplete::OnEventsAck() { |
| 347 DCHECK(ack_pending_); | 361 DCHECK(ack_pending_); |
| 348 ack_pending_ = false; | 362 ack_pending_ = false; |
| 349 SendPendingAccessibilityEvents(); | 363 SendPendingAccessibilityEvents(); |
| 350 } | 364 } |
| 351 | 365 |
| 352 void RendererAccessibilityComplete::OnSetFocus(int acc_obj_id) { | 366 void RendererAccessibilityComplete::OnSetFocus(int acc_obj_id) { |
| 353 const WebDocument& document = GetMainDocument(); | 367 const WebDocument& document = GetMainDocument(); |
| 354 if (document.isNull()) | 368 if (document.isNull()) |
| 355 return; | 369 return; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 377 render_view()->GetWebView()->clearFocusedElement(); | 391 render_view()->GetWebView()->clearFocusedElement(); |
| 378 else | 392 else |
| 379 obj.setFocused(true); | 393 obj.setFocused(true); |
| 380 } | 394 } |
| 381 | 395 |
| 382 void RendererAccessibilityComplete::OnFatalError() { | 396 void RendererAccessibilityComplete::OnFatalError() { |
| 383 CHECK(false) << "Invalid accessibility tree."; | 397 CHECK(false) << "Invalid accessibility tree."; |
| 384 } | 398 } |
| 385 | 399 |
| 386 } // namespace content | 400 } // namespace content |
| OLD | NEW |