Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
e4cabae5
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,发现更多精彩内容 >>
未验证
提交
e4cabae5
编写于
1月 24, 2018
作者:
M
Michael Goderbauer
提交者:
GitHub
1月 24, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a11y support for selected text (#4584)
上级
d7158609
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
29 addition
and
2 deletion
+29
-2
lib/ui/semantics.dart
lib/ui/semantics.dart
+9
-0
lib/ui/semantics/semantics_node.h
lib/ui/semantics/semantics_node.h
+2
-0
lib/ui/semantics/semantics_update_builder.cc
lib/ui/semantics/semantics_update_builder.cc
+4
-0
lib/ui/semantics/semantics_update_builder.h
lib/ui/semantics/semantics_update_builder.h
+2
-0
shell/platform/android/io/flutter/view/AccessibilityBridge.java
...platform/android/io/flutter/view/AccessibilityBridge.java
+9
-1
shell/platform/android/platform_view_android.cc
shell/platform/android/platform_view_android.cc
+3
-1
未找到文件。
lib/ui/semantics.dart
浏览文件 @
e4cabae5
...
...
@@ -293,6 +293,9 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
/// string describes what result an action performed on this node has. The
/// reading direction of all these strings is given by `textDirection`.
///
/// The fields 'textSelectionStart' and 'textSelectionEnd' describe the
/// currently selected text within `value`.
///
/// The `rect` is the region occupied by this node in its own coordinate
/// system.
///
...
...
@@ -302,6 +305,8 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
int
id
,
int
flags
,
int
actions
,
int
textSelectionStart
,
int
textSelectionEnd
,
Rect
rect
,
String
label
,
String
hint
,
...
...
@@ -318,6 +323,8 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
id
,
flags
,
actions
,
textSelectionStart
,
textSelectionEnd
,
rect
.
left
,
rect
.
top
,
rect
.
right
,
...
...
@@ -336,6 +343,8 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
int
id
,
int
flags
,
int
actions
,
int
textSelectionStart
,
int
textSelectionEnd
,
double
left
,
double
top
,
double
right
,
...
...
lib/ui/semantics/semantics_node.h
浏览文件 @
e4cabae5
...
...
@@ -55,6 +55,8 @@ struct SemanticsNode {
int32_t
id
=
0
;
int32_t
flags
=
0
;
int32_t
actions
=
0
;
int32_t
textSelectionStart
=
-
1
;
int32_t
textSelectionEnd
=
-
1
;
std
::
string
label
;
std
::
string
hint
;
std
::
string
value
;
...
...
lib/ui/semantics/semantics_update_builder.cc
浏览文件 @
e4cabae5
...
...
@@ -37,6 +37,8 @@ SemanticsUpdateBuilder::~SemanticsUpdateBuilder() = default;
void
SemanticsUpdateBuilder
::
updateNode
(
int
id
,
int
flags
,
int
actions
,
int
textSelectionStart
,
int
textSelectionEnd
,
double
left
,
double
top
,
double
right
,
...
...
@@ -53,6 +55,8 @@ void SemanticsUpdateBuilder::updateNode(int id,
node
.
id
=
id
;
node
.
flags
=
flags
;
node
.
actions
=
actions
;
node
.
textSelectionStart
=
textSelectionStart
;
node
.
textSelectionEnd
=
textSelectionEnd
;
node
.
rect
=
SkRect
::
MakeLTRB
(
left
,
top
,
right
,
bottom
);
node
.
label
=
label
;
node
.
hint
=
hint
;
...
...
lib/ui/semantics/semantics_update_builder.h
浏览文件 @
e4cabae5
...
...
@@ -28,6 +28,8 @@ class SemanticsUpdateBuilder
void
updateNode
(
int
id
,
int
flags
,
int
actions
,
int
textSelectionStart
,
int
textSelectionEnd
,
double
left
,
double
top
,
double
right
,
...
...
shell/platform/android/io/flutter/view/AccessibilityBridge.java
浏览文件 @
e4cabae5
...
...
@@ -123,8 +123,12 @@ class AccessibilityBridge extends AccessibilityNodeProvider implements BasicMess
if
(
object
.
hasFlag
(
Flag
.
IS_TEXT_FIELD
))
{
result
.
setClassName
(
"android.widget.EditText"
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR2
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR2
)
{
result
.
setEditable
(
true
);
if
(
object
.
textSelectionStart
!=
-
1
&&
object
.
textSelectionEnd
!=
-
1
)
{
result
.
setTextSelection
(
object
.
textSelectionStart
,
object
.
textSelectionEnd
);
}
}
// Cursor movements
int
granularities
=
0
;
...
...
@@ -599,6 +603,8 @@ class AccessibilityBridge extends AccessibilityNodeProvider implements BasicMess
int
flags
;
int
actions
;
int
textSelectionStart
;
int
textSelectionEnd
;
String
label
;
String
value
;
String
increasedValue
;
...
...
@@ -658,6 +664,8 @@ class AccessibilityBridge extends AccessibilityNodeProvider implements BasicMess
flags
=
buffer
.
getInt
();
actions
=
buffer
.
getInt
();
textSelectionStart
=
buffer
.
getInt
();
textSelectionEnd
=
buffer
.
getInt
();
int
stringIndex
=
buffer
.
getInt
();
label
=
stringIndex
==
-
1
?
null
:
strings
[
stringIndex
];
...
...
shell/platform/android/platform_view_android.cc
浏览文件 @
e4cabae5
...
...
@@ -461,7 +461,7 @@ bool PlatformViewAndroid::ResourceContextMakeCurrent() {
void
PlatformViewAndroid
::
UpdateSemantics
(
std
::
vector
<
blink
::
SemanticsNode
>
update
)
{
constexpr
size_t
kBytesPerNode
=
3
0
*
sizeof
(
int32_t
);
constexpr
size_t
kBytesPerNode
=
3
2
*
sizeof
(
int32_t
);
constexpr
size_t
kBytesPerChild
=
sizeof
(
int32_t
);
JNIEnv
*
env
=
fml
::
jni
::
AttachCurrentThread
();
...
...
@@ -488,6 +488,8 @@ void PlatformViewAndroid::UpdateSemantics(
buffer_int32
[
position
++
]
=
node
.
id
;
buffer_int32
[
position
++
]
=
node
.
flags
;
buffer_int32
[
position
++
]
=
node
.
actions
;
buffer_int32
[
position
++
]
=
node
.
textSelectionStart
;
buffer_int32
[
position
++
]
=
node
.
textSelectionEnd
;
if
(
node
.
label
.
empty
())
{
buffer_int32
[
position
++
]
=
-
1
;
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录