1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "flutter/lib/ui/semantics/semantics_update_builder.h"
6
7#include <memory>
8
9#include "flutter/lib/ui/painting/matrix.h"
10#include "flutter/lib/ui/ui_dart_state.h"
11#include "third_party/tonic/converter/dart_converter.h"
12#include "third_party/tonic/dart_args.h"
13#include "third_party/tonic/dart_binding_macros.h"
14#include "third_party/tonic/dart_library_natives.h"
15
16namespace flutter {
17
18IMPLEMENT_WRAPPERTYPEINFO(ui, SemanticsUpdate);
19
20#define FOR_EACH_BINDING(V) V(SemanticsUpdate, dispose)
21
22DART_BIND_ALL(SemanticsUpdate, FOR_EACH_BINDING)
23
24void SemanticsUpdate::create(Dart_Handle semantics_update_handle,
25 SemanticsNodeUpdates nodes,
26 CustomAccessibilityActionUpdates actions) {
27 auto semantics_update = fml::MakeRefCounted<SemanticsUpdate>(
28 std::move(nodes), std::move(actions));
29 semantics_update->AssociateWithDartWrapper(semantics_update_handle);
30}
31
32SemanticsUpdate::SemanticsUpdate(SemanticsNodeUpdates nodes,
33 CustomAccessibilityActionUpdates actions)
34 : nodes_(std::move(nodes)), actions_(std::move(actions)) {}
35
36SemanticsUpdate::~SemanticsUpdate() = default;
37
38SemanticsNodeUpdates SemanticsUpdate::takeNodes() {
39 return std::move(nodes_);
40}
41
42CustomAccessibilityActionUpdates SemanticsUpdate::takeActions() {
43 return std::move(actions_);
44}
45
46void SemanticsUpdate::dispose() {
47 ClearDartWrapper();
48}
49
50} // namespace flutter
51