OLD | NEW |
---|---|
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 Loading... | |
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); | |
Ted C
2015/05/27 18:45:39
GetIntAttribute returns 0 when this isn't defined.
sgurun-gerrit only
2015/05/27 19:27:24
good point, I actually missed it. It is more attra
sgurun-gerrit only
2015/05/27 19:42:26
ok, talked to Dominic about it. We will check if s
sgurun-gerrit only
2015/05/29 00:35:24
Done.
| |
64 int bgcolor = 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); | |
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, bgcolor, 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 Loading... | |
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 |
OLD | NEW |