Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
96efe392
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,发现更多精彩内容 >>
未验证
提交
96efe392
编写于
9月 01, 2020
作者:
J
Jim Graham
提交者:
GitHub
9月 01, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Adds fuchsia node roles to accessibility bridge updates. (#20385)" (#20936)
This reverts commit
58a62076
.
上级
d67bda72
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
3 addition
and
123 deletion
+3
-123
lib/ui/semantics.dart
lib/ui/semantics.dart
+2
-12
lib/ui/semantics/semantics_node.h
lib/ui/semantics/semantics_node.h
+0
-1
lib/web_ui/lib/src/ui/semantics.dart
lib/web_ui/lib/src/ui/semantics.dart
+0
-3
shell/platform/fuchsia/flutter/accessibility_bridge.cc
shell/platform/fuchsia/flutter/accessibility_bridge.cc
+0
-26
shell/platform/fuchsia/flutter/accessibility_bridge.h
shell/platform/fuchsia/flutter/accessibility_bridge.h
+0
-5
shell/platform/fuchsia/flutter/accessibility_bridge_unittest.cc
...platform/fuchsia/flutter/accessibility_bridge_unittest.cc
+0
-75
testing/dart/semantics_test.dart
testing/dart/semantics_test.dart
+1
-1
未找到文件。
lib/ui/semantics.dart
浏览文件 @
96efe392
...
...
@@ -300,12 +300,8 @@ class SemanticsFlag {
static
const
int
_kIsReadOnlyIndex
=
1
<<
20
;
static
const
int
_kIsFocusableIndex
=
1
<<
21
;
static
const
int
_kIsLinkIndex
=
1
<<
22
;
static
const
int
_kIsSliderIndex
=
1
<<
23
;
// READ THIS: if you add a flag here, you MUST update the numSemanticsFlags
// value in testing/dart/semantics_test.dart, or tests will fail. Also,
// please update the Flag enum in
// flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java,
// and the SemanticsFlag class in lib/web_ui/lib/src/ui/semantics.dart.
// value in testing/dart/semantics_test.dart, or tests will fail.
const
SemanticsFlag
.
_
(
this
.
index
)
:
assert
(
index
!=
null
);
// ignore: unnecessary_null_comparison
...
...
@@ -359,9 +355,6 @@ class SemanticsFlag {
/// affordances.
static
const
SemanticsFlag
isTextField
=
SemanticsFlag
.
_
(
_kIsTextFieldIndex
);
/// Whether the semantic node represents a slider.
static
const
SemanticsFlag
isSlider
=
SemanticsFlag
.
_
(
_kIsSliderIndex
);
/// Whether the semantic node is read only.
///
/// Only applicable when [isTextField] is true.
...
...
@@ -558,8 +551,7 @@ class SemanticsFlag {
_kIsReadOnlyIndex:
isReadOnly
,
_kIsFocusableIndex:
isFocusable
,
_kIsLinkIndex:
isLink
,
_kIsSliderIndex:
isSlider
,
};
};
@override
String
toString
()
{
...
...
@@ -610,8 +602,6 @@ class SemanticsFlag {
return
'SemanticsFlag.isFocusable'
;
case
_kIsLinkIndex:
return
'SemanticsFlag.isLink'
;
case
_kIsSliderIndex:
return
'SemanticsFlag.isSlider'
;
}
assert
(
false
,
'Unhandled index:
$index
'
);
return
''
;
...
...
lib/ui/semantics/semantics_node.h
浏览文件 @
96efe392
...
...
@@ -79,7 +79,6 @@ enum class SemanticsFlags : int32_t {
kIsReadOnly
=
1
<<
20
,
kIsFocusable
=
1
<<
21
,
kIsLink
=
1
<<
22
,
kIsSlider
=
1
<<
23
,
};
const
int
kScrollableSemanticsFlags
=
...
...
lib/web_ui/lib/src/ui/semantics.dart
浏览文件 @
96efe392
...
...
@@ -156,7 +156,6 @@ class SemanticsFlag {
static
const
int
_kIsReadOnlyIndex
=
1
<<
20
;
static
const
int
_kIsFocusableIndex
=
1
<<
21
;
static
const
int
_kIsLinkIndex
=
1
<<
22
;
static
const
int
_kIsSliderIndex
=
1
<<
23
;
const
SemanticsFlag
.
_
(
this
.
index
)
:
assert
(
index
!=
null
);
// ignore: unnecessary_null_comparison
final
int
index
;
...
...
@@ -183,14 +182,12 @@ class SemanticsFlag {
static
const
SemanticsFlag
isToggled
=
SemanticsFlag
.
_
(
_kIsToggledIndex
);
static
const
SemanticsFlag
hasImplicitScrolling
=
SemanticsFlag
.
_
(
_kHasImplicitScrollingIndex
);
static
const
SemanticsFlag
isMultiline
=
SemanticsFlag
.
_
(
_kIsMultilineIndex
);
static
const
SemanticsFlag
isSlider
=
SemanticsFlag
.
_
(
_kIsSliderIndex
);
static
const
Map
<
int
,
SemanticsFlag
>
values
=
<
int
,
SemanticsFlag
>{
_kHasCheckedStateIndex:
hasCheckedState
,
_kIsCheckedIndex:
isChecked
,
_kIsSelectedIndex:
isSelected
,
_kIsButtonIndex:
isButton
,
_kIsLinkIndex:
isLink
,
_kIsSliderIndex:
isSlider
,
_kIsTextFieldIndex:
isTextField
,
_kIsFocusableIndex:
isFocusable
,
_kIsFocusedIndex:
isFocused
,
...
...
shell/platform/fuchsia/flutter/accessibility_bridge.cc
浏览文件 @
96efe392
...
...
@@ -115,31 +115,6 @@ fuchsia::accessibility::semantics::States AccessibilityBridge::GetNodeStates(
return
states
;
}
fuchsia
::
accessibility
::
semantics
::
Role
AccessibilityBridge
::
GetNodeRole
(
const
flutter
::
SemanticsNode
&
node
)
const
{
if
(
node
.
HasFlag
(
flutter
::
SemanticsFlags
::
kIsButton
))
{
return
fuchsia
::
accessibility
::
semantics
::
Role
::
BUTTON
;
}
if
(
node
.
HasFlag
(
flutter
::
SemanticsFlags
::
kIsHeader
))
{
return
fuchsia
::
accessibility
::
semantics
::
Role
::
HEADER
;
}
if
(
node
.
HasFlag
(
flutter
::
SemanticsFlags
::
kIsImage
))
{
return
fuchsia
::
accessibility
::
semantics
::
Role
::
IMAGE
;
}
if
(
node
.
HasFlag
(
flutter
::
SemanticsFlags
::
kIsTextField
))
{
return
fuchsia
::
accessibility
::
semantics
::
Role
::
TEXT_FIELD
;
}
if
(
node
.
HasFlag
(
flutter
::
SemanticsFlags
::
kIsSlider
))
{
return
fuchsia
::
accessibility
::
semantics
::
Role
::
SLIDER
;
}
return
fuchsia
::
accessibility
::
semantics
::
Role
::
UNKNOWN
;
}
std
::
unordered_set
<
int32_t
>
AccessibilityBridge
::
GetDescendants
(
int32_t
node_id
)
const
{
std
::
unordered_set
<
int32_t
>
descendents
;
...
...
@@ -252,7 +227,6 @@ 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_role
(
GetNodeRole
(
flutter_node
))
.
set_child_ids
(
child_ids
);
this_node_size
+=
kNodeIdSize
*
flutter_node
.
childrenInTraversalOrder
.
size
();
...
...
shell/platform/fuchsia/flutter/accessibility_bridge.h
浏览文件 @
96efe392
...
...
@@ -145,11 +145,6 @@ class AccessibilityBridge
const
flutter
::
SemanticsNode
&
node
,
size_t
*
additional_size
)
const
;
// Derives the role for a Fuchsia semantics node from a Flutter semantics
// node.
fuchsia
::
accessibility
::
semantics
::
Role
GetNodeRole
(
const
flutter
::
SemanticsNode
&
node
)
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
浏览文件 @
96efe392
...
...
@@ -19,20 +19,6 @@
namespace
flutter_runner_test
{
namespace
{
void
ExpectNodeHasRole
(
const
fuchsia
::
accessibility
::
semantics
::
Node
&
node
,
const
std
::
unordered_map
<
uint32_t
,
fuchsia
::
accessibility
::
semantics
::
Role
>
roles_by_node_id
)
{
ASSERT_TRUE
(
node
.
has_node_id
());
ASSERT_NE
(
roles_by_node_id
.
find
(
node
.
node_id
()),
roles_by_node_id
.
end
());
EXPECT_TRUE
(
node
.
has_role
());
EXPECT_EQ
(
node
.
role
(),
roles_by_node_id
.
at
(
node
.
node_id
()));
}
}
// namespace
class
AccessibilityBridgeTestDelegate
:
public
flutter_runner
::
AccessibilityBridge
::
Delegate
{
public:
...
...
@@ -103,67 +89,6 @@ TEST_F(AccessibilityBridgeTest, EnableDisable) {
EXPECT_TRUE
(
accessibility_delegate_
.
enabled
());
}
TEST_F
(
AccessibilityBridgeTest
,
UpdatesNodeRoles
)
{
flutter
::
SemanticsNodeUpdates
updates
;
flutter
::
SemanticsNode
node0
;
node0
.
id
=
0
;
node0
.
flags
|=
static_cast
<
int
>
(
flutter
::
SemanticsFlags
::
kIsButton
);
node0
.
childrenInTraversalOrder
=
{
1
,
2
,
3
,
4
};
node0
.
childrenInHitTestOrder
=
{
1
,
2
,
3
,
4
};
updates
.
emplace
(
0
,
node0
);
flutter
::
SemanticsNode
node1
;
node1
.
id
=
1
;
node1
.
flags
|=
static_cast
<
int
>
(
flutter
::
SemanticsFlags
::
kIsHeader
);
node1
.
childrenInTraversalOrder
=
{};
node1
.
childrenInHitTestOrder
=
{};
updates
.
emplace
(
1
,
node1
);
flutter
::
SemanticsNode
node2
;
node2
.
id
=
2
;
node2
.
flags
|=
static_cast
<
int
>
(
flutter
::
SemanticsFlags
::
kIsImage
);
node2
.
childrenInTraversalOrder
=
{};
node2
.
childrenInHitTestOrder
=
{};
updates
.
emplace
(
2
,
node2
);
flutter
::
SemanticsNode
node3
;
node3
.
id
=
3
;
node3
.
flags
|=
static_cast
<
int
>
(
flutter
::
SemanticsFlags
::
kIsTextField
);
node3
.
childrenInTraversalOrder
=
{};
node3
.
childrenInHitTestOrder
=
{};
updates
.
emplace
(
3
,
node3
);
flutter
::
SemanticsNode
node4
;
node4
.
childrenInTraversalOrder
=
{};
node4
.
childrenInHitTestOrder
=
{};
node4
.
id
=
4
;
node4
.
flags
|=
static_cast
<
int
>
(
flutter
::
SemanticsFlags
::
kIsSlider
);
updates
.
emplace
(
4
,
node4
);
accessibility_bridge_
->
AddSemanticsNodeUpdate
(
std
::
move
(
updates
));
RunLoopUntilIdle
();
std
::
unordered_map
<
uint32_t
,
fuchsia
::
accessibility
::
semantics
::
Role
>
roles_by_node_id
=
{
{
0u
,
fuchsia
::
accessibility
::
semantics
::
Role
::
BUTTON
},
{
1u
,
fuchsia
::
accessibility
::
semantics
::
Role
::
HEADER
},
{
2u
,
fuchsia
::
accessibility
::
semantics
::
Role
::
IMAGE
},
{
3u
,
fuchsia
::
accessibility
::
semantics
::
Role
::
TEXT_FIELD
},
{
4u
,
fuchsia
::
accessibility
::
semantics
::
Role
::
SLIDER
}};
EXPECT_EQ
(
0
,
semantics_manager_
.
DeleteCount
());
EXPECT_EQ
(
1
,
semantics_manager_
.
UpdateCount
());
EXPECT_EQ
(
1
,
semantics_manager_
.
CommitCount
());
EXPECT_EQ
(
5U
,
semantics_manager_
.
LastUpdatedNodes
().
size
());
for
(
const
auto
&
node
:
semantics_manager_
.
LastUpdatedNodes
())
{
ExpectNodeHasRole
(
node
,
roles_by_node_id
);
}
EXPECT_FALSE
(
semantics_manager_
.
DeleteOverflowed
());
EXPECT_FALSE
(
semantics_manager_
.
UpdateOverflowed
());
}
TEST_F
(
AccessibilityBridgeTest
,
DeletesChildrenTransitively
)
{
// Test that when a node is deleted, so are its transitive children.
flutter
::
SemanticsNode
node2
;
...
...
testing/dart/semantics_test.dart
浏览文件 @
96efe392
...
...
@@ -9,7 +9,7 @@ import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
/// Verifies Semantics flags and actions.
void
main
(
)
{
// This must match the number of flags in lib/ui/semantics.dart
const
int
numSemanticsFlags
=
2
4
;
const
int
numSemanticsFlags
=
2
3
;
test
(
'SemanticsFlag.values refers to all flags.'
,
()
async
{
expect
(
SemanticsFlag
.
values
.
length
,
equals
(
numSemanticsFlags
));
for
(
int
index
=
0
;
index
<
numSemanticsFlags
;
++
index
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录