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

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

Issue 1155993003: Fix accessibility with out-of-process iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/blink_ax_tree_source.h" 5 #include "content/renderer/accessibility/blink_ax_tree_source.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 19 matching lines...) Expand all
30 #include "third_party/WebKit/public/web/WebPlugin.h" 30 #include "third_party/WebKit/public/web/WebPlugin.h"
31 #include "third_party/WebKit/public/web/WebPluginContainer.h" 31 #include "third_party/WebKit/public/web/WebPluginContainer.h"
32 #include "third_party/WebKit/public/web/WebView.h" 32 #include "third_party/WebKit/public/web/WebView.h"
33 33
34 using base::ASCIIToUTF16; 34 using base::ASCIIToUTF16;
35 using base::UTF16ToUTF8; 35 using base::UTF16ToUTF8;
36 using blink::WebAXObject; 36 using blink::WebAXObject;
37 using blink::WebDocument; 37 using blink::WebDocument;
38 using blink::WebDocumentType; 38 using blink::WebDocumentType;
39 using blink::WebElement; 39 using blink::WebElement;
40 using blink::WebLocalFrame; 40 using blink::WebFrame;
41 using blink::WebNode; 41 using blink::WebNode;
42 using blink::WebPlugin; 42 using blink::WebPlugin;
43 using blink::WebPluginContainer; 43 using blink::WebPluginContainer;
44 using blink::WebVector; 44 using blink::WebVector;
45 using blink::WebView; 45 using blink::WebView;
46 46
47 namespace content { 47 namespace content {
48 48
49 namespace { 49 namespace {
50 50
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 424
425 // Browser plugin (used in a <webview>). 425 // Browser plugin (used in a <webview>).
426 if (node_to_browser_plugin_instance_id_map_) { 426 if (node_to_browser_plugin_instance_id_map_) {
427 BrowserPlugin* browser_plugin = BrowserPlugin::GetFromNode(element); 427 BrowserPlugin* browser_plugin = BrowserPlugin::GetFromNode(element);
428 if (browser_plugin) { 428 if (browser_plugin) {
429 (*node_to_browser_plugin_instance_id_map_)[dst->id] = 429 (*node_to_browser_plugin_instance_id_map_)[dst->id] =
430 browser_plugin->browser_plugin_instance_id(); 430 browser_plugin->browser_plugin_instance_id();
431 dst->AddBoolAttribute(ui::AX_ATTR_IS_AX_TREE_HOST, true); 431 dst->AddBoolAttribute(ui::AX_ATTR_IS_AX_TREE_HOST, true);
432 } 432 }
433 } 433 }
434
435 // Out-of-process iframe.
436 if (is_iframe && node_to_frame_routing_id_map_) {
437 WebFrame* frame = WebFrame::fromFrameOwnerElement(element);
438
439 if (frame->isWebRemoteFrame()) {
440 RenderFrameProxy* render_frame_proxy =
441 RenderFrameProxy::FromWebFrame(frame);
442
443 DCHECK(render_frame_proxy);
444 (*node_to_frame_routing_id_map_)[dst->id] =
445 render_frame_proxy->routing_id();
446 dst->AddBoolAttribute(ui::AX_ATTR_IS_AX_TREE_HOST, true);
447 }
448 }
434 } 449 }
435 450
436 if (src.isInLiveRegion()) { 451 if (src.isInLiveRegion()) {
437 dst->AddBoolAttribute(ui::AX_ATTR_LIVE_ATOMIC, src.liveRegionAtomic()); 452 dst->AddBoolAttribute(ui::AX_ATTR_LIVE_ATOMIC, src.liveRegionAtomic());
438 dst->AddBoolAttribute(ui::AX_ATTR_LIVE_BUSY, src.liveRegionBusy()); 453 dst->AddBoolAttribute(ui::AX_ATTR_LIVE_BUSY, src.liveRegionBusy());
439 if (src.liveRegionBusy()) 454 if (src.liveRegionBusy())
440 dst->state |= (1 << ui::AX_STATE_BUSY); 455 dst->state |= (1 << ui::AX_STATE_BUSY);
441 if (!src.liveRegionStatus().isEmpty()) { 456 if (!src.liveRegionStatus().isEmpty()) {
442 dst->AddStringAttribute(ui::AX_ATTR_LIVE_STATUS, 457 dst->AddStringAttribute(ui::AX_ATTR_LIVE_STATUS,
443 UTF16ToUTF8(src.liveRegionStatus())); 458 UTF16ToUTF8(src.liveRegionStatus()));
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X, scroll_offset.width()); 506 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X, scroll_offset.width());
492 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y, scroll_offset.height()); 507 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y, scroll_offset.height());
493 508
494 const gfx::Size& min_offset = document.minimumScrollOffset(); 509 const gfx::Size& min_offset = document.minimumScrollOffset();
495 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X_MIN, min_offset.width()); 510 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X_MIN, min_offset.width());
496 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y_MIN, min_offset.height()); 511 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y_MIN, min_offset.height());
497 512
498 const gfx::Size& max_offset = document.maximumScrollOffset(); 513 const gfx::Size& max_offset = document.maximumScrollOffset();
499 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X_MAX, max_offset.width()); 514 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_X_MAX, max_offset.width());
500 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y_MAX, max_offset.height()); 515 dst->AddIntAttribute(ui::AX_ATTR_SCROLL_Y_MAX, max_offset.height());
501
502 if (node_to_frame_routing_id_map_ && !src.equals(GetRoot())) {
503 WebLocalFrame* frame = document.frame();
504 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame);
505 if (render_frame) {
506 (*node_to_frame_routing_id_map_)[dst->id] =
507 render_frame->GetRoutingID();
508 dst->AddBoolAttribute(ui::AX_ATTR_IS_AX_TREE_HOST, true);
509 } else {
510 RenderFrameProxy* render_frame_proxy =
511 RenderFrameProxy::FromWebFrame(frame);
512 if (render_frame_proxy) {
513 (*node_to_frame_routing_id_map_)[dst->id] =
514 render_frame_proxy->routing_id();
515 dst->AddBoolAttribute(ui::AX_ATTR_IS_AX_TREE_HOST, true);
516 }
517 }
518 }
519 } 516 }
520 517
521 if (dst->role == ui::AX_ROLE_TABLE) { 518 if (dst->role == ui::AX_ROLE_TABLE) {
522 int column_count = src.columnCount(); 519 int column_count = src.columnCount();
523 int row_count = src.rowCount(); 520 int row_count = src.rowCount();
524 if (column_count > 0 && row_count > 0) { 521 if (column_count > 0 && row_count > 0) {
525 std::set<int32> unique_cell_id_set; 522 std::set<int32> unique_cell_id_set;
526 std::vector<int32> cell_ids; 523 std::vector<int32> cell_ids;
527 std::vector<int32> unique_cell_ids; 524 std::vector<int32> unique_cell_ids;
528 dst->AddIntAttribute(ui::AX_ATTR_TABLE_COLUMN_COUNT, column_count); 525 dst->AddIntAttribute(ui::AX_ATTR_TABLE_COLUMN_COUNT, column_count);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 AddIntListAttributeFromWebObjects(ui::AX_ATTR_OWNS_IDS, owns, dst); 625 AddIntListAttributeFromWebObjects(ui::AX_ATTR_OWNS_IDS, owns, dst);
629 } 626 }
630 627
631 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { 628 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const {
632 if (render_frame_ && render_frame_->GetWebFrame()) 629 if (render_frame_ && render_frame_->GetWebFrame())
633 return render_frame_->GetWebFrame()->document(); 630 return render_frame_->GetWebFrame()->document();
634 return WebDocument(); 631 return WebDocument();
635 } 632 }
636 633
637 } // namespace content 634 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698