Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: content/renderer/accessibility/render_accessibility_impl.cc

Issue 2748463003: Generalize the HIT_TEST accessibility action so that it can send any event. (Closed)
Patch Set: Use ParseAXEvent Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 case ui::AX_ACTION_DECREMENT: 464 case ui::AX_ACTION_DECREMENT:
465 target.decrement(); 465 target.decrement();
466 break; 466 break;
467 case ui::AX_ACTION_DO_DEFAULT: 467 case ui::AX_ACTION_DO_DEFAULT:
468 target.performDefaultAction(); 468 target.performDefaultAction();
469 break; 469 break;
470 case ui::AX_ACTION_GET_IMAGE_DATA: 470 case ui::AX_ACTION_GET_IMAGE_DATA:
471 OnGetImageData(target, data.target_rect.size()); 471 OnGetImageData(target, data.target_rect.size());
472 break; 472 break;
473 case ui::AX_ACTION_HIT_TEST: 473 case ui::AX_ACTION_HIT_TEST:
474 OnHitTest(data.target_point); 474 DCHECK(data.hit_test_event_to_fire != ui::AX_EVENT_NONE);
475 OnHitTest(data.target_point, data.hit_test_event_to_fire);
475 break; 476 break;
476 case ui::AX_ACTION_INCREMENT: 477 case ui::AX_ACTION_INCREMENT:
477 target.increment(); 478 target.increment();
478 break; 479 break;
479 case ui::AX_ACTION_SCROLL_TO_MAKE_VISIBLE: 480 case ui::AX_ACTION_SCROLL_TO_MAKE_VISIBLE:
480 target.scrollToMakeVisibleWithSubFocus( 481 target.scrollToMakeVisibleWithSubFocus(
481 WebRect(data.target_rect.x(), data.target_rect.y(), 482 WebRect(data.target_rect.x(), data.target_rect.y(),
482 data.target_rect.width(), data.target_rect.height())); 483 data.target_rect.width(), data.target_rect.height()));
483 break; 484 break;
484 case ui::AX_ACTION_SCROLL_TO_POINT: 485 case ui::AX_ACTION_SCROLL_TO_POINT:
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 529
529 DCHECK(ack_pending_); 530 DCHECK(ack_pending_);
530 ack_pending_ = false; 531 ack_pending_ = false;
531 SendPendingAccessibilityEvents(); 532 SendPendingAccessibilityEvents();
532 } 533 }
533 534
534 void RenderAccessibilityImpl::OnFatalError() { 535 void RenderAccessibilityImpl::OnFatalError() {
535 CHECK(false) << "Invalid accessibility tree."; 536 CHECK(false) << "Invalid accessibility tree.";
536 } 537 }
537 538
538 void RenderAccessibilityImpl::OnHitTest(const gfx::Point& point) { 539 void RenderAccessibilityImpl::OnHitTest(const gfx::Point& point,
540 ui::AXEvent event_to_fire) {
539 const WebDocument& document = GetMainDocument(); 541 const WebDocument& document = GetMainDocument();
540 if (document.isNull()) 542 if (document.isNull())
541 return; 543 return;
542 WebAXObject root_obj = document.accessibilityObject(); 544 WebAXObject root_obj = document.accessibilityObject();
543 if (!root_obj.updateLayoutAndCheckValidity()) 545 if (!root_obj.updateLayoutAndCheckValidity())
544 return; 546 return;
545 547
546 WebAXObject obj = root_obj.hitTest(point); 548 WebAXObject obj = root_obj.hitTest(point);
547 if (obj.isDetached()) 549 if (obj.isDetached())
548 return; 550 return;
549 551
550 // If the object that was hit has a child frame, we have to send a 552 // If the object that was hit has a child frame, we have to send a
551 // message back to the browser to do the hit test in the child frame, 553 // message back to the browser to do the hit test in the child frame,
552 // recursively. 554 // recursively.
553 AXContentNodeData data; 555 AXContentNodeData data;
554 ScopedFreezeBlinkAXTreeSource freeze(&tree_source_); 556 ScopedFreezeBlinkAXTreeSource freeze(&tree_source_);
555 tree_source_.SerializeNode(obj, &data); 557 tree_source_.SerializeNode(obj, &data);
556 if (data.HasContentIntAttribute(AX_CONTENT_ATTR_CHILD_ROUTING_ID) || 558 if (data.HasContentIntAttribute(AX_CONTENT_ATTR_CHILD_ROUTING_ID) ||
557 data.HasContentIntAttribute( 559 data.HasContentIntAttribute(
558 AX_CONTENT_ATTR_CHILD_BROWSER_PLUGIN_INSTANCE_ID)) { 560 AX_CONTENT_ATTR_CHILD_BROWSER_PLUGIN_INSTANCE_ID)) {
559 Send(new AccessibilityHostMsg_ChildFrameHitTestResult(routing_id(), point, 561 Send(new AccessibilityHostMsg_ChildFrameHitTestResult(
560 obj.axID())); 562 routing_id(), point, obj.axID(), event_to_fire));
561 return; 563 return;
562 } 564 }
563 565
564 // Otherwise, send a HOVER event on the node that was hit. 566 // Otherwise, send an event on the node that was hit.
565 HandleAXEvent(obj, ui::AX_EVENT_HOVER); 567 HandleAXEvent(obj, event_to_fire);
566 } 568 }
567 569
568 void RenderAccessibilityImpl::OnSetAccessibilityFocus( 570 void RenderAccessibilityImpl::OnSetAccessibilityFocus(
569 const blink::WebAXObject& obj) { 571 const blink::WebAXObject& obj) {
570 ScopedFreezeBlinkAXTreeSource freeze(&tree_source_); 572 ScopedFreezeBlinkAXTreeSource freeze(&tree_source_);
571 if (tree_source_.accessibility_focus_id() == obj.axID()) 573 if (tree_source_.accessibility_focus_id() == obj.axID())
572 return; 574 return;
573 575
574 tree_source_.set_accessibility_focus_id(obj.axID()); 576 tree_source_.set_accessibility_focus_id(obj.axID());
575 577
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 668
667 const WebDocument& document = GetMainDocument(); 669 const WebDocument& document = GetMainDocument();
668 if (document.isNull()) 670 if (document.isNull())
669 return; 671 return;
670 672
671 document.accessibilityObject().scrollToMakeVisibleWithSubFocus( 673 document.accessibilityObject().scrollToMakeVisibleWithSubFocus(
672 WebRect(bounds.x(), bounds.y(), bounds.width(), bounds.height())); 674 WebRect(bounds.x(), bounds.y(), bounds.width(), bounds.height()));
673 } 675 }
674 676
675 } // namespace content 677 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/accessibility/render_accessibility_impl.h ('k') | third_party/closure_compiler/externs/automation.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698