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

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: fixing unittests Created 5 years, 5 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
« no previous file with comments | « content/public/test/browser_test_utils.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 414
415 // Browser plugin (used in a <webview>). 415 // Browser plugin (used in a <webview>).
416 if (node_to_browser_plugin_instance_id_map_) { 416 if (node_to_browser_plugin_instance_id_map_) {
417 BrowserPlugin* browser_plugin = BrowserPlugin::GetFromNode(element); 417 BrowserPlugin* browser_plugin = BrowserPlugin::GetFromNode(element);
418 if (browser_plugin) { 418 if (browser_plugin) {
419 (*node_to_browser_plugin_instance_id_map_)[dst->id] = 419 (*node_to_browser_plugin_instance_id_map_)[dst->id] =
420 browser_plugin->browser_plugin_instance_id(); 420 browser_plugin->browser_plugin_instance_id();
421 dst->AddBoolAttribute(ui::AX_ATTR_IS_AX_TREE_HOST, true); 421 dst->AddBoolAttribute(ui::AX_ATTR_IS_AX_TREE_HOST, true);
422 } 422 }
423 } 423 }
424
425 // Out-of-process iframe.
426 if (is_iframe && node_to_frame_routing_id_map_) {
427 WebFrame* frame = WebFrame::fromFrameOwnerElement(element);
428
429 if (frame->isWebRemoteFrame()) {
michaeln 2015/07/01 20:57:10 looks like |frame| is sometimes null here and this
430 RenderFrameProxy* render_frame_proxy =
431 RenderFrameProxy::FromWebFrame(frame);
432
433 DCHECK(render_frame_proxy);
434 (*node_to_frame_routing_id_map_)[dst->id] =
435 render_frame_proxy->routing_id();
436 dst->AddBoolAttribute(ui::AX_ATTR_IS_AX_TREE_HOST, true);
437 }
438 }
424 } 439 }
425 440
426 if (src.isInLiveRegion()) { 441 if (src.isInLiveRegion()) {
427 dst->AddBoolAttribute(ui::AX_ATTR_LIVE_ATOMIC, src.liveRegionAtomic()); 442 dst->AddBoolAttribute(ui::AX_ATTR_LIVE_ATOMIC, src.liveRegionAtomic());
428 dst->AddBoolAttribute(ui::AX_ATTR_LIVE_BUSY, src.liveRegionBusy()); 443 dst->AddBoolAttribute(ui::AX_ATTR_LIVE_BUSY, src.liveRegionBusy());
429 if (src.liveRegionBusy()) 444 if (src.liveRegionBusy())
430 dst->state |= (1 << ui::AX_STATE_BUSY); 445 dst->state |= (1 << ui::AX_STATE_BUSY);
431 if (!src.liveRegionStatus().isEmpty()) { 446 if (!src.liveRegionStatus().isEmpty()) {
432 dst->AddStringAttribute(ui::AX_ATTR_LIVE_STATUS, 447 dst->AddStringAttribute(ui::AX_ATTR_LIVE_STATUS,
433 UTF16ToUTF8(src.liveRegionStatus())); 448 UTF16ToUTF8(src.liveRegionStatus()));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 dst->AddBoolAttribute(ui::AX_ATTR_DOC_LOADED, src.isLoaded()); 485 dst->AddBoolAttribute(ui::AX_ATTR_DOC_LOADED, src.isLoaded());
471 dst->AddFloatAttribute(ui::AX_ATTR_DOC_LOADING_PROGRESS, 486 dst->AddFloatAttribute(ui::AX_ATTR_DOC_LOADING_PROGRESS,
472 src.estimatedLoadingProgress()); 487 src.estimatedLoadingProgress());
473 488
474 const WebDocumentType& doctype = document.doctype(); 489 const WebDocumentType& doctype = document.doctype();
475 if (!doctype.isNull()) { 490 if (!doctype.isNull()) {
476 dst->AddStringAttribute(ui::AX_ATTR_DOC_DOCTYPE, 491 dst->AddStringAttribute(ui::AX_ATTR_DOC_DOCTYPE,
477 UTF16ToUTF8(doctype.name())); 492 UTF16ToUTF8(doctype.name()));
478 } 493 }
479 494
480 if (node_to_frame_routing_id_map_ && !src.equals(GetRoot())) {
481 WebLocalFrame* frame = document.frame();
482 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame);
483 if (render_frame) {
484 (*node_to_frame_routing_id_map_)[dst->id] =
485 render_frame->GetRoutingID();
486 dst->AddBoolAttribute(ui::AX_ATTR_IS_AX_TREE_HOST, true);
487 } else {
488 RenderFrameProxy* render_frame_proxy =
489 RenderFrameProxy::FromWebFrame(frame);
490 if (render_frame_proxy) {
491 (*node_to_frame_routing_id_map_)[dst->id] =
492 render_frame_proxy->routing_id();
493 dst->AddBoolAttribute(ui::AX_ATTR_IS_AX_TREE_HOST, true);
494 }
495 }
496 }
497 } 495 }
498 496
499 if (dst->role == ui::AX_ROLE_TABLE) { 497 if (dst->role == ui::AX_ROLE_TABLE) {
500 int column_count = src.columnCount(); 498 int column_count = src.columnCount();
501 int row_count = src.rowCount(); 499 int row_count = src.rowCount();
502 if (column_count > 0 && row_count > 0) { 500 if (column_count > 0 && row_count > 0) {
503 std::set<int32> unique_cell_id_set; 501 std::set<int32> unique_cell_id_set;
504 std::vector<int32> cell_ids; 502 std::vector<int32> cell_ids;
505 std::vector<int32> unique_cell_ids; 503 std::vector<int32> unique_cell_ids;
506 dst->AddIntAttribute(ui::AX_ATTR_TABLE_COLUMN_COUNT, column_count); 504 dst->AddIntAttribute(ui::AX_ATTR_TABLE_COLUMN_COUNT, column_count);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 } 614 }
617 } 615 }
618 616
619 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { 617 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const {
620 if (render_frame_ && render_frame_->GetWebFrame()) 618 if (render_frame_ && render_frame_->GetWebFrame())
621 return render_frame_->GetWebFrame()->document(); 619 return render_frame_->GetWebFrame()->document();
622 return WebDocument(); 620 return WebDocument();
623 } 621 }
624 622
625 } // namespace content 623 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/browser_test_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698