Bug 1653421 - Part 2: Add attributed string for range getter. r=morgan
authorEitan Isaacson <eitan@monotonous.org>
Tue, 21 Jul 2020 23:02:55 +0000
changeset 541524 1d37ebf3d20ce8071c7482fbf7bcdc37834e950c
parent 541523 daeda032926d1fb85aca0d9117d9e77ea677d2b4
child 541525 5972532c773757211b0d30ed34a3849bae0dc5a9
push id37625
push usercsabou@mozilla.com
push dateWed, 22 Jul 2020 04:32:41 +0000
treeherdermozilla-central@6dfc866efa7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmorgan
bugs1653421
milestone80.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1653421 - Part 2: Add attributed string for range getter. r=morgan This doesn't actually add any attributes yet. VoiceOver uses this instead of the plain string equivalent. Differential Revision: https://phabricator.services.mozilla.com/D84054
accessible/mac/MOXAccessibleProtocol.h
accessible/mac/MOXTextMarkerDelegate.h
accessible/mac/MOXTextMarkerDelegate.mm
--- a/accessible/mac/MOXAccessibleProtocol.h
+++ b/accessible/mac/MOXAccessibleProtocol.h
@@ -362,9 +362,12 @@
 - (id _Nullable)moxEndTextMarkerForTextMarkerRange:(id _Nonnull)textMarkerRange;
 
 // AXNextTextMarkerForTextMarker
 - (id _Nullable)moxNextTextMarkerForTextMarker:(id _Nonnull)textMarker;
 
 // AXPreviousTextMarkerForTextMarker
 - (id _Nullable)moxPreviousTextMarkerForTextMarker:(id _Nonnull)textMarker;
 
+// AXAttributedStringForTextMarkerRange
+- (NSAttributedString* _Nullable)moxAttributedStringForTextMarkerRange:(id _Nonnull)textMarkerRange;
+
 @end
--- a/accessible/mac/MOXTextMarkerDelegate.h
+++ b/accessible/mac/MOXTextMarkerDelegate.h
@@ -60,9 +60,12 @@
 - (id)moxRightWordTextMarkerRangeForTextMarker:(id)textMarker;
 
 // override
 - (id)moxNextTextMarkerForTextMarker:(id)textMarker;
 
 // override
 - (id)moxPreviousTextMarkerForTextMarker:(id)textMarker;
 
+// override
+- (NSAttributedString*)moxAttributedStringForTextMarkerRange:(id)textMarkerRange;
+
 @end
--- a/accessible/mac/MOXTextMarkerDelegate.mm
+++ b/accessible/mac/MOXTextMarkerDelegate.mm
@@ -189,9 +189,14 @@ static nsDataHashtable<nsUint64HashKey, 
   if (geckoTextMarker.mOffset == 0) {
     return nil;
   }
 
   geckoTextMarker.mOffset--;
   return geckoTextMarker.CreateAXTextMarker();
 }
 
+- (NSAttributedString*)moxAttributedStringForTextMarkerRange:(id)textMarkerRange {
+  return [[[NSAttributedString alloc]
+      initWithString:[self moxStringForTextMarkerRange:textMarkerRange]] autorelease];
+}
+
 @end