| 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.h" | 5 #include "content/renderer/accessibility/renderer_accessibility.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 | 377 |
| 378 void RendererAccessibility::OnHitTest(gfx::Point point) { | 378 void RendererAccessibility::OnHitTest(gfx::Point point) { |
| 379 const WebDocument& document = GetMainDocument(); | 379 const WebDocument& document = GetMainDocument(); |
| 380 if (document.isNull()) | 380 if (document.isNull()) |
| 381 return; | 381 return; |
| 382 WebAXObject root_obj = document.accessibilityObject(); | 382 WebAXObject root_obj = document.accessibilityObject(); |
| 383 if (!root_obj.updateLayoutAndCheckValidity()) | 383 if (!root_obj.updateLayoutAndCheckValidity()) |
| 384 return; | 384 return; |
| 385 | 385 |
| 386 WebAXObject obj = root_obj.hitTest(point); | 386 WebAXObject obj = root_obj.hitTest(point); |
| 387 if (!obj.isDetached()) | 387 if (obj.isDetached()) |
| 388 HandleAXEvent(obj, ui::AX_EVENT_HOVER); | 388 return; |
| 389 |
| 390 // If the object that was hit has a child frame, we have to send a |
| 391 // message back to the browser to do the hit test in the child frame, |
| 392 // recursively. |
| 393 AXContentNodeData data; |
| 394 tree_source_.SerializeNode(obj, &data); |
| 395 if (data.HasContentIntAttribute(AX_CONTENT_ATTR_CHILD_ROUTING_ID) || |
| 396 data.HasContentIntAttribute( |
| 397 AX_CONTENT_ATTR_CHILD_BROWSER_PLUGIN_INSTANCE_ID)) { |
| 398 Send(new AccessibilityHostMsg_ChildFrameHitTestResult(routing_id(), point, |
| 399 obj.axID())); |
| 400 return; |
| 401 } |
| 402 |
| 403 // Otherwise, send a HOVER event on the node that was hit. |
| 404 HandleAXEvent(obj, ui::AX_EVENT_HOVER); |
| 389 } | 405 } |
| 390 | 406 |
| 391 void RendererAccessibility::OnSetAccessibilityFocus(int acc_obj_id) { | 407 void RendererAccessibility::OnSetAccessibilityFocus(int acc_obj_id) { |
| 392 if (tree_source_.accessibility_focus_id() == acc_obj_id) | 408 if (tree_source_.accessibility_focus_id() == acc_obj_id) |
| 393 return; | 409 return; |
| 394 | 410 |
| 395 tree_source_.set_accessibility_focus_id(acc_obj_id); | 411 tree_source_.set_accessibility_focus_id(acc_obj_id); |
| 396 | 412 |
| 397 const WebDocument& document = GetMainDocument(); | 413 const WebDocument& document = GetMainDocument(); |
| 398 if (document.isNull()) | 414 if (document.isNull()) |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 #ifndef NDEBUG | 595 #ifndef NDEBUG |
| 580 LOG(WARNING) << "ShowContextMenu on invalid object id " << acc_obj_id; | 596 LOG(WARNING) << "ShowContextMenu on invalid object id " << acc_obj_id; |
| 581 #endif | 597 #endif |
| 582 return; | 598 return; |
| 583 } | 599 } |
| 584 | 600 |
| 585 obj.showContextMenu(); | 601 obj.showContextMenu(); |
| 586 } | 602 } |
| 587 | 603 |
| 588 } // namespace content | 604 } // namespace content |
| OLD | NEW |