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/render_accessibility_impl.h" | 5 #include "content/renderer/accessibility/render_accessibility_impl.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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 case ui::AX_ACTION_DECREMENT: | 460 case ui::AX_ACTION_DECREMENT: |
461 target.decrement(); | 461 target.decrement(); |
462 break; | 462 break; |
463 case ui::AX_ACTION_DO_DEFAULT: | 463 case ui::AX_ACTION_DO_DEFAULT: |
464 target.performDefaultAction(); | 464 target.performDefaultAction(); |
465 break; | 465 break; |
466 case ui::AX_ACTION_GET_IMAGE_DATA: | 466 case ui::AX_ACTION_GET_IMAGE_DATA: |
467 OnGetImageData(target, data.target_rect.size()); | 467 OnGetImageData(target, data.target_rect.size()); |
468 break; | 468 break; |
469 case ui::AX_ACTION_HIT_TEST: | 469 case ui::AX_ACTION_HIT_TEST: |
470 OnHitTest(data.target_point); | 470 OnHitTest(data.target_point, data.hit_test_event_to_fire); |
471 break; | 471 break; |
472 case ui::AX_ACTION_INCREMENT: | 472 case ui::AX_ACTION_INCREMENT: |
473 target.increment(); | 473 target.increment(); |
474 break; | 474 break; |
475 case ui::AX_ACTION_SCROLL_TO_MAKE_VISIBLE: | 475 case ui::AX_ACTION_SCROLL_TO_MAKE_VISIBLE: |
476 target.scrollToMakeVisibleWithSubFocus( | 476 target.scrollToMakeVisibleWithSubFocus( |
477 WebRect(data.target_rect.x(), data.target_rect.y(), | 477 WebRect(data.target_rect.x(), data.target_rect.y(), |
478 data.target_rect.width(), data.target_rect.height())); | 478 data.target_rect.width(), data.target_rect.height())); |
479 break; | 479 break; |
480 case ui::AX_ACTION_SCROLL_TO_POINT: | 480 case ui::AX_ACTION_SCROLL_TO_POINT: |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 | 524 |
525 DCHECK(ack_pending_); | 525 DCHECK(ack_pending_); |
526 ack_pending_ = false; | 526 ack_pending_ = false; |
527 SendPendingAccessibilityEvents(); | 527 SendPendingAccessibilityEvents(); |
528 } | 528 } |
529 | 529 |
530 void RenderAccessibilityImpl::OnFatalError() { | 530 void RenderAccessibilityImpl::OnFatalError() { |
531 CHECK(false) << "Invalid accessibility tree."; | 531 CHECK(false) << "Invalid accessibility tree."; |
532 } | 532 } |
533 | 533 |
534 void RenderAccessibilityImpl::OnHitTest(const gfx::Point& point) { | 534 void RenderAccessibilityImpl::OnHitTest(const gfx::Point& point, |
| 535 ui::AXEvent event_to_fire) { |
535 const WebDocument& document = GetMainDocument(); | 536 const WebDocument& document = GetMainDocument(); |
536 if (document.isNull()) | 537 if (document.isNull()) |
537 return; | 538 return; |
538 WebAXObject root_obj = document.accessibilityObject(); | 539 WebAXObject root_obj = document.accessibilityObject(); |
539 if (!root_obj.updateLayoutAndCheckValidity()) | 540 if (!root_obj.updateLayoutAndCheckValidity()) |
540 return; | 541 return; |
541 | 542 |
542 WebAXObject obj = root_obj.hitTest(point); | 543 WebAXObject obj = root_obj.hitTest(point); |
543 if (obj.isDetached()) | 544 if (obj.isDetached()) |
544 return; | 545 return; |
545 | 546 |
546 // If the object that was hit has a child frame, we have to send a | 547 // If the object that was hit has a child frame, we have to send a |
547 // message back to the browser to do the hit test in the child frame, | 548 // message back to the browser to do the hit test in the child frame, |
548 // recursively. | 549 // recursively. |
549 AXContentNodeData data; | 550 AXContentNodeData data; |
550 ScopedFreezeBlinkAXTreeSource freeze(&tree_source_); | 551 ScopedFreezeBlinkAXTreeSource freeze(&tree_source_); |
551 tree_source_.SerializeNode(obj, &data); | 552 tree_source_.SerializeNode(obj, &data); |
552 if (data.HasContentIntAttribute(AX_CONTENT_ATTR_CHILD_ROUTING_ID) || | 553 if (data.HasContentIntAttribute(AX_CONTENT_ATTR_CHILD_ROUTING_ID) || |
553 data.HasContentIntAttribute( | 554 data.HasContentIntAttribute( |
554 AX_CONTENT_ATTR_CHILD_BROWSER_PLUGIN_INSTANCE_ID)) { | 555 AX_CONTENT_ATTR_CHILD_BROWSER_PLUGIN_INSTANCE_ID)) { |
555 Send(new AccessibilityHostMsg_ChildFrameHitTestResult(routing_id(), point, | 556 Send(new AccessibilityHostMsg_ChildFrameHitTestResult( |
556 obj.axID())); | 557 routing_id(), point, obj.axID(), event_to_fire)); |
557 return; | 558 return; |
558 } | 559 } |
559 | 560 |
560 // Otherwise, send a HOVER event on the node that was hit. | 561 // Otherwise, send an event on the node that was hit. |
561 HandleAXEvent(obj, ui::AX_EVENT_HOVER); | 562 HandleAXEvent(obj, event_to_fire); |
562 } | 563 } |
563 | 564 |
564 void RenderAccessibilityImpl::OnSetAccessibilityFocus( | 565 void RenderAccessibilityImpl::OnSetAccessibilityFocus( |
565 const blink::WebAXObject& obj) { | 566 const blink::WebAXObject& obj) { |
566 ScopedFreezeBlinkAXTreeSource freeze(&tree_source_); | 567 ScopedFreezeBlinkAXTreeSource freeze(&tree_source_); |
567 if (tree_source_.accessibility_focus_id() == obj.axID()) | 568 if (tree_source_.accessibility_focus_id() == obj.axID()) |
568 return; | 569 return; |
569 | 570 |
570 tree_source_.set_accessibility_focus_id(obj.axID()); | 571 tree_source_.set_accessibility_focus_id(obj.axID()); |
571 | 572 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 | 663 |
663 const WebDocument& document = GetMainDocument(); | 664 const WebDocument& document = GetMainDocument(); |
664 if (document.isNull()) | 665 if (document.isNull()) |
665 return; | 666 return; |
666 | 667 |
667 document.accessibilityObject().scrollToMakeVisibleWithSubFocus( | 668 document.accessibilityObject().scrollToMakeVisibleWithSubFocus( |
668 WebRect(bounds.x(), bounds.y(), bounds.width(), bounds.height())); | 669 WebRect(bounds.x(), bounds.y(), bounds.width(), bounds.height())); |
669 } | 670 } |
670 | 671 |
671 } // namespace content | 672 } // namespace content |
OLD | NEW |