Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
bada9fc5
E
engine
项目概览
qq_34031325
/
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,发现更多精彩内容 >>
未验证
提交
bada9fc5
编写于
8月 30, 2020
作者:
F
Ferhat
提交者:
GitHub
8月 30, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[web] Fix path clip crash when reused (#20846)
上级
1e302a11
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
3 deletion
+29
-3
lib/web_ui/lib/src/engine/html/clip.dart
lib/web_ui/lib/src/engine/html/clip.dart
+13
-3
lib/web_ui/test/engine/surface/surface_test.dart
lib/web_ui/test/engine/surface/surface_test.dart
+16
-0
未找到文件。
lib/web_ui/lib/src/engine/html/clip.dart
浏览文件 @
bada9fc5
...
...
@@ -292,7 +292,9 @@ class PersistedPhysicalShape extends PersistedContainerSurface
offsetY:
-
pathBounds
.
top
,
scaleX:
1.0
/
pathBounds
.
width
,
scaleY:
1.0
/
pathBounds
.
height
);
assert
(
_clipElement
==
null
);
// If apply is called multiple times (without update) , remove prior
// svg clip element.
_clipElement
?.
remove
();
_clipElement
=
html
.
Element
.
html
(
svgClipPath
,
treeSanitizer:
_NullTreeSanitizer
());
domRenderer
.
append
(
rootElement
!,
_clipElement
!);
...
...
@@ -325,15 +327,22 @@ class PersistedPhysicalShape extends PersistedContainerSurface
}
if
(
oldSurface
.
path
!=
path
)
{
oldSurface
.
_clipElement
?.
remove
();
oldSurface
.
_clipElement
=
null
;
_clipElement
?.
remove
();
_clipElement
=
null
;
// Reset style on prior element since we may have switched between
// rect/rrect and arbitrary path.
domRenderer
.
setElementStyle
(
rootElement
!,
'clip-path'
,
''
);
domRenderer
.
setElementStyle
(
rootElement
!,
'-webkit-clip-path'
,
''
);
_applyShape
();
}
else
{
// Reuse clipElement from prior surface.
_clipElement
=
oldSurface
.
_clipElement
;
if
(
_clipElement
!=
null
)
{
domRenderer
.
append
(
rootElement
!,
_clipElement
!);
}
oldSurface
.
_clipElement
=
null
;
}
oldSurface
.
_clipElement
=
null
;
}
}
...
...
@@ -362,7 +371,8 @@ class PersistedClipPath extends PersistedContainerSurface
@override
void
apply
()
{
_clipElement
?.
remove
();
final
String
svgClipPath
=
createSvgClipDef
(
childContainer
as
html
.
HtmlElement
,
clipPath
);
final
String
svgClipPath
=
createSvgClipDef
(
childContainer
as
html
.
HtmlElement
,
clipPath
);
_clipElement
=
html
.
Element
.
html
(
svgClipPath
,
treeSanitizer:
_NullTreeSanitizer
());
domRenderer
.
append
(
childContainer
!,
_clipElement
!);
...
...
lib/web_ui/test/engine/surface/surface_test.dart
浏览文件 @
bada9fc5
...
...
@@ -359,6 +359,22 @@ void testMain() {
expect
(
opacityLayer2
.
rootElement
,
element
);
// adopts old surface's element
});
// Regression test for https://github.com/flutter/flutter/issues/60461
//
// During retained match many to many, build can be called on existing
// PersistedPhysicalShape multiple times when not matched.
test
(
'Can call apply multiple times on existing PersistedPhysicalShape'
'when using arbitrary path'
,
()
{
final
SceneBuilder
builder1
=
SceneBuilder
();
final
Path
path
=
Path
();
path
.
addPolygon
([
Offset
(
50
,
0
),
Offset
(
100
,
80
),
Offset
(
20
,
40
)],
true
);
PersistedPhysicalShape
shape
=
builder1
.
pushPhysicalShape
(
path:
path
,
color:
Color
(
0xFF00FF00
),
elevation:
1
);
builder1
.
build
();
expect
(()
=>
shape
.
apply
(),
returnsNormally
);
});
});
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录