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

Side by Side Diff: content/browser/accessibility/browser_accessibility_manager_android.cc

Issue 2217363002: Use relative bounding boxes throughout Chrome accessibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback from aboxhall Created 4 years, 4 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/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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 base::android::ConvertUTF16ToJavaString(env, node->GetText()).obj(), 433 base::android::ConvertUTF16ToJavaString(env, node->GetText()).obj(),
434 node->IsLink(), 434 node->IsLink(),
435 node->IsEditableText()); 435 node->IsEditableText());
436 base::string16 element_id; 436 base::string16 element_id;
437 if (node->GetHtmlAttribute("id", &element_id)) { 437 if (node->GetHtmlAttribute("id", &element_id)) {
438 Java_BrowserAccessibilityManager_setAccessibilityNodeInfoViewIdResourceName( 438 Java_BrowserAccessibilityManager_setAccessibilityNodeInfoViewIdResourceName(
439 env, obj, info, 439 env, obj, info,
440 base::android::ConvertUTF16ToJavaString(env, element_id).obj()); 440 base::android::ConvertUTF16ToJavaString(env, element_id).obj());
441 } 441 }
442 442
443 gfx::Rect absolute_rect = node->GetLocalBoundsRect(); 443 gfx::Rect absolute_rect = node->GetPageBoundsRect();
444 gfx::Rect parent_relative_rect = absolute_rect; 444 gfx::Rect parent_relative_rect = absolute_rect;
445 if (node->GetParent()) { 445 if (node->GetParent()) {
446 gfx::Rect parent_rect = node->GetParent()->GetLocalBoundsRect(); 446 gfx::Rect parent_rect = node->GetParent()->GetPageBoundsRect();
447 parent_relative_rect.Offset(-parent_rect.OffsetFromOrigin()); 447 parent_relative_rect.Offset(-parent_rect.OffsetFromOrigin());
448 } 448 }
449 bool is_root = node->GetParent() == NULL; 449 bool is_root = node->GetParent() == NULL;
450 Java_BrowserAccessibilityManager_setAccessibilityNodeInfoLocation( 450 Java_BrowserAccessibilityManager_setAccessibilityNodeInfoLocation(
451 env, obj, info, 451 env, obj, info,
452 id, 452 id,
453 absolute_rect.x(), absolute_rect.y(), 453 absolute_rect.x(), absolute_rect.y(),
454 parent_relative_rect.x(), parent_relative_rect.y(), 454 parent_relative_rect.x(), parent_relative_rect.y(),
455 absolute_rect.width(), absolute_rect.height(), 455 absolute_rect.width(), absolute_rect.height(),
456 is_root); 456 is_root);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 const JavaParamRef<jobject>& obj) { 616 const JavaParamRef<jobject>& obj) {
617 SetFocus(*GetRoot()); 617 SetFocus(*GetRoot());
618 } 618 }
619 619
620 void BrowserAccessibilityManagerAndroid::ScrollToMakeNodeVisible( 620 void BrowserAccessibilityManagerAndroid::ScrollToMakeNodeVisible(
621 JNIEnv* env, 621 JNIEnv* env,
622 const JavaParamRef<jobject>& obj, 622 const JavaParamRef<jobject>& obj,
623 jint id) { 623 jint id) {
624 BrowserAccessibilityAndroid* node = GetFromUniqueID(id); 624 BrowserAccessibilityAndroid* node = GetFromUniqueID(id);
625 if (node) 625 if (node)
626 ScrollToMakeVisible(*node, gfx::Rect(node->GetLocation().size())); 626 ScrollToMakeVisible(*node, gfx::Rect(node->GetFrameBoundsRect().size()));
627 } 627 }
628 628
629 void BrowserAccessibilityManagerAndroid::SetTextFieldValue( 629 void BrowserAccessibilityManagerAndroid::SetTextFieldValue(
630 JNIEnv* env, 630 JNIEnv* env,
631 const JavaParamRef<jobject>& obj, 631 const JavaParamRef<jobject>& obj,
632 jint id, 632 jint id,
633 const JavaParamRef<jstring>& value) { 633 const JavaParamRef<jstring>& value) {
634 BrowserAccessibilityAndroid* node = GetFromUniqueID(id); 634 BrowserAccessibilityAndroid* node = GetFromUniqueID(id);
635 if (node) { 635 if (node) {
636 BrowserAccessibilityManager::SetValue( 636 BrowserAccessibilityManager::SetValue(
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 955
956 JNIEnv* env = AttachCurrentThread(); 956 JNIEnv* env = AttachCurrentThread();
957 return root_manager->java_ref().get(env); 957 return root_manager->java_ref().get(env);
958 } 958 }
959 959
960 bool RegisterBrowserAccessibilityManager(JNIEnv* env) { 960 bool RegisterBrowserAccessibilityManager(JNIEnv* env) {
961 return RegisterNativesImpl(env); 961 return RegisterNativesImpl(env);
962 } 962 }
963 963
964 } // namespace content 964 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698