Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/ui/semantics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 6 additions & 5 deletions lib/ui/semantics/semantics_update.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ IMPLEMENT_WRAPPERTYPEINFO(ui, SemanticsUpdate);

DART_BIND_ALL(SemanticsUpdate, FOR_EACH_BINDING)

fml::RefPtr<SemanticsUpdate> SemanticsUpdate::create(
SemanticsNodeUpdates nodes,
CustomAccessibilityActionUpdates actions) {
return fml::MakeRefCounted<SemanticsUpdate>(std::move(nodes),
std::move(actions));
void SemanticsUpdate::create(Dart_Handle semantics_update_handle,
SemanticsNodeUpdates nodes,
CustomAccessibilityActionUpdates actions) {
auto semantics_update = fml::MakeRefCounted<SemanticsUpdate>(
std::move(nodes), std::move(actions));
semantics_update->AssociateWithDartWrapper(semantics_update_handle);
}

SemanticsUpdate::SemanticsUpdate(SemanticsNodeUpdates nodes,
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/semantics/semantics_update.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ class SemanticsUpdate : public RefCountedDartWrappable<SemanticsUpdate> {

public:
~SemanticsUpdate() override;
static fml::RefPtr<SemanticsUpdate> create(
SemanticsNodeUpdates nodes,
CustomAccessibilityActionUpdates actions);
static void create(Dart_Handle semantics_update_handle,
SemanticsNodeUpdates nodes,
CustomAccessibilityActionUpdates actions);

SemanticsNodeUpdates takeNodes();

Expand Down
5 changes: 3 additions & 2 deletions lib/ui/semantics/semantics_update_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ void SemanticsUpdateBuilder::updateCustomAction(int id,
actions_[id] = action;
}

fml::RefPtr<SemanticsUpdate> 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
2 changes: 1 addition & 1 deletion lib/ui/semantics/semantics_update_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class SemanticsUpdateBuilder
std::string hint,
int overrideId);

fml::RefPtr<SemanticsUpdate> build();
void build(Dart_Handle semantics_update_handle);

static void RegisterNatives(tonic::DartLibraryNatives* natives);

Expand Down