OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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_PLATFORM_TEXT_MARKER_HELPER_MAC_H_ |
| 6 #define UI_ACCESSIBILITY_PLATFORM_TEXT_MARKER_HELPER_MAC_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 |
| 10 #include "ui/accessibility/ax_abstract_position.h" |
| 11 #include "ui/accessibility/ax_export.h" |
| 12 |
| 13 namespace ui { |
| 14 |
| 15 // Provides concrete a AXPosition from the source AXNode for initial text marker |
| 16 // requests. |
| 17 class AX_EXPORT PositionFactory { |
| 18 public: |
| 19 PositionFactory() {} |
| 20 virtual ~PositionFactory() {} |
| 21 |
| 22 virtual AXPositionPointer GetRoot() const = 0; |
| 23 virtual AXRangePointer GetSelection() const = 0; |
| 24 virtual AXPositionPointer GetFromData(const AXPositionData& data) const = 0; |
| 25 virtual id GetAccessibilityObject(const AXPositionData& data) const = 0; |
| 26 }; |
| 27 |
| 28 } // namespace ui |
| 29 |
| 30 // A component that can be placed in an AXNode to satisfy requests from Cocoa |
| 31 // accessibility to create and manipulate AXTextMarker objects. |
| 32 AX_EXPORT |
| 33 @interface TextMarkerHelperMac : NSObject |
| 34 |
| 35 - (instancetype)initWithFactory:(std::unique_ptr<ui::PositionFactory>)factory; |
| 36 |
| 37 // Returns a text marker that points to the first character in the document that |
| 38 // can be selected with VoiceOver. |
| 39 - (id)startTextMarker; |
| 40 |
| 41 // Returns a text marker that points to the last character in the document that |
| 42 // can be selected with VoiceOver. |
| 43 - (id)endTextMarker; |
| 44 |
| 45 // Returns a text marker range corresponding to the current selection. |
| 46 - (id)selectedTextMarkerRange; |
| 47 |
| 48 // Given an AXTextMarkerRangeRef, extract the stored AXPositionData for the |
| 49 // start and end markers. Returns NO if either marker is nil, or if the stored |
| 50 // data is the wrong size. |
| 51 + (BOOL)getRangeDataFromMarkerRange:(id)parameter |
| 52 start:(ui::AXPositionData*)start |
| 53 end:(ui::AXPositionData*)end; |
| 54 |
| 55 @end |
| 56 |
| 57 #endif // UI_ACCESSIBILITY_PLATFORM_TEXT_MARKER_HELPER_MAC_H_ |
OLD | NEW |