Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
7685e080
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,发现更多精彩内容 >>
未验证
提交
7685e080
编写于
2月 25, 2020
作者:
M
Mouad Debbar
提交者:
GitHub
2月 25, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[web] Guard the remaining calls to window.onPlatformMessage (#16791)
上级
9ac76ad5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
54 addition
and
40 deletion
+54
-40
lib/web_ui/lib/src/engine/history.dart
lib/web_ui/lib/src/engine/history.dart
+16
-12
lib/web_ui/lib/src/engine/keyboard.dart
lib/web_ui/lib/src/engine/keyboard.dart
+4
-0
lib/web_ui/lib/src/engine/text_editing/text_editing.dart
lib/web_ui/lib/src/engine/text_editing/text_editing.dart
+34
-28
未找到文件。
lib/web_ui/lib/src/engine/history.dart
浏览文件 @
7685e080
...
...
@@ -94,11 +94,13 @@ class BrowserHistory {
_setupFlutterEntry
(
_locationStrategy
);
// 2. Send a 'popRoute' platform message so the app can handle it accordingly.
ui
.
window
.
onPlatformMessage
(
'flutter/navigation'
,
const
JSONMethodCodec
().
encodeMethodCall
(
_popRouteMethodCall
),
(
_
)
{},
);
if
(
ui
.
window
.
onPlatformMessage
!=
null
)
{
ui
.
window
.
onPlatformMessage
(
'flutter/navigation'
,
const
JSONMethodCodec
().
encodeMethodCall
(
_popRouteMethodCall
),
(
_
)
{},
);
}
}
else
if
(
_isFlutterEntry
(
event
.
state
))
{
// We get into this scenario when the user changes the url manually. It
// causes a new entry to be pushed on top of our "flutter" one. When this
...
...
@@ -111,13 +113,15 @@ class BrowserHistory {
_userProvidedRouteName
=
null
;
// Send a 'pushRoute' platform message so the app handles it accordingly.
ui
.
window
.
onPlatformMessage
(
'flutter/navigation'
,
const
JSONMethodCodec
().
encodeMethodCall
(
MethodCall
(
'pushRoute'
,
newRouteName
),
),
(
_
)
{},
);
if
(
ui
.
window
.
onPlatformMessage
!=
null
)
{
ui
.
window
.
onPlatformMessage
(
'flutter/navigation'
,
const
JSONMethodCodec
().
encodeMethodCall
(
MethodCall
(
'pushRoute'
,
newRouteName
),
),
(
_
)
{},
);
}
}
else
{
// The user has pushed a new entry on top of our flutter entry. This could
// happen when the user modifies the hash part of the url directly, for
...
...
lib/web_ui/lib/src/engine/keyboard.dart
浏览文件 @
7685e080
...
...
@@ -68,6 +68,10 @@ class Keyboard {
static
const
JSONMessageCodec
_messageCodec
=
JSONMessageCodec
();
void
_handleHtmlEvent
(
html
.
KeyboardEvent
event
)
{
if
(
ui
.
window
.
onPlatformMessage
==
null
)
{
return
;
}
if
(
_shouldIgnoreEvent
(
event
))
{
return
;
}
...
...
lib/web_ui/lib/src/engine/text_editing/text_editing.dart
浏览文件 @
7685e080
...
...
@@ -819,44 +819,50 @@ class TextEditingChannel {
/// Sends the 'TextInputClient.updateEditingState' message to the framework.
void
updateEditingState
(
int
clientId
,
EditingState
editingState
)
{
ui
.
window
.
onPlatformMessage
(
'flutter/textinput'
,
const
JSONMethodCodec
().
encodeMethodCall
(
MethodCall
(
'TextInputClient.updateEditingState'
,
<
dynamic
>[
clientId
,
editingState
.
toFlutter
(),
]),
),
_emptyCallback
,
);
if
(
ui
.
window
.
onPlatformMessage
!=
null
)
{
ui
.
window
.
onPlatformMessage
(
'flutter/textinput'
,
const
JSONMethodCodec
().
encodeMethodCall
(
MethodCall
(
'TextInputClient.updateEditingState'
,
<
dynamic
>[
clientId
,
editingState
.
toFlutter
(),
]),
),
_emptyCallback
,
);
}
}
/// Sends the 'TextInputClient.performAction' message to the framework.
void
performAction
(
int
clientId
,
String
inputAction
)
{
ui
.
window
.
onPlatformMessage
(
'flutter/textinput'
,
const
JSONMethodCodec
().
encodeMethodCall
(
MethodCall
(
'TextInputClient.performAction'
,
<
dynamic
>[
clientId
,
inputAction
],
if
(
ui
.
window
.
onPlatformMessage
!=
null
)
{
ui
.
window
.
onPlatformMessage
(
'flutter/textinput'
,
const
JSONMethodCodec
().
encodeMethodCall
(
MethodCall
(
'TextInputClient.performAction'
,
<
dynamic
>[
clientId
,
inputAction
],
),
),
)
,
_emptyCallback
,
);
_emptyCallback
,
);
}
}
/// Sends the 'TextInputClient.onConnectionClosed' message to the framework.
void
onConnectionClosed
(
int
clientId
)
{
ui
.
window
.
onPlatformMessage
(
'flutter/textinput'
,
const
JSONMethodCodec
().
encodeMethodCall
(
MethodCall
(
'TextInputClient.onConnectionClosed'
,
<
dynamic
>[
clientId
],
if
(
ui
.
window
.
onPlatformMessage
!=
null
)
{
ui
.
window
.
onPlatformMessage
(
'flutter/textinput'
,
const
JSONMethodCodec
().
encodeMethodCall
(
MethodCall
(
'TextInputClient.onConnectionClosed'
,
<
dynamic
>[
clientId
],
),
),
)
,
_emptyCallback
,
);
_emptyCallback
,
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录