| OLD | NEW |
| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 // If the two objects provided have a common ancestor returns both the | 313 // If the two objects provided have a common ancestor returns both the |
| 314 // common ancestor and the child indices of the two subtrees in which the | 314 // common ancestor and the child indices of the two subtrees in which the |
| 315 // objects are located. | 315 // objects are located. |
| 316 // Returns false if a common ancestor cannot be found. | 316 // Returns false if a common ancestor cannot be found. |
| 317 static bool FindIndicesInCommonParent(const BrowserAccessibility& object1, | 317 static bool FindIndicesInCommonParent(const BrowserAccessibility& object1, |
| 318 const BrowserAccessibility& object2, | 318 const BrowserAccessibility& object2, |
| 319 BrowserAccessibility** common_parent, | 319 BrowserAccessibility** common_parent, |
| 320 int* child_index1, | 320 int* child_index1, |
| 321 int* child_index2); | 321 int* child_index2); |
| 322 | 322 |
| 323 // Sets |out_is_before| to true if |object1| comes before |object2| |
| 324 // in tree order (pre-order traversal), and false if the objects are the |
| 325 // same or not in the same tree. |
| 326 static ui::AXTreeOrder CompareNodes( |
| 327 const BrowserAccessibility& object1, |
| 328 const BrowserAccessibility& object2); |
| 329 |
| 323 static std::vector<const BrowserAccessibility*> FindTextOnlyObjectsInRange( | 330 static std::vector<const BrowserAccessibility*> FindTextOnlyObjectsInRange( |
| 324 const BrowserAccessibility& start_object, | 331 const BrowserAccessibility& start_object, |
| 325 const BrowserAccessibility& end_object); | 332 const BrowserAccessibility& end_object); |
| 326 | 333 |
| 327 static base::string16 GetTextForRange( | 334 static base::string16 GetTextForRange( |
| 328 const BrowserAccessibility& start_object, | 335 const BrowserAccessibility& start_object, |
| 329 const BrowserAccessibility& end_object); | 336 const BrowserAccessibility& end_object); |
| 330 | 337 |
| 331 // If start and end offsets are greater than the text's length, returns all | 338 // If start and end offsets are greater than the text's length, returns all |
| 332 // the text. | 339 // the text. |
| 333 static base::string16 GetTextForRange( | 340 static base::string16 GetTextForRange( |
| 334 const BrowserAccessibility& start_object, | 341 const BrowserAccessibility& start_object, |
| 335 int start_offset, | 342 int start_offset, |
| 336 const BrowserAccessibility& end_object, | 343 const BrowserAccessibility& end_object, |
| 337 int end_offset); | 344 int end_offset); |
| 338 | 345 |
| 346 static gfx::Rect GetLocalBoundsForRange( |
| 347 const BrowserAccessibility& start_object, |
| 348 int start_offset, |
| 349 const BrowserAccessibility& end_object, |
| 350 int end_offset); |
| 351 |
| 339 // Accessors. | 352 // Accessors. |
| 340 AXTreeIDRegistry::AXTreeID ax_tree_id() const { return ax_tree_id_; } | 353 AXTreeIDRegistry::AXTreeID ax_tree_id() const { return ax_tree_id_; } |
| 341 | 354 |
| 342 // AXTreeDelegate implementation. | 355 // AXTreeDelegate implementation. |
| 343 void OnNodeDataWillChange(ui::AXTree* tree, | 356 void OnNodeDataWillChange(ui::AXTree* tree, |
| 344 const ui::AXNodeData& old_node_data, | 357 const ui::AXNodeData& old_node_data, |
| 345 const ui::AXNodeData& new_node_data) override; | 358 const ui::AXNodeData& new_node_data) override; |
| 346 void OnTreeDataChanged(ui::AXTree* tree) override; | 359 void OnTreeDataChanged(ui::AXTree* tree) override; |
| 347 void OnNodeWillBeDeleted(ui::AXTree* tree, ui::AXNode* node) override; | 360 void OnNodeWillBeDeleted(ui::AXTree* tree, ui::AXNode* node) override; |
| 348 void OnSubtreeWillBeDeleted(ui::AXTree* tree, ui::AXNode* node) override; | 361 void OnSubtreeWillBeDeleted(ui::AXTree* tree, ui::AXNode* node) override; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 // node within that parent tree. It's computed as needed and cached for | 464 // node within that parent tree. It's computed as needed and cached for |
| 452 // speed so that it can be accessed quickly if it hasn't changed. | 465 // speed so that it can be accessed quickly if it hasn't changed. |
| 453 int parent_node_id_from_parent_tree_; | 466 int parent_node_id_from_parent_tree_; |
| 454 | 467 |
| 455 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); | 468 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); |
| 456 }; | 469 }; |
| 457 | 470 |
| 458 } // namespace content | 471 } // namespace content |
| 459 | 472 |
| 460 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ | 473 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ |
| OLD | NEW |