Index: ui/views/accessibility/ax_view_obj_wrapper.cc |
diff --git a/ui/views/accessibility/ax_view_obj_wrapper.cc b/ui/views/accessibility/ax_view_obj_wrapper.cc |
index b5c60775c752d93656689fd9b61cea7324d85723..c879790088d16b03b8d0a152acfe0427ed3cd424 100644 |
--- a/ui/views/accessibility/ax_view_obj_wrapper.cc |
+++ b/ui/views/accessibility/ax_view_obj_wrapper.cc |
@@ -5,9 +5,13 @@ |
#include "ui/views/accessibility/ax_view_obj_wrapper.h" |
#include "base/strings/utf_string_conversions.h" |
+#include "content/public/browser/render_process_host.h" |
dmazzoni
2014/10/29 06:53:30
Yeah, you can't include these from here.
I think
|
+#include "content/public/browser/web_contents.h" |
+#include "content/public/browser/render_frame_host.h" |
#include "ui/accessibility/ax_node_data.h" |
#include "ui/accessibility/ax_view_state.h" |
#include "ui/views/accessibility/ax_aura_obj_cache.h" |
+#include "ui/views/controls/webview/webview.h" |
#include "ui/views/view.h" |
#include "ui/views/widget/widget.h" |
@@ -42,6 +46,21 @@ void AXViewObjWrapper::GetChildren( |
void AXViewObjWrapper::Serialize(ui::AXNodeData* out_node_data) { |
ui::AXViewState view_data; |
view_->GetAccessibleState(&view_data); |
+ |
+ // WebView views are considered groups; remap here temporarily. |
+ if (view_->GetClassName() == WebView::kViewClassName) { |
+ view_data.role = ui::AX_ROLE_WEB_AREA; |
dmazzoni
2014/10/29 00:14:11
Why not just fix this in WebView?
Is the WebView
aboxhall
2014/10/29 19:29:11
Further to that - if we consider a WebView a host
David Tseng
2014/10/29 20:35:30
I'm not sure I entirely understand this. We need t
aboxhall
2014/10/29 20:53:29
I think my other comment now merges into this one,
|
+ content::WebContents* contents = |
+ static_cast<WebView*>(view_)->GetWebContents(); |
+ content::RenderFrameHost* rfh = contents->GetMainFrame(); |
+ if (rfh) { |
+ int process_id = rfh->GetProcess()->GetID(); |
+ int routing_id = rfh->GetRoutingID(); |
+ out_node_data->AddIntAttribute(ui::AX_ATTR_PROCESS_ID, process_id); |
+ out_node_data->AddIntAttribute(ui::AX_ATTR_ROUTING_ID, routing_id); |
+ } |
+ } |
+ |
out_node_data->id = GetID(); |
out_node_data->role = view_data.role; |
@@ -58,10 +77,14 @@ void AXViewObjWrapper::Serialize(ui::AXNodeData* out_node_data) { |
out_node_data->AddStringAttribute( |
ui::AX_ATTR_VALUE, base::UTF16ToUTF8(view_data.value)); |
- out_node_data->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, |
- view_data.selection_start); |
- out_node_data->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, |
- view_data.selection_end); |
+ if (view_data.selection_start > -1 && |
+ view_data.selection_end > -1) { |
+ out_node_data->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, |
+ view_data.selection_start); |
+ |
+ out_node_data->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, |
+ view_data.selection_end); |
+ } |
} |
int32 AXViewObjWrapper::GetID() { |