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

Side by Side Diff: content/browser/web_contents/web_contents_android.cc

Issue 1137393003: Add style information to the snapshot node (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/web_contents/web_contents_android.h" 5 #include "content/browser/web_contents/web_contents_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 53 }
54 54
55 ScopedJavaLocalRef<jobject> WalkAXTreeDepthFirst(JNIEnv* env, 55 ScopedJavaLocalRef<jobject> WalkAXTreeDepthFirst(JNIEnv* env,
56 BrowserAccessibilityAndroid* node) { 56 BrowserAccessibilityAndroid* node) {
57 57
58 ScopedJavaLocalRef<jstring> j_text = 58 ScopedJavaLocalRef<jstring> j_text =
59 ConvertUTF16ToJavaString(env, node->GetText()); 59 ConvertUTF16ToJavaString(env, node->GetText());
60 ScopedJavaLocalRef<jstring> j_class = 60 ScopedJavaLocalRef<jstring> j_class =
61 ConvertUTF8ToJavaString(env, node->GetClassName()); 61 ConvertUTF8ToJavaString(env, node->GetClassName());
62 const gfx::Rect& location = node->GetLocation(); 62 const gfx::Rect& location = node->GetLocation();
63 int color = node->GetIntAttribute(ui::AX_ATTR_COLOR_VALUE);
dmazzoni 2015/05/19 05:32:19 This is the wrong attribute for text color - COLOR
64 int bkgcolor = node->GetIntAttribute(ui::AX_ATTR_BACKGROUND_COLOR);
65 float size = node->GetFloatAttribute(ui::AX_ATTR_FONT_SIZE);
66 int text_style = node->GetIntAttribute(ui::AX_ATTR_TEXT_STYLE);
sgurun-gerrit only 2015/05/18 23:51:09 is this the right way of getting color, bkgcolor,
67
63 ScopedJavaLocalRef<jobject> j_node = 68 ScopedJavaLocalRef<jobject> j_node =
64 Java_WebContentsImpl_createAccessibilitySnapshotNode(env, 69 Java_WebContentsImpl_createAccessibilitySnapshotNode(env,
65 location.x(), location.y(), node->GetScrollX(), 70 location.x(), location.y(), node->GetScrollX(),
66 node->GetScrollY(), location.width(), location.height(), 71 node->GetScrollY(), location.width(), location.height(),
67 j_text.obj(), j_class.obj()); 72 j_text.obj(), color, bkgcolor, size, text_style, j_class.obj());
68 73
69 for(uint32 i = 0; i < node->PlatformChildCount(); i++) { 74 for(uint32 i = 0; i < node->PlatformChildCount(); i++) {
70 BrowserAccessibilityAndroid* child = 75 BrowserAccessibilityAndroid* child =
71 static_cast<BrowserAccessibilityAndroid*>( 76 static_cast<BrowserAccessibilityAndroid*>(
72 node->PlatformGetChild(i)); 77 node->PlatformGetChild(i));
73 Java_WebContentsImpl_addAccessibilityNodeAsChild(env, 78 Java_WebContentsImpl_addAccessibilityNodeAsChild(env,
74 j_node.obj(), WalkAXTreeDepthFirst(env, child).obj()); 79 j_node.obj(), WalkAXTreeDepthFirst(env, child).obj());
75 } 80 }
76 return j_node; 81 return j_node;
77 } 82 }
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 ScopedJavaGlobalRef<jobject> j_callback; 571 ScopedJavaGlobalRef<jobject> j_callback;
567 j_callback.Reset(env, callback); 572 j_callback.Reset(env, callback);
568 WebContentsImpl::AXTreeSnapshotCallback snapshot_callback = 573 WebContentsImpl::AXTreeSnapshotCallback snapshot_callback =
569 base::Bind(&AXTreeSnapshotCallback, j_callback); 574 base::Bind(&AXTreeSnapshotCallback, j_callback);
570 575
571 static_cast<WebContentsImpl*>(web_contents_)->RequestAXTreeSnapshot( 576 static_cast<WebContentsImpl*>(web_contents_)->RequestAXTreeSnapshot(
572 snapshot_callback); 577 snapshot_callback);
573 } 578 }
574 579
575 } // namespace content 580 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698