提交 f0c3ebfb 编写于 作者: J Jason Simmons 提交者: GitHub

Send text input action events on Fuchsia (#3843)

Fixes https://github.com/flutter/flutter/issues/10061
上级 d2d152f2
......@@ -635,7 +635,29 @@ void RuntimeHolder::DidUpdateState(mozart::TextInputStatePtr state,
}
void RuntimeHolder::OnAction(mozart::InputMethodAction action) {
// TODO
rapidjson::Document document;
auto& allocator = document.GetAllocator();
rapidjson::Value args(rapidjson::kArrayType);
args.PushBack(current_text_input_client_, allocator);
// Done is currently the only text input action defined by Flutter.
args.PushBack("TextInputAction.done", allocator);
document.SetObject();
document.AddMember("method",
rapidjson::Value("TextInputClient.performAction"),
allocator);
document.AddMember("args", args, allocator);
rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
document.Accept(writer);
const uint8_t* data = reinterpret_cast<const uint8_t*>(buffer.GetString());
runtime_->DispatchPlatformMessage(ftl::MakeRefCounted<blink::PlatformMessage>(
kTextInputChannel, std::vector<uint8_t>(data, data + buffer.GetSize()),
nullptr));
}
ftl::WeakPtr<RuntimeHolder> RuntimeHolder::GetWeakPtr() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册