Roll Topaz/Tonic and call Dart_NewListOfType for TextBox lists (flutter/engine#4667)

Fixes https://github.com/flutter/flutter/issues/14555
This commit is contained in:
Jason Simmons
2018-02-13 15:02:57 -08:00
committed by GitHub
parent ed5dc5d1f4
commit 2c2cd2c9a5
3 changed files with 22 additions and 5 deletions

2
DEPS
View File

@@ -127,7 +127,7 @@ deps = {
Var('fuchsia_git') + '/garnet' + '@' + 'b3ba6b6d6ab8ef658278cc43c9f839a8a8d1718e',
'src/topaz':
Var('fuchsia_git') + '/topaz' + '@' + '531e2778d86b213bc663ea51bb0e0dde33d8ac8c',
Var('fuchsia_git') + '/topaz' + '@' + 'acf6b391d5ddad479427260b8683799685319dba',
'src/third_party/benchmark':
Var('fuchsia_git') + '/third_party/benchmark' + '@' + '296537bc48d380adf21567c5d736ab79f5363d22',

View File

@@ -13,13 +13,21 @@ using namespace blink;
namespace tonic {
Dart_Handle DartConverter<TextBox>::ToDart(const TextBox& val) {
if (val.is_null)
return Dart_Null();
namespace {
Dart_Handle GetTextBoxType() {
DartClassLibrary& class_library = DartState::Current()->class_library();
Dart_Handle type =
Dart_HandleFromPersistent(class_library.GetClass("ui", "TextBox"));
FXL_DCHECK(!LogIfError(type));
return type;
}
} // anonymous namespace
Dart_Handle DartConverter<TextBox>::ToDart(const TextBox& val) {
if (val.is_null)
return Dart_Null();
constexpr int argc = 5;
Dart_Handle argv[argc] = {
tonic::ToDart(val.sk_rect.fLeft),
@@ -28,7 +36,11 @@ Dart_Handle DartConverter<TextBox>::ToDart(const TextBox& val) {
tonic::ToDart(val.sk_rect.fBottom),
tonic::ToDart(static_cast<int>(val.direction)),
};
return Dart_New(type, tonic::ToDart("_"), argc, argv);
return Dart_New(GetTextBoxType(), tonic::ToDart("_"), argc, argv);
}
Dart_Handle DartListFactory<TextBox>::NewList(intptr_t length) {
return Dart_NewListOfType(GetTextBoxType(), length);
}
} // namespace tonic

View File

@@ -16,6 +16,11 @@ struct DartConverter<blink::TextBox> {
static Dart_Handle ToDart(const blink::TextBox& val);
};
template <>
struct DartListFactory<blink::TextBox> {
static Dart_Handle NewList(intptr_t length);
};
} // namespace tonic
#endif // FLUTTER_LIB_UI_TEXT_TEXT_BOX_H_