Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
4cfbe450
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,发现更多精彩内容 >>
未验证
提交
4cfbe450
编写于
4月 03, 2020
作者:
G
gaaclarke
提交者:
GitHub
4月 03, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Started clearing out the parent of orphaned semantic objects. (#17499)
上级
d5e7b807
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
37 addition
and
8 deletion
+37
-8
shell/platform/darwin/ios/framework/Source/accessibility_bridge.h
...atform/darwin/ios/framework/Source/accessibility_bridge.h
+4
-2
shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm
...tform/darwin/ios/framework/Source/accessibility_bridge.mm
+33
-6
未找到文件。
shell/platform/darwin/ios/framework/Source/accessibility_bridge.h
浏览文件 @
4cfbe450
...
@@ -43,7 +43,7 @@ class AccessibilityBridge;
...
@@ -43,7 +43,7 @@ class AccessibilityBridge;
* The parent of this node in the node tree. Will be nil for the root node and
* The parent of this node in the node tree. Will be nil for the root node and
* during transient state changes.
* during transient state changes.
*/
*/
@property
(
nonatomic
,
assign
)
SemanticsObject
*
parent
;
@property
(
nonatomic
,
readonly
)
SemanticsObject
*
parent
;
/**
/**
* The accessibility bridge that this semantics object is attached to. This
* The accessibility bridge that this semantics object is attached to. This
...
@@ -85,13 +85,15 @@ class AccessibilityBridge;
...
@@ -85,13 +85,15 @@ class AccessibilityBridge;
* Direct children of this semantics object. Each child's `parent` property must
* Direct children of this semantics object. Each child's `parent` property must
* be equal to this object.
* be equal to this object.
*/
*/
@property
(
nonatomic
,
strong
)
NS
Mutable
Array
<
SemanticsObject
*>*
children
;
@property
(
nonatomic
,
strong
)
NSArray
<
SemanticsObject
*>*
children
;
/**
/**
* Used if this SemanticsObject is for a platform view.
* Used if this SemanticsObject is for a platform view.
*/
*/
@property
(
strong
,
nonatomic
)
FlutterPlatformViewSemanticsContainer
*
platformViewSemanticsContainer
;
@property
(
strong
,
nonatomic
)
FlutterPlatformViewSemanticsContainer
*
platformViewSemanticsContainer
;
-
(
void
)
replaceChildAtIndex
:(
NSInteger
)
index
withChild
:(
SemanticsObject
*
)
child
;
-
(
BOOL
)
nodeWillCauseLayoutChange
:(
const
flutter
::
SemanticsNode
*
)
node
;
-
(
BOOL
)
nodeWillCauseLayoutChange
:(
const
flutter
::
SemanticsNode
*
)
node
;
#pragma mark - Designated initializers
#pragma mark - Designated initializers
...
...
shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm
浏览文件 @
4cfbe450
...
@@ -14,6 +14,8 @@
...
@@ -14,6 +14,8 @@
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h"
#include "flutter/shell/platform/darwin/ios/platform_view_ios.h"
#include "flutter/shell/platform/darwin/ios/platform_view_ios.h"
FLUTTER_ASSERT_NOT_ARC
namespace
{
namespace
{
constexpr
int32_t
kRootNodeId
=
0
;
constexpr
int32_t
kRootNodeId
=
0
;
...
@@ -162,8 +164,14 @@ flutter::SemanticsAction GetSemanticsActionForScrollDirection(
...
@@ -162,8 +164,14 @@ flutter::SemanticsAction GetSemanticsActionForScrollDirection(
@end
@end
@interface
SemanticsObject
()
/** Should only be called in conjunction with setting child/parent relationship. */
-
(
void
)
privateSetParent
:(
SemanticsObject
*
)
parent
;
@end
@implementation
SemanticsObject
{
@implementation
SemanticsObject
{
fml
::
scoped_nsobject
<
SemanticsObjectContainer
>
_container
;
fml
::
scoped_nsobject
<
SemanticsObjectContainer
>
_container
;
NSMutableArray
<
SemanticsObject
*>*
_children
;
}
}
#pragma mark - Override base class designated initializers
#pragma mark - Override base class designated initializers
...
@@ -197,7 +205,7 @@ flutter::SemanticsAction GetSemanticsActionForScrollDirection(
...
@@ -197,7 +205,7 @@ flutter::SemanticsAction GetSemanticsActionForScrollDirection(
-
(
void
)
dealloc
{
-
(
void
)
dealloc
{
for
(
SemanticsObject
*
child
in
_children
)
{
for
(
SemanticsObject
*
child
in
_children
)
{
child
.
parent
=
nil
;
[
child
privateSetParent
:
nil
]
;
}
}
[
_children
removeAllObjects
];
[
_children
removeAllObjects
];
[
_children
release
];
[
_children
release
];
...
@@ -239,6 +247,28 @@ flutter::SemanticsAction GetSemanticsActionForScrollDirection(
...
@@ -239,6 +247,28 @@ flutter::SemanticsAction GetSemanticsActionForScrollDirection(
return
[
self
.
children
count
]
!=
0
;
return
[
self
.
children
count
]
!=
0
;
}
}
-
(
void
)
privateSetParent
:(
SemanticsObject
*
)
parent
{
_parent
=
parent
;
}
-
(
void
)
setChildren
:(
NSArray
<
SemanticsObject
*>*
)
children
{
for
(
SemanticsObject
*
child
in
_children
)
{
[
child
privateSetParent
:
nil
];
}
[
_children
release
];
_children
=
[[
NSMutableArray
alloc
]
initWithArray
:
children
];
for
(
SemanticsObject
*
child
in
_children
)
{
[
child
privateSetParent
:
self
];
}
}
-
(
void
)
replaceChildAtIndex
:(
NSInteger
)
index
withChild
:(
SemanticsObject
*
)
child
{
SemanticsObject
*
oldChild
=
_children
[
index
];
[
oldChild
privateSetParent
:
nil
];
[
child
privateSetParent
:
self
];
[
_children
replaceObjectAtIndex
:
index
withObject
:
child
];
}
#pragma mark - UIAccessibility overrides
#pragma mark - UIAccessibility overrides
-
(
BOOL
)
isAccessibilityElement
{
-
(
BOOL
)
isAccessibilityElement
{
...
@@ -653,7 +683,7 @@ flutter::SemanticsAction GetSemanticsActionForScrollDirection(
...
@@ -653,7 +683,7 @@ flutter::SemanticsAction GetSemanticsActionForScrollDirection(
return
((
FlutterPlatformViewSemanticsContainer
*
)
element
).
index
;
return
((
FlutterPlatformViewSemanticsContainer
*
)
element
).
index
;
}
}
NS
Mutable
Array
<
SemanticsObject
*>*
children
=
[
_semanticsObject
children
];
NSArray
<
SemanticsObject
*>*
children
=
[
_semanticsObject
children
];
for
(
size_t
i
=
0
;
i
<
[
children
count
];
i
++
)
{
for
(
size_t
i
=
0
;
i
<
[
children
count
];
i
++
)
{
SemanticsObject
*
child
=
children
[
i
];
SemanticsObject
*
child
=
children
[
i
];
if
((
!
[
child
hasChildren
]
&&
child
==
element
)
||
if
((
!
[
child
hasChildren
]
&&
child
==
element
)
||
...
@@ -741,7 +771,6 @@ void AccessibilityBridge::UpdateSemantics(flutter::SemanticsNodeUpdates nodes,
...
@@ -741,7 +771,6 @@ void AccessibilityBridge::UpdateSemantics(flutter::SemanticsNodeUpdates nodes,
[[[
NSMutableArray
alloc
]
initWithCapacity
:
newChildCount
]
autorelease
];
[[[
NSMutableArray
alloc
]
initWithCapacity
:
newChildCount
]
autorelease
];
for
(
NSUInteger
i
=
0
;
i
<
newChildCount
;
++
i
)
{
for
(
NSUInteger
i
=
0
;
i
<
newChildCount
;
++
i
)
{
SemanticsObject
*
child
=
GetOrCreateObject
(
node
.
childrenInTraversalOrder
[
i
],
nodes
);
SemanticsObject
*
child
=
GetOrCreateObject
(
node
.
childrenInTraversalOrder
[
i
],
nodes
);
child
.
parent
=
object
;
[
newChildren
addObject
:
child
];
[
newChildren
addObject
:
child
];
}
}
object
.
children
=
newChildren
;
object
.
children
=
newChildren
;
...
@@ -847,10 +876,8 @@ static void ReplaceSemanticsObject(SemanticsObject* oldObject,
...
@@ -847,10 +876,8 @@ static void ReplaceSemanticsObject(SemanticsObject* oldObject,
assert
(
oldObject
.
node
.
id
==
newObject
.
node
.
id
);
assert
(
oldObject
.
node
.
id
==
newObject
.
node
.
id
);
NSNumber
*
nodeId
=
@
(
oldObject
.
node
.
id
);
NSNumber
*
nodeId
=
@
(
oldObject
.
node
.
id
);
NSUInteger
positionInChildlist
=
[
oldObject
.
parent
.
children
indexOfObject
:
oldObject
];
NSUInteger
positionInChildlist
=
[
oldObject
.
parent
.
children
indexOfObject
:
oldObject
];
SemanticsObject
*
parent
=
oldObject
.
parent
;
[
objects
removeObjectForKey
:
nodeId
];
[
objects
removeObjectForKey
:
nodeId
];
newObject
.
parent
=
parent
;
[
oldObject
.
parent
replaceChildAtIndex
:
positionInChildlist
withChild
:
newObject
];
[
newObject
.
parent
.
children
replaceObjectAtIndex
:
positionInChildlist
withObject
:
newObject
];
objects
[
nodeId
]
=
newObject
;
objects
[
nodeId
]
=
newObject
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录