Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
liujiuri
engine
提交
60bce44c
E
engine
项目概览
liujiuri
/
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,发现更多精彩内容 >>
提交
60bce44c
编写于
8月 28, 2017
作者:
I
Ian Hickson
提交者:
GitHub
8月 28, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement i18n features in the a11y API. (#4029)
上级
ff720419
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
35 addition
and
6 deletion
+35
-6
lib/ui/semantics.dart
lib/ui/semantics.dart
+5
-1
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
+2
-0
lib/ui/semantics/semantics_update_builder.h
lib/ui/semantics/semantics_update_builder.h
+1
-0
shell/platform/android/io/flutter/view/AccessibilityBridge.java
...platform/android/io/flutter/view/AccessibilityBridge.java
+19
-2
shell/platform/android/platform_view_android.cc
shell/platform/android/platform_view_android.cc
+4
-1
shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm
...tform/darwin/ios/framework/Source/accessibility_bridge.mm
+2
-2
未找到文件。
lib/ui/semantics.dart
浏览文件 @
60bce44c
...
...
@@ -203,7 +203,8 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
/// asynchronously, the [Window.onSemanticsAction] callback might be called
/// with an action that is no longer possible.
///
/// The `label` is a string that describes this node.
/// The `label` is a string that describes this node. Its reading direction is
/// given by `textDirection`.
///
/// The `rect` is the region occupied by this node in its own coordinate
/// system.
...
...
@@ -216,6 +217,7 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
int
actions
,
Rect
rect
,
String
label
,
TextDirection
textDirection
,
Float64List
transform
,
Int32List
children
})
{
...
...
@@ -229,6 +231,7 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
rect
.
right
,
rect
.
bottom
,
label
,
textDirection
!=
null
?
textDirection
.
index
+
1
:
0
,
transform
,
children
);
}
...
...
@@ -241,6 +244,7 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
double
right
,
double
bottom
,
String
label
,
int
textDirection
,
Float64List
transform
,
Int32List
children
)
native
"SemanticsUpdateBuilder_updateNode"
;
...
...
lib/ui/semantics/semantics_node.h
浏览文件 @
60bce44c
...
...
@@ -45,6 +45,8 @@ struct SemanticsNode {
int32_t
flags
=
0
;
int32_t
actions
=
0
;
std
::
string
label
;
int32_t
textDirection
=
0
;
// 0=unknown, 1=rtl, 2=ltr
SkRect
rect
=
SkRect
::
MakeEmpty
();
SkMatrix44
transform
=
SkMatrix44
(
SkMatrix44
::
kIdentity_Constructor
);
std
::
vector
<
int32_t
>
children
;
...
...
lib/ui/semantics/semantics_update_builder.cc
浏览文件 @
60bce44c
...
...
@@ -42,6 +42,7 @@ void SemanticsUpdateBuilder::updateNode(int id,
double
right
,
double
bottom
,
std
::
string
label
,
int
textDirection
,
const
tonic
::
Float64List
&
transform
,
const
tonic
::
Int32List
&
children
)
{
SemanticsNode
node
;
...
...
@@ -50,6 +51,7 @@ void SemanticsUpdateBuilder::updateNode(int id,
node
.
actions
=
actions
;
node
.
rect
=
SkRect
::
MakeLTRB
(
left
,
top
,
right
,
bottom
);
node
.
label
=
label
;
node
.
textDirection
=
textDirection
;
node
.
transform
.
setColMajord
(
transform
.
data
());
node
.
children
=
std
::
vector
<
int32_t
>
(
children
.
data
(),
children
.
data
()
+
children
.
num_elements
());
...
...
lib/ui/semantics/semantics_update_builder.h
浏览文件 @
60bce44c
...
...
@@ -33,6 +33,7 @@ class SemanticsUpdateBuilder
double
right
,
double
bottom
,
std
::
string
label
,
int
textDirection
,
const
tonic
::
Float64List
&
transform
,
const
tonic
::
Int32List
&
children
);
...
...
shell/platform/android/io/flutter/view/AccessibilityBridge.java
浏览文件 @
60bce44c
...
...
@@ -190,7 +190,7 @@ class AccessibilityBridge extends AccessibilityNodeProvider {
if
((
object
.
actions
&
SEMANTICS_ACTION_SCROLL_UP
)
!=
0
)
{
mOwner
.
dispatchSemanticsAction
(
virtualViewId
,
SEMANTICS_ACTION_SCROLL_UP
);
}
else
if
((
object
.
actions
&
SEMANTICS_ACTION_SCROLL_LEFT
)
!=
0
)
{
// TODO(ianh): bidi support
// TODO(ianh): bidi support
using textDirection
mOwner
.
dispatchSemanticsAction
(
virtualViewId
,
SEMANTICS_ACTION_SCROLL_LEFT
);
}
else
if
((
object
.
actions
&
SEMANTICS_ACTION_INCREASE
)
!=
0
)
{
mOwner
.
dispatchSemanticsAction
(
virtualViewId
,
SEMANTICS_ACTION_INCREASE
);
...
...
@@ -203,7 +203,7 @@ class AccessibilityBridge extends AccessibilityNodeProvider {
if
((
object
.
actions
&
SEMANTICS_ACTION_SCROLL_DOWN
)
!=
0
)
{
mOwner
.
dispatchSemanticsAction
(
virtualViewId
,
SEMANTICS_ACTION_SCROLL_DOWN
);
}
else
if
((
object
.
actions
&
SEMANTICS_ACTION_SCROLL_RIGHT
)
!=
0
)
{
// TODO(ianh): bidi support
// TODO(ianh): bidi support
using textDirection
mOwner
.
dispatchSemanticsAction
(
virtualViewId
,
SEMANTICS_ACTION_SCROLL_RIGHT
);
}
else
if
((
object
.
actions
&
SEMANTICS_ACTION_DECREASE
)
!=
0
)
{
mOwner
.
dispatchSemanticsAction
(
virtualViewId
,
SEMANTICS_ACTION_DECREASE
);
...
...
@@ -347,6 +347,20 @@ class AccessibilityBridge extends AccessibilityNodeProvider {
sendAccessibilityEvent
(
0
,
AccessibilityEvent
.
TYPE_WINDOW_CONTENT_CHANGED
);
}
private
enum
TextDirection
{
UNKNOWN
,
LTR
,
RTL
;
public
static
TextDirection
fromInt
(
int
value
)
{
switch
(
value
)
{
case
1
:
return
RTL
;
case
2
:
return
LTR
;
}
return
UNKNOWN
;
}
}
private
class
SemanticsObject
{
SemanticsObject
()
{
}
...
...
@@ -355,6 +369,7 @@ class AccessibilityBridge extends AccessibilityNodeProvider {
int
flags
;
int
actions
;
String
label
;
TextDirection
textDirection
;
private
float
left
;
private
float
top
;
...
...
@@ -394,6 +409,8 @@ class AccessibilityBridge extends AccessibilityNodeProvider {
else
label
=
strings
[
stringIndex
];
textDirection
=
TextDirection
.
fromInt
(
buffer
.
getInt
());
left
=
buffer
.
getFloat
();
top
=
buffer
.
getFloat
();
right
=
buffer
.
getFloat
();
...
...
shell/platform/android/platform_view_android.cc
浏览文件 @
60bce44c
...
...
@@ -421,7 +421,7 @@ bool PlatformViewAndroid::ResourceContextMakeCurrent() {
void
PlatformViewAndroid
::
UpdateSemantics
(
std
::
vector
<
blink
::
SemanticsNode
>
update
)
{
constexpr
size_t
kBytesPerNode
=
2
5
*
sizeof
(
int32_t
);
constexpr
size_t
kBytesPerNode
=
2
6
*
sizeof
(
int32_t
);
constexpr
size_t
kBytesPerChild
=
sizeof
(
int32_t
);
JNIEnv
*
env
=
fml
::
jni
::
AttachCurrentThread
();
...
...
@@ -443,6 +443,8 @@ void PlatformViewAndroid::UpdateSemantics(
std
::
vector
<
std
::
string
>
strings
;
size_t
position
=
0
;
for
(
const
blink
::
SemanticsNode
&
node
:
update
)
{
// If you edit this code, make sure you update kBytesPerNode
// above to match the number of values you are sending.
buffer_int32
[
position
++
]
=
node
.
id
;
buffer_int32
[
position
++
]
=
node
.
flags
;
buffer_int32
[
position
++
]
=
node
.
actions
;
...
...
@@ -452,6 +454,7 @@ void PlatformViewAndroid::UpdateSemantics(
buffer_int32
[
position
++
]
=
strings
.
size
();
strings
.
push_back
(
node
.
label
);
}
buffer_int32
[
position
++
]
=
node
.
textDirection
;
buffer_float32
[
position
++
]
=
node
.
rect
.
left
();
buffer_float32
[
position
++
]
=
node
.
rect
.
top
();
buffer_float32
[
position
++
]
=
node
.
rect
.
right
();
...
...
shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm
浏览文件 @
60bce44c
...
...
@@ -23,10 +23,10 @@ blink::SemanticsAction GetSemanticsActionForScrollDirection(
// directions, which is why the following maps left to right and vice versa.
switch
(
direction
)
{
case
UIAccessibilityScrollDirectionRight
:
case
UIAccessibilityScrollDirectionPrevious
:
// TODO(abarth): Support RTL.
case
UIAccessibilityScrollDirectionPrevious
:
// TODO(abarth): Support RTL
using _node.textDirection
.
return
blink
::
SemanticsAction
::
kScrollLeft
;
case
UIAccessibilityScrollDirectionLeft
:
case
UIAccessibilityScrollDirectionNext
:
// TODO(abarth): Support RTL.
case
UIAccessibilityScrollDirectionNext
:
// TODO(abarth): Support RTL
using _node.textDirection
.
return
blink
::
SemanticsAction
::
kScrollRight
;
case
UIAccessibilityScrollDirectionUp
:
return
blink
::
SemanticsAction
::
kScrollDown
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录