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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 | 10 |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 | 397 |
398 jboolean BrowserAccessibilityManagerAndroid::PopulateAccessibilityNodeInfo( | 398 jboolean BrowserAccessibilityManagerAndroid::PopulateAccessibilityNodeInfo( |
399 JNIEnv* env, | 399 JNIEnv* env, |
400 const JavaParamRef<jobject>& obj, | 400 const JavaParamRef<jobject>& obj, |
401 const JavaParamRef<jobject>& info, | 401 const JavaParamRef<jobject>& info, |
402 jint id) { | 402 jint id) { |
403 BrowserAccessibilityAndroid* node = GetFromUniqueID(id); | 403 BrowserAccessibilityAndroid* node = GetFromUniqueID(id); |
404 if (!node) | 404 if (!node) |
405 return false; | 405 return false; |
406 | 406 |
407 if (node->GetParent()) { | 407 if (node->PlatformGetParent()) { |
408 Java_BrowserAccessibilityManager_setAccessibilityNodeInfoParent( | 408 Java_BrowserAccessibilityManager_setAccessibilityNodeInfoParent( |
409 env, obj, info, node->GetParent()->unique_id()); | 409 env, obj, info, node->PlatformGetParent()->unique_id()); |
410 } | 410 } |
411 for (unsigned i = 0; i < node->PlatformChildCount(); ++i) { | 411 for (unsigned i = 0; i < node->PlatformChildCount(); ++i) { |
412 Java_BrowserAccessibilityManager_addAccessibilityNodeInfoChild( | 412 Java_BrowserAccessibilityManager_addAccessibilityNodeInfoChild( |
413 env, obj, info, node->PlatformGetChild(i)->unique_id()); | 413 env, obj, info, node->PlatformGetChild(i)->unique_id()); |
414 } | 414 } |
415 Java_BrowserAccessibilityManager_setAccessibilityNodeInfoBooleanAttributes( | 415 Java_BrowserAccessibilityManager_setAccessibilityNodeInfoBooleanAttributes( |
416 env, obj, info, | 416 env, obj, info, |
417 id, | 417 id, |
418 node->IsCheckable(), | 418 node->IsCheckable(), |
419 node->IsChecked(), | 419 node->IsChecked(), |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 node->IsLink(), node->IsEditableText()); | 451 node->IsLink(), node->IsEditableText()); |
452 base::string16 element_id; | 452 base::string16 element_id; |
453 if (node->GetHtmlAttribute("id", &element_id)) { | 453 if (node->GetHtmlAttribute("id", &element_id)) { |
454 Java_BrowserAccessibilityManager_setAccessibilityNodeInfoViewIdResourceName( | 454 Java_BrowserAccessibilityManager_setAccessibilityNodeInfoViewIdResourceName( |
455 env, obj, info, | 455 env, obj, info, |
456 base::android::ConvertUTF16ToJavaString(env, element_id)); | 456 base::android::ConvertUTF16ToJavaString(env, element_id)); |
457 } | 457 } |
458 | 458 |
459 gfx::Rect absolute_rect = node->GetPageBoundsRect(); | 459 gfx::Rect absolute_rect = node->GetPageBoundsRect(); |
460 gfx::Rect parent_relative_rect = absolute_rect; | 460 gfx::Rect parent_relative_rect = absolute_rect; |
461 if (node->GetParent()) { | 461 if (node->PlatformGetParent()) { |
462 gfx::Rect parent_rect = node->GetParent()->GetPageBoundsRect(); | 462 gfx::Rect parent_rect = node->PlatformGetParent()->GetPageBoundsRect(); |
463 parent_relative_rect.Offset(-parent_rect.OffsetFromOrigin()); | 463 parent_relative_rect.Offset(-parent_rect.OffsetFromOrigin()); |
464 } | 464 } |
465 bool is_root = node->GetParent() == NULL; | 465 bool is_root = node->PlatformGetParent() == NULL; |
466 Java_BrowserAccessibilityManager_setAccessibilityNodeInfoLocation( | 466 Java_BrowserAccessibilityManager_setAccessibilityNodeInfoLocation( |
467 env, obj, info, | 467 env, obj, info, |
468 id, | 468 id, |
469 absolute_rect.x(), absolute_rect.y(), | 469 absolute_rect.x(), absolute_rect.y(), |
470 parent_relative_rect.x(), parent_relative_rect.y(), | 470 parent_relative_rect.x(), parent_relative_rect.y(), |
471 absolute_rect.width(), absolute_rect.height(), | 471 absolute_rect.width(), absolute_rect.height(), |
472 is_root); | 472 is_root); |
473 | 473 |
474 Java_BrowserAccessibilityManager_setAccessibilityNodeInfoKitKatAttributes( | 474 Java_BrowserAccessibilityManager_setAccessibilityNodeInfoKitKatAttributes( |
475 env, obj, info, is_root, node->IsEditableText(), | 475 env, obj, info, is_root, node->IsEditableText(), |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 static_cast<BrowserAccessibilityAndroid*>(node); | 721 static_cast<BrowserAccessibilityAndroid*>(node); |
722 const BrowserAccessibilityAndroid* sole_interesting_node = | 722 const BrowserAccessibilityAndroid* sole_interesting_node = |
723 android_node->GetSoleInterestingNodeFromSubtree(); | 723 android_node->GetSoleInterestingNodeFromSubtree(); |
724 if (sole_interesting_node) | 724 if (sole_interesting_node) |
725 android_node = sole_interesting_node; | 725 android_node = sole_interesting_node; |
726 | 726 |
727 // Finally, if this node is still uninteresting, try to walk up to | 727 // Finally, if this node is still uninteresting, try to walk up to |
728 // find an interesting parent. | 728 // find an interesting parent. |
729 while (android_node && !android_node->IsInterestingOnAndroid()) { | 729 while (android_node && !android_node->IsInterestingOnAndroid()) { |
730 android_node = static_cast<BrowserAccessibilityAndroid*>( | 730 android_node = static_cast<BrowserAccessibilityAndroid*>( |
731 android_node->GetParent()); | 731 android_node->PlatformGetParent()); |
732 } | 732 } |
733 | 733 |
734 if (android_node) { | 734 if (android_node) { |
735 Java_BrowserAccessibilityManager_handleHover( | 735 Java_BrowserAccessibilityManager_handleHover( |
736 env, obj, android_node->unique_id()); | 736 env, obj, android_node->unique_id()); |
737 } | 737 } |
738 } | 738 } |
739 | 739 |
740 jint BrowserAccessibilityManagerAndroid::FindElementType( | 740 jint BrowserAccessibilityManagerAndroid::FindElementType( |
741 JNIEnv* env, | 741 JNIEnv* env, |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 | 986 |
987 JNIEnv* env = AttachCurrentThread(); | 987 JNIEnv* env = AttachCurrentThread(); |
988 return root_manager->java_ref().get(env); | 988 return root_manager->java_ref().get(env); |
989 } | 989 } |
990 | 990 |
991 bool RegisterBrowserAccessibilityManager(JNIEnv* env) { | 991 bool RegisterBrowserAccessibilityManager(JNIEnv* env) { |
992 return RegisterNativesImpl(env); | 992 return RegisterNativesImpl(env); |
993 } | 993 } |
994 | 994 |
995 } // namespace content | 995 } // namespace content |
OLD | NEW |