| OLD | NEW |
| 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 Loading... |
| 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::WebFrame; | 40 using blink::WebLocalFrame; |
| 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 Loading... |
| 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()) { | |
| 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 } | |
| 439 } | 424 } |
| 440 | 425 |
| 441 if (src.isInLiveRegion()) { | 426 if (src.isInLiveRegion()) { |
| 442 dst->AddBoolAttribute(ui::AX_ATTR_LIVE_ATOMIC, src.liveRegionAtomic()); | 427 dst->AddBoolAttribute(ui::AX_ATTR_LIVE_ATOMIC, src.liveRegionAtomic()); |
| 443 dst->AddBoolAttribute(ui::AX_ATTR_LIVE_BUSY, src.liveRegionBusy()); | 428 dst->AddBoolAttribute(ui::AX_ATTR_LIVE_BUSY, src.liveRegionBusy()); |
| 444 if (src.liveRegionBusy()) | 429 if (src.liveRegionBusy()) |
| 445 dst->state |= (1 << ui::AX_STATE_BUSY); | 430 dst->state |= (1 << ui::AX_STATE_BUSY); |
| 446 if (!src.liveRegionStatus().isEmpty()) { | 431 if (!src.liveRegionStatus().isEmpty()) { |
| 447 dst->AddStringAttribute(ui::AX_ATTR_LIVE_STATUS, | 432 dst->AddStringAttribute(ui::AX_ATTR_LIVE_STATUS, |
| 448 UTF16ToUTF8(src.liveRegionStatus())); | 433 UTF16ToUTF8(src.liveRegionStatus())); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 dst->AddBoolAttribute(ui::AX_ATTR_DOC_LOADED, src.isLoaded()); | 470 dst->AddBoolAttribute(ui::AX_ATTR_DOC_LOADED, src.isLoaded()); |
| 486 dst->AddFloatAttribute(ui::AX_ATTR_DOC_LOADING_PROGRESS, | 471 dst->AddFloatAttribute(ui::AX_ATTR_DOC_LOADING_PROGRESS, |
| 487 src.estimatedLoadingProgress()); | 472 src.estimatedLoadingProgress()); |
| 488 | 473 |
| 489 const WebDocumentType& doctype = document.doctype(); | 474 const WebDocumentType& doctype = document.doctype(); |
| 490 if (!doctype.isNull()) { | 475 if (!doctype.isNull()) { |
| 491 dst->AddStringAttribute(ui::AX_ATTR_DOC_DOCTYPE, | 476 dst->AddStringAttribute(ui::AX_ATTR_DOC_DOCTYPE, |
| 492 UTF16ToUTF8(doctype.name())); | 477 UTF16ToUTF8(doctype.name())); |
| 493 } | 478 } |
| 494 | 479 |
| 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 } |
| 495 } | 497 } |
| 496 | 498 |
| 497 if (dst->role == ui::AX_ROLE_TABLE) { | 499 if (dst->role == ui::AX_ROLE_TABLE) { |
| 498 int column_count = src.columnCount(); | 500 int column_count = src.columnCount(); |
| 499 int row_count = src.rowCount(); | 501 int row_count = src.rowCount(); |
| 500 if (column_count > 0 && row_count > 0) { | 502 if (column_count > 0 && row_count > 0) { |
| 501 std::set<int32> unique_cell_id_set; | 503 std::set<int32> unique_cell_id_set; |
| 502 std::vector<int32> cell_ids; | 504 std::vector<int32> cell_ids; |
| 503 std::vector<int32> unique_cell_ids; | 505 std::vector<int32> unique_cell_ids; |
| 504 dst->AddIntAttribute(ui::AX_ATTR_TABLE_COLUMN_COUNT, column_count); | 506 dst->AddIntAttribute(ui::AX_ATTR_TABLE_COLUMN_COUNT, column_count); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 } | 616 } |
| 615 } | 617 } |
| 616 | 618 |
| 617 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { | 619 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { |
| 618 if (render_frame_ && render_frame_->GetWebFrame()) | 620 if (render_frame_ && render_frame_->GetWebFrame()) |
| 619 return render_frame_->GetWebFrame()->document(); | 621 return render_frame_->GetWebFrame()->document(); |
| 620 return WebDocument(); | 622 return WebDocument(); |
| 621 } | 623 } |
| 622 | 624 |
| 623 } // namespace content | 625 } // namespace content |
| OLD | NEW |