Skip to content

Commit e5690f1

Browse files
authored
chore: cherry-pick 5e04f643 from chromium (#36991)
1 parent 71e1d8e commit e5690f1

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

patches/chromium/.patches

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,4 @@ cherry-pick-2611772cf0a0.patch
126126
cherry-pick-3235c1d1955b.patch
127127
expose_v8initializer_codegenerationcheckcallbackinmainthread.patch
128128
cherry-pick-43637378b14e.patch
129+
axselectedtextmarkerrange_should_not_be_backwards.patch
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Valerie Young <spectranaut@igalia.com>
3+
Date: Mon, 14 Nov 2022 19:53:31 +0000
4+
Subject: AXSelectedTextMarkerRange should not be backwards
5+
6+
AXSelectedTextMarkerRange was changed to backwards in this commit:
7+
https://chromium-review.googlesource.com/c/chromium/src/+/2330812
8+
In response to this bug:
9+
https://bugs.chromium.org/p/chromium/issues/detail?id=1110480
10+
After switching the range back to forward, the bug above is not
11+
repeatable.
12+
13+
Fixed: 1172956
14+
Change-Id: I8f32e807e91514e3d74393b1ec54960ffdfacdcb
15+
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3994770
16+
Reviewed-by: Aaron Leventhal <aleventhal@chromium.org>
17+
Commit-Queue: Valerie Young <spectranaut@igalia.com>
18+
Cr-Commit-Position: refs/heads/main@{#1071150}
19+
20+
diff --git a/content/browser/accessibility/ax_tree_formatter_mac_browsertest.mm b/content/browser/accessibility/ax_tree_formatter_mac_browsertest.mm
21+
index 46426469b3728f470c102812c454fd838b3f006f..250180222304766ca2b25d1dcd5df248f3087833 100644
22+
--- a/content/browser/accessibility/ax_tree_formatter_mac_browsertest.mm
23+
+++ b/content/browser/accessibility/ax_tree_formatter_mac_browsertest.mm
24+
@@ -206,7 +206,7 @@ AccessibilityNotificationWaiter waiter(shell()->web_contents(),
25+
</script>)~~",
26+
{":3;AXSelectedTextMarkerRange=*"}, R"~~(AXWebArea
27+
++AXGroup
28+
-++++AXStaticText AXSelectedTextMarkerRange={anchor: {:2, -1, down}, focus: {:3, 0, down}}
29+
+++++AXStaticText AXSelectedTextMarkerRange={anchor: {:3, 0, down}, focus: {:2, -1, down}}
30+
)~~");
31+
}
32+
33+
diff --git a/content/browser/accessibility/browser_accessibility_cocoa.mm b/content/browser/accessibility/browser_accessibility_cocoa.mm
34+
index 55cce7ff53b355cea2787abca6140f122f6a0369..202923773d7adb2fad5c15be4558bfd548ec6c7d 100644
35+
--- a/content/browser/accessibility/browser_accessibility_cocoa.mm
36+
+++ b/content/browser/accessibility/browser_accessibility_cocoa.mm
37+
@@ -1347,9 +1347,7 @@ - (id)selectedTextMarkerRange {
38+
if (ax_range.IsNull())
39+
return nil;
40+
41+
- // Voiceover expects this range to be backwards in order to read the selected
42+
- // words correctly.
43+
- return AXRangeToAXTextMarkerRange(ax_range.AsBackwardRange());
44+
+ return AXRangeToAXTextMarkerRange(std::move(ax_range));
45+
}
46+
47+
- (NSString*)sortDirection {
48+
diff --git a/content/test/data/accessibility/mac/selection/selectall-textarea-expected.txt b/content/test/data/accessibility/mac/selection/selectall-textarea-expected.txt
49+
index f2638c5d03b16266e781bb74cfc08c65f7c0a60d..34036471ad01d0fcfc7bd9b7213f1b4edcded719 100644
50+
--- a/content/test/data/accessibility/mac/selection/selectall-textarea-expected.txt
51+
+++ b/content/test/data/accessibility/mac/selection/selectall-textarea-expected.txt
52+
@@ -1,4 +1,4 @@
53+
textarea_range={anchor: {:3, 0, down}, focus: {:3, 19, down}}
54+
textarea.AXSelectedTextMarkerRange={anchor: {:3, 0, down}, focus: {:3, 19, down}}
55+
AXSelectedTextChanged on AXTextArea AXValue='The quick brown fox' AXTextSelectionDirection=AXTextSelectionDirectionUnknown AXTextSelectionGranularity=AXTextSelectionGranularityUnknown AXTextStateChangeType=AXTextStateChangeTypeSelectionMove
56+
-textarea.AXSelectedTextMarkerRange={anchor: {:3, 19, down}, focus: {:3, 0, down}}
57+
+textarea.AXSelectedTextMarkerRange={anchor: {:3, 0, down}, focus: {:3, 19, down}}

0 commit comments

Comments
 (0)