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

Unified Diff: ui/accessibility/platform/text_marker_helper_mac.h

Issue 2940923003: a11y: Move CreateTextMarker[Range] to TextMarkerHelperMac.
Patch Set: squish? Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/accessibility/ax_position.h ('k') | ui/accessibility/platform/text_marker_helper_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/accessibility/platform/text_marker_helper_mac.h
diff --git a/ui/accessibility/platform/text_marker_helper_mac.h b/ui/accessibility/platform/text_marker_helper_mac.h
new file mode 100644
index 0000000000000000000000000000000000000000..d9303d739d28c8945ea2538c8c4ce4c1e96c2058
--- /dev/null
+++ b/ui/accessibility/platform/text_marker_helper_mac.h
@@ -0,0 +1,57 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_ACCESSIBILITY_PLATFORM_TEXT_MARKER_HELPER_MAC_H_
+#define UI_ACCESSIBILITY_PLATFORM_TEXT_MARKER_HELPER_MAC_H_
+
+#import <Foundation/Foundation.h>
+
+#include "ui/accessibility/ax_abstract_position.h"
+#include "ui/accessibility/ax_export.h"
+
+namespace ui {
+
+// Provides concrete a AXPosition from the source AXNode for initial text marker
+// requests.
+class AX_EXPORT PositionFactory {
+ public:
+ PositionFactory() {}
+ virtual ~PositionFactory() {}
+
+ virtual AXPositionPointer GetRoot() const = 0;
+ virtual AXRangePointer GetSelection() const = 0;
+ virtual AXPositionPointer GetFromData(const AXPositionData& data) const = 0;
+ virtual id GetAccessibilityObject(const AXPositionData& data) const = 0;
+};
+
+} // namespace ui
+
+// A component that can be placed in an AXNode to satisfy requests from Cocoa
+// accessibility to create and manipulate AXTextMarker objects.
+AX_EXPORT
+@interface TextMarkerHelperMac : NSObject
+
+- (instancetype)initWithFactory:(std::unique_ptr<ui::PositionFactory>)factory;
+
+// Returns a text marker that points to the first character in the document that
+// can be selected with VoiceOver.
+- (id)startTextMarker;
+
+// Returns a text marker that points to the last character in the document that
+// can be selected with VoiceOver.
+- (id)endTextMarker;
+
+// Returns a text marker range corresponding to the current selection.
+- (id)selectedTextMarkerRange;
+
+// Given an AXTextMarkerRangeRef, extract the stored AXPositionData for the
+// start and end markers. Returns NO if either marker is nil, or if the stored
+// data is the wrong size.
++ (BOOL)getRangeDataFromMarkerRange:(id)parameter
+ start:(ui::AXPositionData*)start
+ end:(ui::AXPositionData*)end;
+
+@end
+
+#endif // UI_ACCESSIBILITY_PLATFORM_TEXT_MARKER_HELPER_MAC_H_
« no previous file with comments | « ui/accessibility/ax_position.h ('k') | ui/accessibility/platform/text_marker_helper_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698