5#include "flutter/shell/platform/embedder/embedder_semantics_update.h"
12 for (
const auto&
value : nodes) {
13 AddNode(
value.second);
16 for (
const auto&
value : actions) {
17 AddAction(
value.second);
22 .nodes_count = nodes_.size(),
23 .nodes = nodes_.data(),
24 .custom_actions_count = actions_.size(),
25 .custom_actions = actions_.data(),
29void EmbedderSemanticsUpdate::AddNode(
const SemanticsNode& node) {
74void EmbedderSemanticsUpdate::AddAction(
75 const CustomAccessibilityAction&
action) {
93 nodes_.reserve(nodes.size());
94 node_pointers_.reserve(nodes.size());
95 actions_.reserve(actions.size());
96 action_pointers_.reserve(actions.size());
98 for (
const auto&
value : nodes) {
99 AddNode(
value.second);
102 for (
const auto&
value : actions) {
103 AddAction(
value.second);
106 for (
size_t i = 0;
i < nodes_.size();
i++) {
107 node_pointers_.push_back(&nodes_[
i]);
110 for (
size_t i = 0;
i < actions_.size();
i++) {
111 action_pointers_.push_back(&actions_[
i]);
116 .node_count = node_pointers_.size(),
117 .nodes = node_pointers_.data(),
118 .custom_action_count = action_pointers_.size(),
119 .custom_actions = action_pointers_.data(),
125void EmbedderSemanticsUpdate2::AddNode(
const SemanticsNode& node) {
135 auto hint_attributes = CreateStringAttributes(node.
hintAttributes);
137 auto increased_value_attributes =
139 auto decreased_value_attributes =
172 label_attributes.count,
173 label_attributes.attributes,
174 hint_attributes.count,
175 hint_attributes.attributes,
176 value_attributes.count,
177 value_attributes.attributes,
178 increased_value_attributes.count,
179 increased_value_attributes.attributes,
180 decreased_value_attributes.count,
181 decreased_value_attributes.attributes,
185void EmbedderSemanticsUpdate2::AddAction(
186 const CustomAccessibilityAction&
action) {
196EmbedderSemanticsUpdate2::EmbedderStringAttributes
197EmbedderSemanticsUpdate2::CreateStringAttributes(
200 if (attributes.empty()) {
201 return {.count = 0, .attributes =
nullptr};
210 auto result = std::make_unique<std::vector<const FlutterStringAttribute*>>();
211 result->reserve(attributes.size());
213 for (
const auto& attribute : attributes) {
214 auto embedder_attribute = std::make_unique<FlutterStringAttribute>();
216 embedder_attribute->start = attribute->start;
217 embedder_attribute->end = attribute->end;
219 switch (attribute->type) {
221 std::shared_ptr<flutter::LocaleStringAttribute> locale_attribute =
222 std::static_pointer_cast<flutter::LocaleStringAttribute>(attribute);
224 auto embedder_locale = std::make_unique<FlutterLocaleStringAttribute>();
226 embedder_locale->locale = locale_attribute->locale.c_str();
227 locale_attributes_.push_back(std::move(embedder_locale));
230 embedder_attribute->locale = locale_attributes_.back().get();
236 if (!spell_out_attribute_) {
237 auto spell_out_attribute_ =
238 std::make_unique<FlutterSpellOutStringAttribute>();
239 spell_out_attribute_->struct_size =
244 embedder_attribute->spell_out = spell_out_attribute_.get();
249 string_attributes_.push_back(std::move(embedder_attribute));
250 result->push_back(string_attributes_.back().get());
253 node_string_attributes_.push_back(std::move(
result));
256 .count = node_string_attributes_.back()->size(),
257 .attributes = node_string_attributes_.back()->data(),
static constexpr int kMScaleX
horizontal scale factor
static constexpr int kMTransY
vertical translation
static constexpr int kMPersp1
input y perspective factor
static constexpr int kMPersp0
input x perspective factor
static constexpr int kMPersp2
perspective bias
static constexpr int kMTransX
horizontal translation
static constexpr int kMSkewY
vertical skew factor
static constexpr int kMScaleY
vertical scale factor
static constexpr int kMSkewX
horizontal skew factor
EmbedderSemanticsUpdate2(const SemanticsNodeUpdates &nodes, const CustomAccessibilityActionUpdates &actions)
~EmbedderSemanticsUpdate2()
EmbedderSemanticsUpdate(const SemanticsNodeUpdates &nodes, const CustomAccessibilityActionUpdates &actions)
~EmbedderSemanticsUpdate()
std::unordered_map< int32_t, SemanticsNode > SemanticsNodeUpdates
std::unordered_map< int32_t, CustomAccessibilityAction > CustomAccessibilityActionUpdates
std::vector< StringAttributePtr > StringAttributes
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
A structure to represent a rectangle.
A batch of updates to semantics nodes and custom actions.
size_t struct_size
The size of the struct. Must be sizeof(FlutterSemanticsUpdate2).
size_t struct_size
The size of the struct. Must be sizeof(FlutterSemanticsUpdate).
SkScalar fBottom
larger y-axis bounds
SkScalar fLeft
smaller x-axis bounds
SkScalar fRight
larger x-axis bounds
SkScalar fTop
smaller y-axis bounds
StringAttributes decreasedValueAttributes
std::string increasedValue
StringAttributes hintAttributes
StringAttributes increasedValueAttributes
StringAttributes valueAttributes
StringAttributes labelAttributes
std::vector< int32_t > childrenInHitTestOrder
int32_t textSelectionExtent
std::vector< int32_t > customAccessibilityActions
std::string decreasedValue
std::vector< int32_t > childrenInTraversalOrder
int32_t textSelectionBase