Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
30b829e7
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
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,发现更多精彩内容 >>
未验证
提交
30b829e7
编写于
9月 03, 2020
作者:
A
Alexander Brusher
提交者:
GitHub
9月 03, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Populates fuchsia node actions in semantics updates. (#20451)
上级
ac8b9c4c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
67 addition
and
0 deletion
+67
-0
shell/platform/fuchsia/flutter/accessibility_bridge.cc
shell/platform/fuchsia/flutter/accessibility_bridge.cc
+31
-0
shell/platform/fuchsia/flutter/accessibility_bridge.h
shell/platform/fuchsia/flutter/accessibility_bridge.h
+6
-0
shell/platform/fuchsia/flutter/accessibility_bridge_unittest.cc
...platform/fuchsia/flutter/accessibility_bridge_unittest.cc
+30
-0
未找到文件。
shell/platform/fuchsia/flutter/accessibility_bridge.cc
浏览文件 @
30b829e7
...
...
@@ -115,6 +115,36 @@ fuchsia::accessibility::semantics::States AccessibilityBridge::GetNodeStates(
return
states
;
}
std
::
vector
<
fuchsia
::
accessibility
::
semantics
::
Action
>
AccessibilityBridge
::
GetNodeActions
(
const
flutter
::
SemanticsNode
&
node
,
size_t
*
additional_size
)
const
{
std
::
vector
<
fuchsia
::
accessibility
::
semantics
::
Action
>
node_actions
;
if
(
node
.
HasAction
(
flutter
::
SemanticsAction
::
kTap
))
{
node_actions
.
push_back
(
fuchsia
::
accessibility
::
semantics
::
Action
::
DEFAULT
);
}
if
(
node
.
HasAction
(
flutter
::
SemanticsAction
::
kLongPress
))
{
node_actions
.
push_back
(
fuchsia
::
accessibility
::
semantics
::
Action
::
SECONDARY
);
}
if
(
node
.
HasAction
(
flutter
::
SemanticsAction
::
kShowOnScreen
))
{
node_actions
.
push_back
(
fuchsia
::
accessibility
::
semantics
::
Action
::
SHOW_ON_SCREEN
);
}
if
(
node
.
HasAction
(
flutter
::
SemanticsAction
::
kIncrease
))
{
node_actions
.
push_back
(
fuchsia
::
accessibility
::
semantics
::
Action
::
INCREMENT
);
}
if
(
node
.
HasAction
(
flutter
::
SemanticsAction
::
kDecrease
))
{
node_actions
.
push_back
(
fuchsia
::
accessibility
::
semantics
::
Action
::
DECREMENT
);
}
*
additional_size
+=
node_actions
.
size
()
*
sizeof
(
fuchsia
::
accessibility
::
semantics
::
Action
);
return
node_actions
;
}
std
::
unordered_set
<
int32_t
>
AccessibilityBridge
::
GetDescendants
(
int32_t
node_id
)
const
{
std
::
unordered_set
<
int32_t
>
descendents
;
...
...
@@ -227,6 +257,7 @@ void AccessibilityBridge::AddSemanticsNodeUpdate(
.
set_transform
(
GetNodeTransform
(
flutter_node
))
.
set_attributes
(
GetNodeAttributes
(
flutter_node
,
&
this_node_size
))
.
set_states
(
GetNodeStates
(
flutter_node
,
&
this_node_size
))
.
set_actions
(
GetNodeActions
(
flutter_node
,
&
this_node_size
))
.
set_child_ids
(
child_ids
);
this_node_size
+=
kNodeIdSize
*
flutter_node
.
childrenInTraversalOrder
.
size
();
...
...
shell/platform/fuchsia/flutter/accessibility_bridge.h
浏览文件 @
30b829e7
...
...
@@ -145,6 +145,12 @@ class AccessibilityBridge
const
flutter
::
SemanticsNode
&
node
,
size_t
*
additional_size
)
const
;
// Derives the set of supported actions for a Fuchsia semantics node from
// a Flutter semantics node.
std
::
vector
<
fuchsia
::
accessibility
::
semantics
::
Action
>
GetNodeActions
(
const
flutter
::
SemanticsNode
&
node
,
size_t
*
additional_size
)
const
;
// Gets the set of reachable descendants from the given node id.
std
::
unordered_set
<
int32_t
>
GetDescendants
(
int32_t
node_id
)
const
;
...
...
shell/platform/fuchsia/flutter/accessibility_bridge_unittest.cc
浏览文件 @
30b829e7
...
...
@@ -237,6 +237,36 @@ TEST_F(AccessibilityBridgeTest, PopulatesHiddenState) {
EXPECT_FALSE
(
semantics_manager_
.
UpdateOverflowed
());
}
TEST_F
(
AccessibilityBridgeTest
,
PopulatesActions
)
{
flutter
::
SemanticsNode
node0
;
node0
.
id
=
0
;
node0
.
actions
|=
static_cast
<
int
>
(
flutter
::
SemanticsAction
::
kTap
);
node0
.
actions
|=
static_cast
<
int
>
(
flutter
::
SemanticsAction
::
kLongPress
);
node0
.
actions
|=
static_cast
<
int
>
(
flutter
::
SemanticsAction
::
kShowOnScreen
);
node0
.
actions
|=
static_cast
<
int
>
(
flutter
::
SemanticsAction
::
kIncrease
);
node0
.
actions
|=
static_cast
<
int
>
(
flutter
::
SemanticsAction
::
kDecrease
);
accessibility_bridge_
->
AddSemanticsNodeUpdate
({{
0
,
node0
}});
RunLoopUntilIdle
();
EXPECT_EQ
(
0
,
semantics_manager_
.
DeleteCount
());
EXPECT_EQ
(
1
,
semantics_manager_
.
UpdateCount
());
EXPECT_EQ
(
1
,
semantics_manager_
.
CommitCount
());
EXPECT_EQ
(
1u
,
semantics_manager_
.
LastUpdatedNodes
().
size
());
const
auto
&
fuchsia_node
=
semantics_manager_
.
LastUpdatedNodes
().
at
(
0u
);
EXPECT_EQ
(
fuchsia_node
.
actions
().
size
(),
5u
);
EXPECT_EQ
(
fuchsia_node
.
actions
().
at
(
0u
),
fuchsia
::
accessibility
::
semantics
::
Action
::
DEFAULT
);
EXPECT_EQ
(
fuchsia_node
.
actions
().
at
(
1u
),
fuchsia
::
accessibility
::
semantics
::
Action
::
SECONDARY
);
EXPECT_EQ
(
fuchsia_node
.
actions
().
at
(
2u
),
fuchsia
::
accessibility
::
semantics
::
Action
::
SHOW_ON_SCREEN
);
EXPECT_EQ
(
fuchsia_node
.
actions
().
at
(
3u
),
fuchsia
::
accessibility
::
semantics
::
Action
::
INCREMENT
);
EXPECT_EQ
(
fuchsia_node
.
actions
().
at
(
4u
),
fuchsia
::
accessibility
::
semantics
::
Action
::
DECREMENT
);
}
TEST_F
(
AccessibilityBridgeTest
,
TruncatesLargeLabel
)
{
// Test that labels which are too long are truncated.
flutter
::
SemanticsNode
node0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录