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

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

Issue 2860883003: A11y: Add/refactor methods for manipulating bitfields on AXNodeData. (Closed)
Patch Set: Revert comment. Created 3 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/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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 DeleteAutofillPopupProxy(); 182 DeleteAutofillPopupProxy();
183 183
184 Java_BrowserAccessibilityManager_onNativeObjectDestroyed( 184 Java_BrowserAccessibilityManager_onNativeObjectDestroyed(
185 env, obj, reinterpret_cast<intptr_t>(this)); 185 env, obj, reinterpret_cast<intptr_t>(this));
186 } 186 }
187 187
188 // static 188 // static
189 ui::AXTreeUpdate 189 ui::AXTreeUpdate
190 BrowserAccessibilityManagerAndroid::GetEmptyDocument() { 190 BrowserAccessibilityManagerAndroid::GetEmptyDocument() {
191 ui::AXNodeData empty_document; 191 ui::AXNodeData empty_document;
192 empty_document.ClearBitfields();
192 empty_document.id = 0; 193 empty_document.id = 0;
193 empty_document.role = ui::AX_ROLE_ROOT_WEB_AREA; 194 empty_document.role = ui::AX_ROLE_ROOT_WEB_AREA;
194 empty_document.state = 1 << ui::AX_STATE_READ_ONLY; 195 empty_document.AddState(ui::AX_STATE_READ_ONLY);
195 196
196 ui::AXTreeUpdate update; 197 ui::AXTreeUpdate update;
197 update.root_id = empty_document.id; 198 update.root_id = empty_document.id;
198 update.nodes.push_back(empty_document); 199 update.nodes.push_back(empty_document);
199 return update; 200 return update;
200 } 201 }
201 202
202 void BrowserAccessibilityManagerAndroid::SetContentViewCore( 203 void BrowserAccessibilityManagerAndroid::SetContentViewCore(
203 ScopedJavaLocalRef<jobject> content_view_core) { 204 ScopedJavaLocalRef<jobject> content_view_core) {
204 if (content_view_core.is_null()) 205 if (content_view_core.is_null())
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 BrowserAccessibility* current_focus = GetFocus(); 983 BrowserAccessibility* current_focus = GetFocus();
983 if (current_focus == nullptr) { 984 if (current_focus == nullptr) {
984 return; 985 return;
985 } 986 }
986 987
987 DeleteAutofillPopupProxy(); 988 DeleteAutofillPopupProxy();
988 989
989 g_autofill_popup_proxy_node = BrowserAccessibility::Create(); 990 g_autofill_popup_proxy_node = BrowserAccessibility::Create();
990 g_autofill_popup_proxy_node_ax_node = new ui::AXNode(nullptr, -1, -1); 991 g_autofill_popup_proxy_node_ax_node = new ui::AXNode(nullptr, -1, -1);
991 ui::AXNodeData ax_node_data; 992 ui::AXNodeData ax_node_data;
993 ax_node_data.ClearBitfields();
992 ax_node_data.role = ui::AX_ROLE_MENU; 994 ax_node_data.role = ui::AX_ROLE_MENU;
993 ax_node_data.SetName("Autofill"); 995 ax_node_data.SetName("Autofill");
994 ax_node_data.state = 1 << ui::AX_STATE_READ_ONLY; 996 ax_node_data.AddState(ui::AX_STATE_READ_ONLY);
995 ax_node_data.state |= 1 << ui::AX_STATE_FOCUSABLE; 997 ax_node_data.AddState(ui::AX_STATE_FOCUSABLE);
996 ax_node_data.state |= 1 << ui::AX_STATE_SELECTABLE; 998 ax_node_data.AddState(ui::AX_STATE_SELECTABLE);
997 g_autofill_popup_proxy_node_ax_node->SetData(ax_node_data); 999 g_autofill_popup_proxy_node_ax_node->SetData(ax_node_data);
998 g_autofill_popup_proxy_node->Init(this, g_autofill_popup_proxy_node_ax_node); 1000 g_autofill_popup_proxy_node->Init(this, g_autofill_popup_proxy_node_ax_node);
999 1001
1000 g_element_hosting_autofill_popup_unique_id = current_focus->unique_id(); 1002 g_element_hosting_autofill_popup_unique_id = current_focus->unique_id();
1001 } 1003 }
1002 1004
1003 void BrowserAccessibilityManagerAndroid::OnAutofillPopupDismissed( 1005 void BrowserAccessibilityManagerAndroid::OnAutofillPopupDismissed(
1004 JNIEnv* env, 1006 JNIEnv* env,
1005 const JavaParamRef<jobject>& obj) { 1007 const JavaParamRef<jobject>& obj) {
1006 g_element_hosting_autofill_popup_unique_id = -1; 1008 g_element_hosting_autofill_popup_unique_id = -1;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 1082
1081 JNIEnv* env = AttachCurrentThread(); 1083 JNIEnv* env = AttachCurrentThread();
1082 return root_manager->java_ref().get(env); 1084 return root_manager->java_ref().get(env);
1083 } 1085 }
1084 1086
1085 bool RegisterBrowserAccessibilityManager(JNIEnv* env) { 1087 bool RegisterBrowserAccessibilityManager(JNIEnv* env) {
1086 return RegisterNativesImpl(env); 1088 return RegisterNativesImpl(env);
1087 } 1089 }
1088 1090
1089 } // namespace content 1091 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698