5#include "flutter/shell/platform/android/platform_view_android_delegate/platform_view_android_delegate.h"
13 int32_t* buffer_int32,
15 std::vector<std::vector<uint8_t>>& string_attribute_args) {
16 if (attributes.empty()) {
17 buffer_int32[position++] = -1;
20 buffer_int32[position++] = attributes.size();
21 for (
const auto& attribute : attributes) {
22 buffer_int32[position++] = attribute->start;
23 buffer_int32[position++] = attribute->end;
24 buffer_int32[position++] =
static_cast<int32_t
>(attribute->type);
25 switch (attribute->type) {
27 buffer_int32[position++] = -1;
30 buffer_int32[position++] = string_attribute_args.size();
31 std::shared_ptr<LocaleStringAttribute> locale_attribute =
32 std::static_pointer_cast<LocaleStringAttribute>(attribute);
33 string_attribute_args.push_back(
34 {locale_attribute->locale.begin(), locale_attribute->locale.end()});
41 std::shared_ptr<PlatformViewAndroidJNI> jni_facade)
42 : jni_facade_(
std::move(jni_facade)){};
47 constexpr size_t kBytesPerNode = 48 *
sizeof(int32_t);
48 constexpr size_t kBytesPerChild =
sizeof(int32_t);
49 constexpr size_t kBytesPerCustomAction =
sizeof(int32_t);
50 constexpr size_t kBytesPerAction = 4 *
sizeof(int32_t);
51 constexpr size_t kBytesPerStringAttribute = 4 *
sizeof(int32_t);
56 num_bytes += kBytesPerNode;
58 value.second.childrenInTraversalOrder.size() * kBytesPerChild;
59 num_bytes +=
value.second.childrenInHitTestOrder.size() * kBytesPerChild;
60 num_bytes +=
value.second.customAccessibilityActions.size() *
61 kBytesPerCustomAction;
63 value.second.labelAttributes.size() * kBytesPerStringAttribute;
65 value.second.valueAttributes.size() * kBytesPerStringAttribute;
66 num_bytes +=
value.second.increasedValueAttributes.size() *
67 kBytesPerStringAttribute;
68 num_bytes +=
value.second.decreasedValueAttributes.size() *
69 kBytesPerStringAttribute;
71 value.second.hintAttributes.size() * kBytesPerStringAttribute;
81 std::vector<uint8_t>
buffer(num_bytes);
82 int32_t* buffer_int32 =
reinterpret_cast<int32_t*
>(&
buffer[0]);
83 float* buffer_float32 =
reinterpret_cast<float*
>(&
buffer[0]);
85 std::vector<std::string> strings;
86 std::vector<std::vector<uint8_t>> string_attribute_args;
93 buffer_int32[position++] = node.
id;
94 buffer_int32[position++] = node.
flags;
95 buffer_int32[position++] = node.
actions;
103 buffer_float32[position++] =
static_cast<float>(node.
scrollPosition);
108 buffer_int32[position++] = -1;
110 buffer_int32[position++] = strings.size();
114 if (node.
label.empty()) {
115 buffer_int32[position++] = -1;
117 buffer_int32[position++] = strings.size();
118 strings.push_back(node.
label);
122 position, string_attribute_args);
123 if (node.
value.empty()) {
124 buffer_int32[position++] = -1;
126 buffer_int32[position++] = strings.size();
127 strings.push_back(node.
value);
131 position, string_attribute_args);
133 buffer_int32[position++] = -1;
135 buffer_int32[position++] = strings.size();
140 position, string_attribute_args);
142 buffer_int32[position++] = -1;
144 buffer_int32[position++] = strings.size();
149 position, string_attribute_args);
151 if (node.
hint.empty()) {
152 buffer_int32[position++] = -1;
154 buffer_int32[position++] = strings.size();
155 strings.push_back(node.
hint);
159 string_attribute_args);
162 buffer_int32[position++] = -1;
164 buffer_int32[position++] = strings.size();
165 strings.push_back(node.
tooltip);
169 buffer_float32[position++] = node.
rect.
left();
170 buffer_float32[position++] = node.
rect.
top();
171 buffer_float32[position++] = node.
rect.
right();
172 buffer_float32[position++] = node.
rect.
bottom();
178 buffer_int32[position++] = child;
182 buffer_int32[position++] = child;
187 buffer_int32[position++] = child;
192 size_t num_action_bytes = actions.size() * kBytesPerAction;
193 std::vector<uint8_t> actions_buffer(num_action_bytes);
194 int32_t* actions_buffer_int32 =
195 reinterpret_cast<int32_t*
>(&actions_buffer[0]);
197 std::vector<std::string> action_strings;
198 size_t actions_position = 0;
199 for (
const auto&
value : actions) {
204 actions_buffer_int32[actions_position++] =
action.id;
205 actions_buffer_int32[actions_position++] =
action.overrideId;
206 if (
action.label.empty()) {
207 actions_buffer_int32[actions_position++] = -1;
209 actions_buffer_int32[actions_position++] = action_strings.size();
210 action_strings.push_back(
action.label);
212 if (
action.hint.empty()) {
213 actions_buffer_int32[actions_position++] = -1;
215 actions_buffer_int32[actions_position++] = action_strings.size();
216 action_strings.push_back(
action.hint);
222 if (!actions_buffer.empty()) {
223 jni_facade_->FlutterViewUpdateCustomAccessibilityActions(actions_buffer,
228 jni_facade_->FlutterViewUpdateSemantics(
buffer, strings,
229 string_attribute_args);
void getColMajor(SkScalar v[]) const
std::unordered_map< int32_t, SemanticsNode > SemanticsNodeUpdates
std::unordered_map< int32_t, CustomAccessibilityAction > CustomAccessibilityActionUpdates
std::vector< StringAttributePtr > StringAttributes
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
void putStringAttributesIntoBuffer(const StringAttributes &attributes, int32_t *buffer_int32, size_t &position, std::vector< std::vector< uint8_t > > &string_attribute_args)
constexpr float left() const
constexpr float top() const
constexpr float right() const
constexpr float bottom() const
StringAttributes decreasedValueAttributes
std::string increasedValue
StringAttributes hintAttributes
StringAttributes increasedValueAttributes
StringAttributes valueAttributes
StringAttributes labelAttributes
std::vector< int32_t > childrenInHitTestOrder
int32_t textSelectionExtent
int32_t currentValueLength
std::vector< int32_t > customAccessibilityActions
std::string decreasedValue
std::vector< int32_t > childrenInTraversalOrder
int32_t textSelectionBase