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/accessibility/browser_accessibility_manager_android.h" | 5 #include "content/browser/accessibility/browser_accessibility_manager_android.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 break; | 187 break; |
188 } | 188 } |
189 } | 189 } |
190 | 190 |
191 jint BrowserAccessibilityManagerAndroid::GetRootId(JNIEnv* env, jobject obj) { | 191 jint BrowserAccessibilityManagerAndroid::GetRootId(JNIEnv* env, jobject obj) { |
192 return static_cast<jint>(GetRoot()->GetId()); | 192 return static_cast<jint>(GetRoot()->GetId()); |
193 } | 193 } |
194 | 194 |
195 jboolean BrowserAccessibilityManagerAndroid::IsNodeValid( | 195 jboolean BrowserAccessibilityManagerAndroid::IsNodeValid( |
196 JNIEnv* env, jobject obj, jint id) { | 196 JNIEnv* env, jobject obj, jint id) { |
197 return GetFromID(id) != NULL; | 197 return GetFromID(id) != nullptr; |
198 } | 198 } |
199 | 199 |
200 void BrowserAccessibilityManagerAndroid::HitTest( | 200 void BrowserAccessibilityManagerAndroid::HitTest( |
201 JNIEnv* env, jobject obj, jint x, jint y) { | 201 JNIEnv* env, jobject obj, jint x, jint y) { |
202 if (delegate()) | 202 if (delegate()) |
203 delegate()->AccessibilityHitTest(gfx::Point(x, y)); | 203 delegate()->AccessibilityHitTest(gfx::Point(x, y)); |
204 } | 204 } |
205 | 205 |
206 jboolean BrowserAccessibilityManagerAndroid::PopulateAccessibilityNodeInfo( | 206 jboolean BrowserAccessibilityManagerAndroid::PopulateAccessibilityNodeInfo( |
207 JNIEnv* env, jobject obj, jobject info, jint id) { | 207 JNIEnv* env, jobject obj, jobject info, jint id) { |
(...skipping 30 matching lines...) Expand all Loading... |
238 env, obj, info, | 238 env, obj, info, |
239 base::android::ConvertUTF16ToJavaString(env, node->GetText()).obj(), | 239 base::android::ConvertUTF16ToJavaString(env, node->GetText()).obj(), |
240 node->IsLink()); | 240 node->IsLink()); |
241 | 241 |
242 gfx::Rect absolute_rect = node->GetLocalBoundsRect(); | 242 gfx::Rect absolute_rect = node->GetLocalBoundsRect(); |
243 gfx::Rect parent_relative_rect = absolute_rect; | 243 gfx::Rect parent_relative_rect = absolute_rect; |
244 if (node->GetParent()) { | 244 if (node->GetParent()) { |
245 gfx::Rect parent_rect = node->GetParent()->GetLocalBoundsRect(); | 245 gfx::Rect parent_rect = node->GetParent()->GetLocalBoundsRect(); |
246 parent_relative_rect.Offset(-parent_rect.OffsetFromOrigin()); | 246 parent_relative_rect.Offset(-parent_rect.OffsetFromOrigin()); |
247 } | 247 } |
248 bool is_root = node->GetParent() == NULL; | 248 bool is_root = node->GetParent() == nullptr; |
249 Java_BrowserAccessibilityManager_setAccessibilityNodeInfoLocation( | 249 Java_BrowserAccessibilityManager_setAccessibilityNodeInfoLocation( |
250 env, obj, info, | 250 env, obj, info, |
251 id, | 251 id, |
252 absolute_rect.x(), absolute_rect.y(), | 252 absolute_rect.x(), absolute_rect.y(), |
253 parent_relative_rect.x(), parent_relative_rect.y(), | 253 parent_relative_rect.x(), parent_relative_rect.y(), |
254 absolute_rect.width(), absolute_rect.height(), | 254 absolute_rect.width(), absolute_rect.height(), |
255 is_root); | 255 is_root); |
256 | 256 |
257 // New KitKat APIs | 257 // New KitKat APIs |
258 Java_BrowserAccessibilityManager_setAccessibilityNodeInfoKitKatAttributes( | 258 Java_BrowserAccessibilityManager_setAccessibilityNodeInfoKitKatAttributes( |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 BrowserAccessibilityManagerAndroid::UseRootScrollOffsetsWhenComputingBounds() { | 499 BrowserAccessibilityManagerAndroid::UseRootScrollOffsetsWhenComputingBounds() { |
500 // The Java layer handles the root scroll offset. | 500 // The Java layer handles the root scroll offset. |
501 return false; | 501 return false; |
502 } | 502 } |
503 | 503 |
504 bool RegisterBrowserAccessibilityManager(JNIEnv* env) { | 504 bool RegisterBrowserAccessibilityManager(JNIEnv* env) { |
505 return RegisterNativesImpl(env); | 505 return RegisterNativesImpl(env); |
506 } | 506 } |
507 | 507 |
508 } // namespace content | 508 } // namespace content |
OLD | NEW |