Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / content / renderer / accessibility / renderer_accessibility_focus_only.cc
index cea316e..dd57f91 100644 (file)
@@ -4,19 +4,19 @@
 
 #include "content/renderer/accessibility/renderer_accessibility_focus_only.h"
 
-#include "content/common/accessibility_node_data.h"
 #include "content/renderer/render_view_impl.h"
 #include "third_party/WebKit/public/web/WebDocument.h"
 #include "third_party/WebKit/public/web/WebElement.h"
 #include "third_party/WebKit/public/web/WebFrame.h"
 #include "third_party/WebKit/public/web/WebNode.h"
 #include "third_party/WebKit/public/web/WebView.h"
+#include "ui/accessibility/ax_node_data.h"
 
-using WebKit::WebDocument;
-using WebKit::WebElement;
-using WebKit::WebFrame;
-using WebKit::WebNode;
-using WebKit::WebView;
+using blink::WebDocument;
+using blink::WebElement;
+using blink::WebFrame;
+using blink::WebNode;
+using blink::WebView;
 
 namespace {
 // The root node will always have id 1. Let each child node have a new
@@ -36,7 +36,7 @@ RendererAccessibilityFocusOnly::~RendererAccessibilityFocusOnly() {
 }
 
 void RendererAccessibilityFocusOnly::HandleWebAccessibilityEvent(
-    const WebKit::WebAXObject& obj, WebKit::WebAXEvent event) {
+    const blink::WebAXObject& obj, blink::WebAXEvent event) {
   // Do nothing.
 }
 
@@ -45,7 +45,7 @@ void RendererAccessibilityFocusOnly::FocusedNodeChanged(const WebNode& node) {
   HandleFocusedNodeChanged(node, true);
 }
 
-void RendererAccessibilityFocusOnly::DidFinishLoad(WebKit::WebFrame* frame) {
+void RendererAccessibilityFocusOnly::DidFinishLoad(blink::WebFrame* frame) {
   WebView* view = render_view()->GetWebView();
   if (view->focusedFrame() != frame)
     return;
@@ -87,31 +87,29 @@ void RendererAccessibilityFocusOnly::HandleFocusedNodeChanged(
   // native focus changed event, we can send a LayoutComplete
   // event, which doesn't post a native event on Windows.
   event.event_type =
-      send_focus_event ?
-      WebKit::WebAXEventFocus :
-      WebKit::WebAXEventLayoutComplete;
+      send_focus_event ? ui::AX_EVENT_FOCUS : ui::AX_EVENT_LAYOUT_COMPLETE;
 
   // Set the id that the event applies to: the root node if nothing
   // has focus, otherwise the focused node.
   event.id = node_has_focus ? next_id_ : 1;
 
   event.nodes.resize(2);
-  AccessibilityNodeData& root = event.nodes[0];
-  AccessibilityNodeData& child = event.nodes[1];
+  ui::AXNodeData& root = event.nodes[0];
+  ui::AXNodeData& child = event.nodes[1];
 
   // Always include the root of the tree, the document. It always has id 1.
   root.id = 1;
-  root.role = WebKit::WebAXRoleRootWebArea;
+  root.role = ui::AX_ROLE_ROOT_WEB_AREA;
   root.state =
-      (1 << WebKit::WebAXStateReadonly) |
-      (1 << WebKit::WebAXStateFocusable);
+      (1 << ui::AX_STATE_READ_ONLY) |
+      (1 << ui::AX_STATE_FOCUSABLE);
   if (!node_has_focus)
-    root.state |= (1 << WebKit::WebAXStateFocused);
+    root.state |= (1 << ui::AX_STATE_FOCUSED);
   root.location = gfx::Rect(render_view_->size());
   root.child_ids.push_back(next_id_);
 
   child.id = next_id_;
-  child.role = WebKit::WebAXRoleGroup;
+  child.role = ui::AX_ROLE_GROUP;
 
   if (!node.isNull() && node.isElementNode()) {
     child.location = gfx::Rect(
@@ -124,20 +122,22 @@ void RendererAccessibilityFocusOnly::HandleFocusedNodeChanged(
 
   if (node_has_focus) {
     child.state =
-        (1 << WebKit::WebAXStateFocusable) |
-        (1 << WebKit::WebAXStateFocused);
+        (1 << ui::AX_STATE_FOCUSABLE) |
+        (1 << ui::AX_STATE_FOCUSED);
     if (!node_is_editable_text)
-      child.state |= (1 << WebKit::WebAXStateReadonly);
+      child.state |= (1 << ui::AX_STATE_READ_ONLY);
   }
 
 #ifndef NDEBUG
+  /**
   if (logging_) {
-    LOG(INFO) << "Accessibility update: \n"
+    VLOG(0) << "Accessibility update: \n"
         << "routing id=" << routing_id()
         << " event="
         << AccessibilityEventToString(event.event_type)
         << "\n" << event.nodes[0].DebugString(true);
   }
+  **/
 #endif
 
   Send(new AccessibilityHostMsg_Events(routing_id(), events));