Index: content/renderer/accessibility/blink_ax_tree_source.cc |
diff --git a/content/renderer/accessibility/blink_ax_tree_source.cc b/content/renderer/accessibility/blink_ax_tree_source.cc |
index 068f03a213e8e2858d9e008812a3d0d40a198c0c..4607812a949d4f3ffcdd239746bed0dcfaafa883 100644 |
--- a/content/renderer/accessibility/blink_ax_tree_source.cc |
+++ b/content/renderer/accessibility/blink_ax_tree_source.cc |
@@ -10,6 +10,7 @@ |
#include "base/strings/string_util.h" |
#include "base/strings/utf_string_conversions.h" |
#include "content/renderer/accessibility/blink_ax_enum_conversion.h" |
+#include "content/renderer/browser_plugin/browser_plugin.h" |
#include "content/renderer/render_frame_impl.h" |
#include "content/renderer/render_frame_proxy.h" |
#include "content/renderer/render_view_impl.h" |
@@ -25,8 +26,9 @@ |
#include "third_party/WebKit/public/web/WebFormControlElement.h" |
#include "third_party/WebKit/public/web/WebFrame.h" |
#include "third_party/WebKit/public/web/WebLocalFrame.h" |
-#include "third_party/WebKit/public/web/WebInputElement.h" |
#include "third_party/WebKit/public/web/WebNode.h" |
+#include "third_party/WebKit/public/web/WebPlugin.h" |
+#include "third_party/WebKit/public/web/WebPluginContainer.h" |
#include "third_party/WebKit/public/web/WebView.h" |
using base::ASCIIToUTF16; |
@@ -37,6 +39,8 @@ using blink::WebDocumentType; |
using blink::WebElement; |
using blink::WebLocalFrame; |
using blink::WebNode; |
+using blink::WebPlugin; |
+using blink::WebPluginContainer; |
using blink::WebVector; |
using blink::WebView; |
@@ -97,7 +101,9 @@ void AddIntListAttributeFromWebObjects(ui::AXIntListAttribute attr, |
} // Anonymous namespace |
BlinkAXTreeSource::BlinkAXTreeSource(RenderFrameImpl* render_frame) |
- : render_frame_(render_frame) { |
+ : render_frame_(render_frame), |
+ node_to_frame_routing_id_map_(NULL), |
+ node_to_browser_plugin_instance_id_map_(NULL) { |
} |
BlinkAXTreeSource::~BlinkAXTreeSource() { |
@@ -114,8 +120,11 @@ bool BlinkAXTreeSource::IsInTree(blink::WebAXObject node) const { |
} |
void BlinkAXTreeSource::CollectChildFrameIdMapping( |
- std::map<int32, int>* node_to_frame_routing_id_map) { |
+ std::map<int32, int>* node_to_frame_routing_id_map, |
+ std::map<int32, int>* node_to_browser_plugin_instance_id_map) { |
node_to_frame_routing_id_map_ = node_to_frame_routing_id_map; |
+ node_to_browser_plugin_instance_id_map_ = |
+ node_to_browser_plugin_instance_id_map; |
} |
blink::WebAXObject BlinkAXTreeSource::GetRoot() const { |
@@ -350,6 +359,25 @@ void BlinkAXTreeSource::SerializeNode(blink::WebAXObject src, |
live_busy = UTF16ToUTF8(element.getAttribute("aria-busy")); |
live_status = UTF16ToUTF8(element.getAttribute("aria-live")); |
live_relevant = UTF16ToUTF8(element.getAttribute("aria-relevant")); |
+ |
+ // Browser plugin (used in a <webview>). |
+ |
+ if (node_to_browser_plugin_instance_id_map_ && |
+ element.tagName() == base::ASCIIToUTF16("OBJECT") && |
+ element.getAttribute("type") == |
+ base::ASCIIToUTF16("application/browser-plugin")) { |
Fady Samuel
2014/09/11 17:50:19
I'm a little bit sad that we need to hard code the
dmazzoni
2014/09/12 07:34:35
Sure. I went ahead and put it in BrowserPlugin lik
Fady Samuel
2014/09/12 15:47:44
Yup, thanks! :-)
|
+ WebPluginContainer* plugin_container = element.pluginContainer(); |
+ if (plugin_container) { |
+ WebPlugin* plugin = plugin_container->plugin(); |
+ if (plugin) { |
+ BrowserPlugin* browser_plugin = static_cast<BrowserPlugin*>(plugin); |
+ node_to_browser_plugin_instance_id_map_->insert( |
+ std::pair<int32, int>( |
Fady Samuel
2014/09/11 17:50:19
Is it possible to make this a struct instead for r
dmazzoni
2014/09/12 07:34:35
I'm not sure how much more clear I can get than ca
Fady Samuel
2014/09/12 15:47:44
Ohh sorry, I missed that this is a map and not a v
|
+ dst->id, browser_plugin->browser_plugin_instance_id())); |
+ dst->AddBoolAttribute(ui::AX_ATTR_IS_AX_TREE_HOST, true); |
+ } |
+ } |
+ } |
} |
// Walk up the parent chain to set live region attributes of containers |
@@ -463,12 +491,14 @@ void BlinkAXTreeSource::SerializeNode(blink::WebAXObject src, |
if (render_frame) { |
node_to_frame_routing_id_map_->insert(std::pair<int32, int>( |
dst->id, render_frame->GetRoutingID())); |
+ dst->AddBoolAttribute(ui::AX_ATTR_IS_AX_TREE_HOST, true); |
} else { |
RenderFrameProxy* render_frame_proxy = |
RenderFrameProxy::FromWebFrame(frame); |
if (render_frame_proxy) { |
node_to_frame_routing_id_map_->insert(std::pair<int32, int>( |
dst->id, render_frame_proxy->routing_id())); |
+ dst->AddBoolAttribute(ui::AX_ATTR_IS_AX_TREE_HOST, true); |
} |
} |
} |