nektar | 9de71d4 | 2016-10-21 21:57:00 | [diff] [blame] | 1 | // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef UI_ACCESSIBILITY_AX_NODE_POSITION_H_ |
| 6 | #define UI_ACCESSIBILITY_AX_NODE_POSITION_H_ |
| 7 | |
| 8 | #include <stdint.h> |
| 9 | |
nektar | 491c673 | 2016-12-14 00:14:30 | [diff] [blame] | 10 | #include <vector> |
| 11 | |
| 12 | #include "base/strings/string16.h" |
nektar | 9de71d4 | 2016-10-21 21:57:00 | [diff] [blame] | 13 | #include "ui/accessibility/ax_export.h" |
| 14 | #include "ui/accessibility/ax_node.h" |
| 15 | #include "ui/accessibility/ax_position.h" |
| 16 | #include "ui/accessibility/ax_tree.h" |
| 17 | |
| 18 | namespace ui { |
| 19 | |
| 20 | class AX_EXPORT AXNodePosition : public AXPosition<AXNodePosition, AXNode> { |
| 21 | public: |
| 22 | AXNodePosition(); |
| 23 | ~AXNodePosition() override; |
| 24 | |
nektar | 491c673 | 2016-12-14 00:14:30 | [diff] [blame] | 25 | AXPositionInstance Clone() const override; |
| 26 | |
| 27 | base::string16 GetInnerText() const override; |
| 28 | |
nektar | 9de71d4 | 2016-10-21 21:57:00 | [diff] [blame] | 29 | static void SetTreeForTesting(AXTree* tree) { tree_ = tree; } |
| 30 | |
| 31 | protected: |
nektar | 491c673 | 2016-12-14 00:14:30 | [diff] [blame] | 32 | AXNodePosition(const AXNodePosition& other) = default; |
nektar | 9de71d4 | 2016-10-21 21:57:00 | [diff] [blame] | 33 | void AnchorChild(int child_index, |
| 34 | int* tree_id, |
| 35 | int32_t* child_id) const override; |
| 36 | int AnchorChildCount() const override; |
| 37 | int AnchorIndexInParent() const override; |
| 38 | void AnchorParent(int* tree_id, int32_t* parent_id) const override; |
| 39 | AXNode* GetNodeInTree(int tree_id, int32_t node_id) const override; |
| 40 | int MaxTextOffset() const override; |
nektar | 491c673 | 2016-12-14 00:14:30 | [diff] [blame] | 41 | bool IsInLineBreak() const override; |
| 42 | std::vector<int32_t> GetWordStartOffsets() const override; |
| 43 | std::vector<int32_t> GetWordEndOffsets() const override; |
| 44 | int32_t GetNextOnLineID(int32_t node_id) const override; |
| 45 | int32_t GetPreviousOnLineID(int32_t node_id) const override; |
nektar | 9de71d4 | 2016-10-21 21:57:00 | [diff] [blame] | 46 | |
| 47 | private: |
| 48 | static AXTree* tree_; |
| 49 | }; |
| 50 | |
| 51 | } // namespace ui |
| 52 | |
| 53 | #endif // UI_ACCESSIBILITY_AX_NODE_POSITION_H_ |