From 4290ab5e2f703d051af27902c6c63079d84348d7 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 28 Feb 2020 00:10:42 -0800 Subject: [PATCH 1/2] semantics --- lib/ui/semantics.dart | 7 ++++++- lib/ui/semantics/semantics_update.cc | 8 +++++--- lib/ui/semantics/semantics_update.h | 3 ++- lib/ui/semantics/semantics_update_builder.cc | 4 ++-- lib/ui/semantics/semantics_update_builder.h | 2 +- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/ui/semantics.dart b/lib/ui/semantics.dart index 2a0cb13413367..508e001925866 100644 --- a/lib/ui/semantics.dart +++ b/lib/ui/semantics.dart @@ -805,7 +805,12 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { /// /// The returned object can be passed to [Window.updateSemantics] to actually /// update the semantics retained by the system. - SemanticsUpdate build() native 'SemanticsUpdateBuilder_build'; + SemanticsUpdate build() { + final SemanticsUpdate semanticsUpdate = SemanticsUpdate._(); + _build(semanticsUpdate); + return semanticsUpdate; + } + void _build(SemanticsUpdate outSemanticsUpdate) native 'SemanticsUpdateBuilder_build'; } /// An opaque object representing a batch of semantics updates. diff --git a/lib/ui/semantics/semantics_update.cc b/lib/ui/semantics/semantics_update.cc index e559af58aec61..26e531a0f3fd5 100644 --- a/lib/ui/semantics/semantics_update.cc +++ b/lib/ui/semantics/semantics_update.cc @@ -20,11 +20,13 @@ IMPLEMENT_WRAPPERTYPEINFO(ui, SemanticsUpdate); DART_BIND_ALL(SemanticsUpdate, FOR_EACH_BINDING) -fml::RefPtr SemanticsUpdate::create( +void SemanticsUpdate::create( + Dart_Handle semantics_update_handle, SemanticsNodeUpdates nodes, CustomAccessibilityActionUpdates actions) { - return fml::MakeRefCounted(std::move(nodes), - std::move(actions)); + auto semantics_update = fml::MakeRefCounted( + std::move(nodes), std::move(actions)); + semantics_update->AssociateWithDartWrapper(semantics_update_handle); } SemanticsUpdate::SemanticsUpdate(SemanticsNodeUpdates nodes, diff --git a/lib/ui/semantics/semantics_update.h b/lib/ui/semantics/semantics_update.h index 35ecbfbb9d510..1ec8b734c446e 100644 --- a/lib/ui/semantics/semantics_update.h +++ b/lib/ui/semantics/semantics_update.h @@ -21,7 +21,8 @@ class SemanticsUpdate : public RefCountedDartWrappable { public: ~SemanticsUpdate() override; - static fml::RefPtr create( + static void create( + Dart_Handle semantics_update_handle, SemanticsNodeUpdates nodes, CustomAccessibilityActionUpdates actions); diff --git a/lib/ui/semantics/semantics_update_builder.cc b/lib/ui/semantics/semantics_update_builder.cc index 7048f6a45f44c..e4a9be37b81e5 100644 --- a/lib/ui/semantics/semantics_update_builder.cc +++ b/lib/ui/semantics/semantics_update_builder.cc @@ -121,8 +121,8 @@ void SemanticsUpdateBuilder::updateCustomAction(int id, actions_[id] = action; } -fml::RefPtr SemanticsUpdateBuilder::build() { - return SemanticsUpdate::create(std::move(nodes_), std::move(actions_)); +void SemanticsUpdateBuilder::build(Dart_Handle semantics_update_handle) { + SemanticsUpdate::create(semantics_update_handle, std::move(nodes_), std::move(actions_)); } } // namespace flutter diff --git a/lib/ui/semantics/semantics_update_builder.h b/lib/ui/semantics/semantics_update_builder.h index bbf595e631858..a183e1384b637 100644 --- a/lib/ui/semantics/semantics_update_builder.h +++ b/lib/ui/semantics/semantics_update_builder.h @@ -58,7 +58,7 @@ class SemanticsUpdateBuilder std::string hint, int overrideId); - fml::RefPtr build(); + void build(Dart_Handle semantics_update_handle); static void RegisterNatives(tonic::DartLibraryNatives* natives); From d1b8ccfbef201e5eba5846867974b0a921bb4d8e Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 28 Feb 2020 00:12:37 -0800 Subject: [PATCH 2/2] format --- lib/ui/semantics/semantics_update.cc | 7 +++---- lib/ui/semantics/semantics_update.h | 7 +++---- lib/ui/semantics/semantics_update_builder.cc | 3 ++- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/ui/semantics/semantics_update.cc b/lib/ui/semantics/semantics_update.cc index 26e531a0f3fd5..c4ef22e34f7be 100644 --- a/lib/ui/semantics/semantics_update.cc +++ b/lib/ui/semantics/semantics_update.cc @@ -20,10 +20,9 @@ IMPLEMENT_WRAPPERTYPEINFO(ui, SemanticsUpdate); DART_BIND_ALL(SemanticsUpdate, FOR_EACH_BINDING) -void SemanticsUpdate::create( - Dart_Handle semantics_update_handle, - SemanticsNodeUpdates nodes, - CustomAccessibilityActionUpdates actions) { +void SemanticsUpdate::create(Dart_Handle semantics_update_handle, + SemanticsNodeUpdates nodes, + CustomAccessibilityActionUpdates actions) { auto semantics_update = fml::MakeRefCounted( std::move(nodes), std::move(actions)); semantics_update->AssociateWithDartWrapper(semantics_update_handle); diff --git a/lib/ui/semantics/semantics_update.h b/lib/ui/semantics/semantics_update.h index 1ec8b734c446e..c3411bb43bfaa 100644 --- a/lib/ui/semantics/semantics_update.h +++ b/lib/ui/semantics/semantics_update.h @@ -21,10 +21,9 @@ class SemanticsUpdate : public RefCountedDartWrappable { public: ~SemanticsUpdate() override; - static void create( - Dart_Handle semantics_update_handle, - SemanticsNodeUpdates nodes, - CustomAccessibilityActionUpdates actions); + static void create(Dart_Handle semantics_update_handle, + SemanticsNodeUpdates nodes, + CustomAccessibilityActionUpdates actions); SemanticsNodeUpdates takeNodes(); diff --git a/lib/ui/semantics/semantics_update_builder.cc b/lib/ui/semantics/semantics_update_builder.cc index e4a9be37b81e5..d3fc40deab19c 100644 --- a/lib/ui/semantics/semantics_update_builder.cc +++ b/lib/ui/semantics/semantics_update_builder.cc @@ -122,7 +122,8 @@ void SemanticsUpdateBuilder::updateCustomAction(int id, } void SemanticsUpdateBuilder::build(Dart_Handle semantics_update_handle) { - SemanticsUpdate::create(semantics_update_handle, std::move(nodes_), std::move(actions_)); + SemanticsUpdate::create(semantics_update_handle, std::move(nodes_), + std::move(actions_)); } } // namespace flutter