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

Side by Side Diff: content/browser/accessibility/browser_accessibility_manager.h

Issue 2393123002: Implement caching asynchronous accessibility hit testing. (Closed)
Patch Set: Made test more robust 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 376
377 // Returns the BrowserAccessibilityDelegate from |GetRootManager|, above. 377 // Returns the BrowserAccessibilityDelegate from |GetRootManager|, above.
378 BrowserAccessibilityDelegate* GetDelegateFromRootManager(); 378 BrowserAccessibilityDelegate* GetDelegateFromRootManager();
379 379
380 // Returns whether this is the top document. 380 // Returns whether this is the top document.
381 bool IsRootTree(); 381 bool IsRootTree();
382 382
383 // Get a snapshot of the current tree as an AXTreeUpdate. 383 // Get a snapshot of the current tree as an AXTreeUpdate.
384 ui::AXTreeUpdate SnapshotAXTreeForTesting(); 384 ui::AXTreeUpdate SnapshotAXTreeForTesting();
385 385
386 // Given a point in screen coordinates, trigger an asynchronous hit test
387 // but return the best possible match instantly.
388 //
389 //
390 BrowserAccessibility* CachingAsyncHitTest(const gfx::Point& screen_point);
391
392 // Called in response to a hover event, caches the result for the next
393 // call to CachingAsyncHitTest().
394 void CacheHitTestResult(BrowserAccessibility* hit_test_result);
395
386 protected: 396 protected:
387 BrowserAccessibilityManager( 397 BrowserAccessibilityManager(
388 BrowserAccessibilityDelegate* delegate, 398 BrowserAccessibilityDelegate* delegate,
389 BrowserAccessibilityFactory* factory); 399 BrowserAccessibilityFactory* factory);
390 400
391 BrowserAccessibilityManager( 401 BrowserAccessibilityManager(
392 const ui::AXTreeUpdate& initial_tree, 402 const ui::AXTreeUpdate& initial_tree,
393 BrowserAccessibilityDelegate* delegate, 403 BrowserAccessibilityDelegate* delegate,
394 BrowserAccessibilityFactory* factory); 404 BrowserAccessibilityFactory* factory);
395 405
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 // These are only used by the root BrowserAccessibilityManager of a 456 // These are only used by the root BrowserAccessibilityManager of a
447 // frame tree. Stores the last focused node and last focused manager so 457 // frame tree. Stores the last focused node and last focused manager so
448 // that when focus might have changed we can figure out whether we need 458 // that when focus might have changed we can figure out whether we need
449 // to fire a focus event. 459 // to fire a focus event.
450 // 460 //
451 // NOTE: these pointers are not cleared, so they should never be 461 // NOTE: these pointers are not cleared, so they should never be
452 // dereferenced, only used for comparison. 462 // dereferenced, only used for comparison.
453 BrowserAccessibility* last_focused_node_; 463 BrowserAccessibility* last_focused_node_;
454 BrowserAccessibilityManager* last_focused_manager_; 464 BrowserAccessibilityManager* last_focused_manager_;
455 465
466 // These cache the AX tree ID, node ID, and global screen bounds of the
467 // last object found by an asynchronous hit test. Subsequent hit test
468 // requests that remain within this object's bounds will return the same
469 // object, but will also trigger a new asynchronous hit test request.
470 int last_hover_ax_tree_id_;
471 int last_hover_node_id_;
472 gfx::Rect last_hover_bounds_;
473
456 // True if the root's parent is in another accessibility tree and that 474 // True if the root's parent is in another accessibility tree and that
457 // parent's child is the root. Ensures that the parent node is notified 475 // parent's child is the root. Ensures that the parent node is notified
458 // once when this subtree is first connected. 476 // once when this subtree is first connected.
459 bool connected_to_parent_tree_node_; 477 bool connected_to_parent_tree_node_;
460 478
461 // The global ID of this accessibility tree. 479 // The global ID of this accessibility tree.
462 AXTreeIDRegistry::AXTreeID ax_tree_id_; 480 AXTreeIDRegistry::AXTreeID ax_tree_id_;
463 481
464 // If this tree has a parent tree, this is the cached ID of the parent 482 // If this tree has a parent tree, this is the cached ID of the parent
465 // node within that parent tree. It's computed as needed and cached for 483 // node within that parent tree. It's computed as needed and cached for
466 // speed so that it can be accessed quickly if it hasn't changed. 484 // speed so that it can be accessed quickly if it hasn't changed.
467 int parent_node_id_from_parent_tree_; 485 int parent_node_id_from_parent_tree_;
468 486
469 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); 487 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager);
470 }; 488 };
471 489
472 } // namespace content 490 } // namespace content
473 491
474 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ 492 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698