Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
a00f9458
E
engine
项目概览
weixin_43355755
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
a00f9458
编写于
2月 09, 2018
作者:
M
Michael Goderbauer
提交者:
GitHub
2月 09, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add accessibilityFocus and loseAccessibilityFocus as a11y actions (#4655)
上级
8ac6f6ef
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
64 addition
and
1 deletion
+64
-1
lib/ui/semantics.dart
lib/ui/semantics.dart
+34
-0
lib/ui/semantics/semantics_node.h
lib/ui/semantics/semantics_node.h
+9
-0
shell/platform/android/io/flutter/view/AccessibilityBridge.java
...platform/android/io/flutter/view/AccessibilityBridge.java
+5
-1
shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm
...tform/darwin/ios/framework/Source/accessibility_bridge.mm
+14
-0
shell/platform/darwin/ios/framework/Source/accessibility_text_entry.mm
...m/darwin/ios/framework/Source/accessibility_text_entry.mm
+2
-0
未找到文件。
lib/ui/semantics.dart
浏览文件 @
a00f9458
...
...
@@ -24,6 +24,8 @@ class SemanticsAction {
static
const
int
_kCopyIndex
=
1
<<
12
;
static
const
int
_kCutIndex
=
1
<<
13
;
static
const
int
_kPasteIndex
=
1
<<
14
;
static
const
int
_kDidGainAccessibilityFocusIndex
=
1
<<
15
;
static
const
int
_kDidLoseAccessibilityFocusIndex
=
1
<<
16
;
/// The numerical value for this action.
///
...
...
@@ -118,6 +120,32 @@ class SemanticsAction {
/// Paste the current content of the clipboard.
static
const
SemanticsAction
paste
=
const
SemanticsAction
.
_
(
_kPasteIndex
);
/// Indicates that the nodes has gained accessibility focus.
///
/// This handler is invoked when the node annotated with this handler gains
/// the accessibility focus. The accessibility focus is the
/// green (on Android with TalkBack) or black (on iOS with VoiceOver)
/// rectangle shown on screen to indicate what element an accessibility
/// user is currently interacting with.
///
/// The accessibility focus is different from the input focus. The input focus
/// is usually held by the element that currently responds to keyboard inputs.
/// Accessibility focus and input focus can be held by two different nodes!
static
const
SemanticsAction
didGainAccessibilityFocus
=
const
SemanticsAction
.
_
(
_kDidGainAccessibilityFocusIndex
);
/// Indicates that the nodes has lost accessibility focus.
///
/// This handler is invoked when the node annotated with this handler
/// loses the accessibility focus. The accessibility focus is
/// the green (on Android with TalkBack) or black (on iOS with VoiceOver)
/// rectangle shown on screen to indicate what element an accessibility
/// user is currently interacting with.
///
/// The accessibility focus is different from the input focus. The input focus
/// is usually held by the element that currently responds to keyboard inputs.
/// Accessibility focus and input focus can be held by two different nodes!
static
const
SemanticsAction
didLoseAccessibilityFocus
=
const
SemanticsAction
.
_
(
_kDidLoseAccessibilityFocusIndex
);
/// The possible semantics actions.
///
/// The map's key is the [index] of the action and the value is the action
...
...
@@ -138,6 +166,8 @@ class SemanticsAction {
_kCopyIndex:
copy
,
_kCutIndex:
cut
,
_kPasteIndex:
paste
,
_kDidGainAccessibilityFocusIndex:
didGainAccessibilityFocus
,
_kDidLoseAccessibilityFocusIndex:
didLoseAccessibilityFocus
,
};
@override
...
...
@@ -173,6 +203,10 @@ class SemanticsAction {
return
'SemanticsAction.cut'
;
case
_kPasteIndex:
return
'SemanticsAction.paste'
;
case
_kDidGainAccessibilityFocusIndex:
return
'SemanticsAction.didGainAccessibilityFocus'
;
case
_kDidLoseAccessibilityFocusIndex:
return
'SemanticsAction.didLoseAccessibilityFocus'
;
}
return
null
;
}
...
...
lib/ui/semantics/semantics_node.h
浏览文件 @
a00f9458
...
...
@@ -26,6 +26,15 @@ enum class SemanticsAction : int32_t {
kScrollDown
=
1
<<
5
,
kIncrease
=
1
<<
6
,
kDecrease
=
1
<<
7
,
kShowOnScreen
=
1
<<
8
,
kMoveCursorForwardByCharacter
=
1
<<
9
,
kMoveCursorBackwardByCharacter
=
1
<<
10
,
kSetSelection
=
1
<<
11
,
kCopy
=
1
<<
12
,
kCut
=
1
<<
13
,
kPaste
=
1
<<
14
,
kDidGainAccessibilityFocus
=
1
<<
15
,
kDidLoseAccessibilityFocus
=
1
<<
16
,
};
const
int
kScrollableSemanticsActions
=
...
...
shell/platform/android/io/flutter/view/AccessibilityBridge.java
浏览文件 @
a00f9458
...
...
@@ -63,7 +63,9 @@ class AccessibilityBridge extends AccessibilityNodeProvider implements BasicMess
SET_SELECTION
(
1
<<
11
),
COPY
(
1
<<
12
),
CUT
(
1
<<
13
),
PASTE
(
1
<<
14
);
PASTE
(
1
<<
14
),
DID_GAIN_ACCESSIBILITY_FOCUS
(
1
<<
15
),
DID_LOSE_ACCESSIBILITY_FOCUS
(
1
<<
16
);
Action
(
int
value
)
{
this
.
value
=
value
;
...
...
@@ -312,11 +314,13 @@ class AccessibilityBridge extends AccessibilityNodeProvider implements BasicMess
return
performCursorMoveAction
(
object
,
virtualViewId
,
arguments
,
true
);
}
case
AccessibilityNodeInfo
.
ACTION_CLEAR_ACCESSIBILITY_FOCUS
:
{
mOwner
.
dispatchSemanticsAction
(
virtualViewId
,
Action
.
DID_LOSE_ACCESSIBILITY_FOCUS
);
sendAccessibilityEvent
(
virtualViewId
,
AccessibilityEvent
.
TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED
);
mA11yFocusedObject
=
null
;
return
true
;
}
case
AccessibilityNodeInfo
.
ACTION_ACCESSIBILITY_FOCUS
:
{
mOwner
.
dispatchSemanticsAction
(
virtualViewId
,
Action
.
DID_GAIN_ACCESSIBILITY_FOCUS
);
sendAccessibilityEvent
(
virtualViewId
,
AccessibilityEvent
.
TYPE_VIEW_ACCESSIBILITY_FOCUSED
);
if
(
mA11yFocusedObject
==
null
)
{
...
...
shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm
浏览文件 @
a00f9458
...
...
@@ -257,6 +257,20 @@ bool GeometryComparator(SemanticsObject* a, SemanticsObject* b) {
return
YES
;
}
#pragma mark UIAccessibilityFocus overrides
-
(
void
)
accessibilityElementDidBecomeFocused
{
if
([
self
node
].
HasAction
(
blink
::
SemanticsAction
::
kDidGainAccessibilityFocus
))
{
[
self
bridge
]
->
DispatchSemanticsAction
([
self
uid
],
blink
::
SemanticsAction
::
kDidGainAccessibilityFocus
);
}
}
-
(
void
)
accessibilityElementDidLoseFocus
{
if
([
self
node
].
HasAction
(
blink
::
SemanticsAction
::
kDidLoseAccessibilityFocus
))
{
[
self
bridge
]
->
DispatchSemanticsAction
([
self
uid
],
blink
::
SemanticsAction
::
kDidLoseAccessibilityFocus
);
}
}
@end
@implementation
FlutterSemanticsObject
{
...
...
shell/platform/darwin/ios/framework/Source/accessibility_text_entry.mm
浏览文件 @
a00f9458
...
...
@@ -224,10 +224,12 @@
-
(
void
)
accessibilityElementDidBecomeFocused
{
[[
self
textInputSurrogate
]
accessibilityElementDidBecomeFocused
];
[
super
accessibilityElementDidBecomeFocused
];
}
-
(
void
)
accessibilityElementDidLoseFocus
{
[[
self
textInputSurrogate
]
accessibilityElementDidLoseFocus
];
[
super
accessibilityElementDidLoseFocus
];
}
-
(
BOOL
)
accessibilityElementIsFocused
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录