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

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

Issue 2408843002: Use BrowserAccessibility::GetClosestPlatformObject consistently (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « content/browser/accessibility/browser_accessibility_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // SendLocationChangeEvents. 216 // SendLocationChangeEvents.
217 if (event_type == ui::AX_EVENT_LAYOUT_COMPLETE) 217 if (event_type == ui::AX_EVENT_LAYOUT_COMPLETE)
218 return; 218 return;
219 219
220 if (event_type == ui::AX_EVENT_HOVER) { 220 if (event_type == ui::AX_EVENT_HOVER) {
221 HandleHoverEvent(node); 221 HandleHoverEvent(node);
222 return; 222 return;
223 } 223 }
224 224
225 // Sometimes we get events on nodes in our internal accessibility tree 225 // Sometimes we get events on nodes in our internal accessibility tree
226 // that aren't exposed on Android. Walk up the ancestors and update |node| 226 // that aren't exposed on Android. Update |node| to point to the highest
227 // to point to the highest ancestor that's a leaf node. 227 // ancestor that's a leaf node.
228 BrowserAccessibility* parent = node->GetParent(); 228 node = node->GetClosestPlatformObject();
229 while (parent) {
230 if (parent->PlatformIsLeaf())
231 node = parent;
232 parent = parent->GetParent();
233 }
234 229
235 // Always send AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED to notify 230 // Always send AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED to notify
236 // the Android system that the accessibility hierarchy rooted at this 231 // the Android system that the accessibility hierarchy rooted at this
237 // node has changed. 232 // node has changed.
238 Java_BrowserAccessibilityManager_handleContentChanged(env, obj, 233 Java_BrowserAccessibilityManager_handleContentChanged(env, obj,
239 node->unique_id()); 234 node->unique_id());
240 235
241 // Ignore load complete events on iframes. 236 // Ignore load complete events on iframes.
242 if (event_type == ui::AX_EVENT_LOAD_COMPLETE && 237 if (event_type == ui::AX_EVENT_LOAD_COMPLETE &&
243 node->manager() != GetRootManager()) { 238 node->manager() != GetRootManager()) {
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 954
960 JNIEnv* env = AttachCurrentThread(); 955 JNIEnv* env = AttachCurrentThread();
961 return root_manager->java_ref().get(env); 956 return root_manager->java_ref().get(env);
962 } 957 }
963 958
964 bool RegisterBrowserAccessibilityManager(JNIEnv* env) { 959 bool RegisterBrowserAccessibilityManager(JNIEnv* env) {
965 return RegisterNativesImpl(env); 960 return RegisterNativesImpl(env);
966 } 961 }
967 962
968 } // namespace content 963 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/browser_accessibility_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698