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

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

Issue 2522543004: Add support for retrieving image thumbnails as part of the accessibility tree. (Closed)
Patch Set: Clarified maxSize Created 4 years, 1 month 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 switch (data.action) { 452 switch (data.action) {
453 case ui::AX_ACTION_BLUR: 453 case ui::AX_ACTION_BLUR:
454 target.setFocused(false); 454 target.setFocused(false);
455 break; 455 break;
456 case ui::AX_ACTION_DECREMENT: 456 case ui::AX_ACTION_DECREMENT:
457 target.decrement(); 457 target.decrement();
458 break; 458 break;
459 case ui::AX_ACTION_DO_DEFAULT: 459 case ui::AX_ACTION_DO_DEFAULT:
460 target.performDefaultAction(); 460 target.performDefaultAction();
461 break; 461 break;
462 case ui::AX_ACTION_GET_IMAGE_DATA:
463 OnGetImageData(target, data.target_rect.size());
464 break;
462 case ui::AX_ACTION_HIT_TEST: 465 case ui::AX_ACTION_HIT_TEST:
463 OnHitTest(data.target_point); 466 OnHitTest(data.target_point);
464 break; 467 break;
465 case ui::AX_ACTION_INCREMENT: 468 case ui::AX_ACTION_INCREMENT:
466 target.increment(); 469 target.increment();
467 break; 470 break;
468 case ui::AX_ACTION_SCROLL_TO_MAKE_VISIBLE: 471 case ui::AX_ACTION_SCROLL_TO_MAKE_VISIBLE:
469 target.scrollToMakeVisibleWithSubFocus( 472 target.scrollToMakeVisibleWithSubFocus(
470 WebRect(data.target_rect.x(), data.target_rect.y(), 473 WebRect(data.target_rect.x(), data.target_rect.y(),
471 data.target_rect.width(), data.target_rect.height())); 474 data.target_rect.width(), data.target_rect.height()));
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 return; 570 return;
568 571
569 // This object may not be a leaf node. Force the whole subtree to be 572 // This object may not be a leaf node. Force the whole subtree to be
570 // re-serialized. 573 // re-serialized.
571 serializer_.DeleteClientSubtree(obj); 574 serializer_.DeleteClientSubtree(obj);
572 575
573 // Explicitly send a tree change update event now. 576 // Explicitly send a tree change update event now.
574 HandleAXEvent(obj, ui::AX_EVENT_TREE_CHANGED); 577 HandleAXEvent(obj, ui::AX_EVENT_TREE_CHANGED);
575 } 578 }
576 579
580 void RenderAccessibilityImpl::OnGetImageData(
581 const blink::WebAXObject& obj, const gfx::Size& max_size) {
582 ScopedFreezeBlinkAXTreeSource freeze(&tree_source_);
583 if (tree_source_.image_data_node_id() == obj.axID())
584 return;
585
586 tree_source_.set_image_data_node_id(obj.axID());
587 tree_source_.set_max_image_data_size(max_size);
588
589 const WebDocument& document = GetMainDocument();
590 if (document.isNull())
591 return;
592
593 serializer_.DeleteClientSubtree(obj);
594 HandleAXEvent(obj, ui::AX_EVENT_IMAGE_FRAME_UPDATED);
595 }
596
577 void RenderAccessibilityImpl::OnReset(int reset_token) { 597 void RenderAccessibilityImpl::OnReset(int reset_token) {
578 reset_token_ = reset_token; 598 reset_token_ = reset_token;
579 serializer_.Reset(); 599 serializer_.Reset();
580 pending_events_.clear(); 600 pending_events_.clear();
581 601
582 const WebDocument& document = GetMainDocument(); 602 const WebDocument& document = GetMainDocument();
583 if (!document.isNull()) { 603 if (!document.isNull()) {
584 // Tree-only mode gets used by the automation extension API which requires a 604 // Tree-only mode gets used by the automation extension API which requires a
585 // load complete event to invoke listener callbacks. 605 // load complete event to invoke listener callbacks.
586 ui::AXEvent evt = document.accessibilityObject().isLoaded() 606 ui::AXEvent evt = document.accessibilityObject().isLoaded()
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 658
639 const WebDocument& document = GetMainDocument(); 659 const WebDocument& document = GetMainDocument();
640 if (document.isNull()) 660 if (document.isNull())
641 return; 661 return;
642 662
643 document.accessibilityObject().scrollToMakeVisibleWithSubFocus( 663 document.accessibilityObject().scrollToMakeVisibleWithSubFocus(
644 WebRect(bounds.x(), bounds.y(), bounds.width(), bounds.height())); 664 WebRect(bounds.x(), bounds.y(), bounds.width(), bounds.height()));
645 } 665 }
646 666
647 } // namespace content 667 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698