24bool IsFlagSet(uint32_t bitfield, uint32_t
flag) {
25 return (bitfield & (1U <<
flag)) != 0;
28bool IsFlagSet(uint64_t bitfield, uint32_t
flag) {
29 return (bitfield & (1ULL <<
flag)) != 0;
32uint32_t ModifyFlag(uint32_t bitfield, uint32_t
flag,
bool set) {
33 return set ? (bitfield |= (1U <<
flag)) : (bitfield &= ~(1U <<
flag));
36uint64_t ModifyFlag(uint64_t bitfield, uint32_t
flag,
bool set) {
37 return set ? (bitfield |= (1ULL <<
flag)) : (bitfield &= ~(1ULL <<
flag));
40std::string StateBitfieldToString(uint32_t state_enum) {
44 if (IsFlagSet(state_enum,
i))
51std::string ActionsBitfieldToString(uint64_t actions) {
55 if (IsFlagSet(actions,
i)) {
57 actions = ModifyFlag(actions,
i,
false);
58 str += actions ?
"," :
"";
64std::string IntVectorToString(
const std::vector<int>& items) {
66 for (
size_t i = 0;
i < items.size(); ++
i) {
75template <
typename FirstType,
typename SecondType>
77 explicit FirstIs(FirstType first) : first_(first) {}
78 bool operator()(std::pair<FirstType, SecondType>
const&
p) {
79 return p.first == first_;
86template <
typename FirstType,
typename SecondType>
87typename std::vector<std::pair<FirstType, SecondType>>::const_iterator
90 const std::vector<std::pair<FirstType, SecondType>>& vector) {
91 return std::find_if(vector.begin(), vector.end(),
92 FirstIs<FirstType, SecondType>(first));
209 : role(
ax::mojom::
Role::kUnknown),
state(0
U), actions(0ULL) {}
278 *
value = iter->second;
298 float*
value)
const {
301 *
value = iter->second;
324 *
value =
static_cast<int>(iter->second);
344 std::string*
value)
const {
347 *
value = iter->second;
356 std::string value_utf8;
358 return std::u16string();
363 std::u16string*
value)
const {
364 std::string value_utf8;
383 return *empty_vector;
387 std::vector<int32_t>*
value)
const {
390 *
value = iter->second;
409 return *empty_vector;
414 std::vector<std::string>*
value)
const {
417 *
value = iter->second;
425 std::string*
value)
const {
426 for (
const std::pair<std::string, std::string>& html_attribute :
428 const std::string& attr = html_attribute.first;
430 *
value = html_attribute.second;
439 std::u16string*
value)
const {
440 std::string value_utf8;
448 const std::string&
value) {
479 const std::vector<int32_t>&
value) {
488 const std::vector<std::string>&
value) {
498 return string_attribute.first == attribute;
505 return int_attribute.first == attribute;
512 return float_attribute.first == attribute;
519 return bool_attribute.first == attribute;
526 return intlist_attribute.first == attribute;
534 [attribute](
const auto& stringlist_attribute) {
535 return stringlist_attribute.first == attribute;
566 return style_attributes;
572 <<
"A valid role is required before setting the name attribute, "
574 "the role is used for setting the required NameFrom attribute.";
579 [](
const auto& string_attribute) {
580 return string_attribute.first ==
581 ax::mojom::StringAttribute::kName;
645 return IsFlagSet(
state,
static_cast<uint32_t
>(state_enum));
654 return IsFlagSet(
static_cast<uint32_t
>(style),
655 static_cast<uint32_t
>(text_style_enum));
660 return IsFlagSet(
static_cast<uint32_t
>(dropeffect),
661 static_cast<uint32_t
>(dropeffect_enum));
669 state = ModifyFlag(
state,
static_cast<uint32_t
>(state_enum),
true);
677 state = ModifyFlag(
state,
static_cast<uint32_t
>(state_enum),
false);
681 switch (action_enum) {
733 actions = ModifyFlag(
actions,
static_cast<uint32_t
>(action_enum),
true);
742 style = ModifyFlag(
static_cast<uint32_t
>(style),
743 static_cast<uint32_t
>(text_style_enum),
true);
754 dropeffect = ModifyFlag(
static_cast<uint32_t
>(dropeffect),
755 static_cast<uint32_t
>(dropeffect_enum),
true);
770 static_cast<int32_t
>(checked_state));
789 static_cast<int32_t
>(default_action_verb));
803 static_cast<int32_t
>(has_popup));
817 static_cast<int32_t
>(invalid_state));
831 static_cast<int32_t
>(name_from));
846 static_cast<int32_t
>(description_from));
860 static_cast<int32_t
>(text_position));
875 static_cast<int32_t
>(status));
889 static_cast<int32_t
>(restriction));
903 static_cast<int32_t
>(list_style));
916 static_cast<int32_t
>(text_align));
929 static_cast<int32_t
>(text_direction));
1075 for (
const std::pair<ax::mojom::IntAttribute, int32_t>& int_attribute :
1078 switch (int_attribute.first) {
1080 result += std::string(
" action=") +
1082 int_attribute.second));
1165 result +=
" sort_direction=none";
1168 result +=
" sort_direction=ascending";
1171 result +=
" sort_direction=descending";
1174 result +=
" sort_direction=other";
1186 result +=
" description_from=";
1218 result +=
" aria_current_state=false";
1221 result +=
" aria_current_state=true";
1224 result +=
" aria_current_state=page";
1227 result +=
" aria_current_state=step";
1230 result +=
" aria_current_state=location";
1233 result +=
" aria_current_state=date";
1236 result +=
" aria_current_state=time";
1252 result +=
" list_style=circle";
1255 result +=
" list_style=disc";
1258 result +=
" list_style=image";
1261 result +=
" list_style=numeric";
1264 result +=
" list_style=other";
1267 result +=
" list_style=square";
1274 result +=
" text_align=";
1282 result +=
" text_direction=ltr";
1285 result +=
" text_direction=rtl";
1288 result +=
" text_direction=ttb";
1291 result +=
" text_direction=btt";
1300 result +=
" text_position=none";
1303 result +=
" text_position=subscript";
1306 result +=
" text_position=superscript";
1313 std::string text_style_value;
1315 text_style_value +=
"bold,";
1317 text_style_value +=
"italic,";
1319 text_style_value +=
"underline,";
1321 text_style_value +=
"line-through,";
1323 text_style_value +=
"overline,";
1324 result += text_style_value.substr(0, text_style_value.size() - 1);
1328 result += std::string(
" text_overline_style=") +
1330 int_attribute.second));
1333 result += std::string(
" text_strikethrough_style=") +
1335 int_attribute.second));
1338 result += std::string(
" text_underline_style=") +
1340 int_attribute.second));
1351 result +=
" haspopup=true";
1354 result +=
" haspopup=menu";
1357 result +=
" haspopup=listbox";
1360 result +=
" haspopup=tree";
1363 result +=
" haspopup=grid";
1366 result +=
" haspopup=dialog";
1376 result +=
" invalid_state=false";
1379 result +=
" invalid_state=true";
1382 result +=
" invalid_state=other";
1391 result +=
" checked_state=false";
1394 result +=
" checked_state=true";
1397 result +=
" checked_state=mixed";
1406 result +=
" restriction=readonly";
1409 result +=
" restriction=disabled";
1422 result += std::string(
" image_annotation_status=") +
1424 int_attribute.second));
1437 for (
const std::pair<ax::mojom::StringAttribute, std::string>&
1439 std::string
value = string_attribute.second;
1440 switch (string_attribute.first) {
1472 result +=
" image_data_url=(" +
1526 for (
const std::pair<ax::mojom::FloatAttribute, float>& float_attribute :
1529 switch (float_attribute.first) {
1556 for (
const std::pair<ax::mojom::BoolAttribute, bool>& bool_attribute :
1558 std::string
value = bool_attribute.second ?
"true" :
"false";
1559 switch (bool_attribute.first) {
1624 const std::vector<int32_t>&
values = intlist_attribute.second;
1625 switch (intlist_attribute.first) {
1627 result +=
" indirect_child_ids=" + IntVectorToString(
values);
1630 result +=
" controls_ids=" + IntVectorToString(
values);
1633 result +=
" describedby_ids=" + IntVectorToString(
values);
1642 result +=
" labelledby_ids=" + IntVectorToString(
values);
1645 result +=
" radio_group_ids=" + IntVectorToString(
values);
1648 std::string types_str;
1649 for (
size_t i = 0;
i <
values.size(); ++
i) {
1658 types_str +=
"spelling&";
1660 types_str +=
"grammar&";
1662 types_str +=
"text_match&";
1665 types_str +=
"active_suggestion&";
1667 types_str +=
"suggestion&";
1669 if (!types_str.empty())
1670 types_str = types_str.substr(0, types_str.size() - 1);
1673 if (!types_str.empty())
1674 result +=
" marker_types=" + types_str;
1678 result +=
" marker_starts=" + IntVectorToString(
values);
1684 result +=
" character_offsets=" + IntVectorToString(
values);
1687 result +=
" cached_line_start_offsets=" + IntVectorToString(
values);
1696 result +=
" custom_action_ids=" + IntVectorToString(
values);
1704 std::vector<std::string>>& stringlist_attribute :
1706 const std::vector<std::string>&
values = stringlist_attribute.second;
1707 switch (stringlist_attribute.first) {
1737 str +=
" " + std::string(
ui::ToString(dropeffect_enum));
1741 return str.substr(1);
FlutterSemanticsFlag flag
@ kCustomActionDescriptions
@ kNotUserSelectableStyle
@ kAttributeExplicitlyEmpty
@ kInternalInvalidateTree
@ kClearAccessibilityFocus
@ kSetSequentialFocusNavigationStartingPoint
@ kTextStrikethroughStyle
std::string StringPrintf(const std::string &format, Args... args)
std::string ToUpperASCII(std::string str)
std::string UTF16ToUTF8(std::u16string src)
const std::string & EmptyString()
std::u16string UTF8ToUTF16(std::string src)
size_t EraseIf(std::vector< T, Allocator > &container, Predicate pred)
std::string JoinString(std::vector< std::string > tokens, std::string delimiter)
bool LowerCaseEqualsASCII(std::string a, std::string b)
std::string NumberToString(int32_t number)
DEF_SWITCHES_START aot vmservice shared library name
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 set
bool IsNodeIdIntAttribute(ax::mojom::IntAttribute attr)
bool IsRangeValueSupported(const ax::mojom::Role role)
bool IsReadOnlySupported(const ax::mojom::Role role)
const char * ToString(ax::mojom::Event event)
bool SupportsExpandCollapse(const ax::mojom::Role role)
bool IsNodeIdIntListAttribute(ax::mojom::IntListAttribute attr)
bool SupportsToggle(const ax::mojom::Role role)
bool ShouldHaveReadonlyStateByDefault(const ax::mojom::Role role)
bool IsClickable(const ax::mojom::Role role)
bool IsButton(const ax::mojom::Role role)
bool IsText(ax::mojom::Role role)
AXRelativeBounds relative_bounds
bool IsPlainTextField() const
void AddFloatAttribute(ax::mojom::FloatAttribute attribute, float value)
bool IsSelectable() const
void SetInvalidState(ax::mojom::InvalidState invalid_state)
ax::mojom::Restriction GetRestriction() const
ax::mojom::ImageAnnotationStatus GetImageAnnotationStatus() const
std::vector< std::pair< ax::mojom::FloatAttribute, float > > float_attributes
const std::vector< std::string > & GetStringListAttribute(ax::mojom::StringListAttribute attribute) const
bool HasState(ax::mojom::State state) const
bool HasIntAttribute(ax::mojom::IntAttribute attribute) const
void SetRestriction(ax::mojom::Restriction restriction)
bool HasStringListAttribute(ax::mojom::StringListAttribute attribute) const
void SetDescriptionFrom(ax::mojom::DescriptionFrom description_from)
ax::mojom::HasPopup GetHasPopup() const
void AddIntListAttribute(ax::mojom::IntListAttribute attribute, const std::vector< int32_t > &value)
ax::mojom::TextAlign GetTextAlign() const
void AddState(ax::mojom::State state)
void RemoveBoolAttribute(ax::mojom::BoolAttribute attribute)
void SetDefaultActionVerb(ax::mojom::DefaultActionVerb default_action_verb)
bool IsReadOnlyOrDisabled() const
void RemoveFloatAttribute(ax::mojom::FloatAttribute attribute)
void RemoveIntAttribute(ax::mojom::IntAttribute attribute)
void AddIntAttribute(ax::mojom::IntAttribute attribute, int32_t value)
void SetTextAlign(ax::mojom::TextAlign text_align)
AXNodeData & operator=(AXNodeData other)
std::vector< int32_t > child_ids
bool HasCheckedState() const
bool HasIntListAttribute(ax::mojom::IntListAttribute attribute) const
bool IsActivatable() const
bool HasDropeffect(ax::mojom::Dropeffect dropeffect) const
bool GetHtmlAttribute(const char *attribute, std::u16string *value) const
void SetValue(const std::string &value)
bool HasFloatAttribute(ax::mojom::FloatAttribute attribute) const
void SetHasPopup(ax::mojom::HasPopup has_popup)
ax::mojom::DefaultActionVerb GetDefaultActionVerb() const
bool HasAction(ax::mojom::Action action) const
void SetTextDirection(ax::mojom::WritingDirection text_direction)
void RemoveIntListAttribute(ax::mojom::IntListAttribute attribute)
bool HasStringAttribute(ax::mojom::StringAttribute attribute) const
std::vector< std::pair< ax::mojom::IntAttribute, int32_t > > int_attributes
void AddStringListAttribute(ax::mojom::StringListAttribute attribute, const std::vector< std::string > &value)
void SetName(const std::string &name)
void AddDropeffect(ax::mojom::Dropeffect dropeffect)
std::string DropeffectBitfieldToString() const
void SetDescription(const std::string &description)
ax::mojom::NameFrom GetNameFrom() const
ax::mojom::CheckedState GetCheckedState() const
bool IsRichTextField() const
std::vector< std::pair< ax::mojom::IntListAttribute, std::vector< int32_t > > > intlist_attributes
virtual std::string ToString() const
AXNodeTextStyles GetTextStyles() const
bool IsButtonPressed() const
std::vector< std::pair< ax::mojom::StringAttribute, std::string > > string_attributes
void SetImageAnnotationStatus(ax::mojom::ImageAnnotationStatus status)
void RemoveState(ax::mojom::State state)
bool IsPasswordField() const
std::vector< std::pair< std::string, std::string > > html_attributes
void AddStringAttribute(ax::mojom::StringAttribute attribute, const std::string &value)
void SetTooltip(const std::string &value)
ax::mojom::InvalidState GetInvalidState() const
ax::mojom::WritingDirection GetTextDirection() const
void SetNameExplicitlyEmpty()
bool HasTextStyle(ax::mojom::TextStyle text_style) const
bool IsRangeValueSupported() const
ax::mojom::ListStyle GetListStyle() const
bool GetBoolAttribute(ax::mojom::BoolAttribute attribute) const
void AddTextStyle(ax::mojom::TextStyle text_style)
void AddBoolAttribute(ax::mojom::BoolAttribute attribute, bool value)
std::vector< std::pair< ax::mojom::StringListAttribute, std::vector< std::string > > > stringlist_attributes
ax::mojom::DescriptionFrom GetDescriptionFrom() const
const std::vector< int32_t > & GetIntListAttribute(ax::mojom::IntListAttribute attribute) const
float GetFloatAttribute(ax::mojom::FloatAttribute attribute) const
void SetTextPosition(ax::mojom::TextPosition text_position)
int GetIntAttribute(ax::mojom::IntAttribute attribute) const
bool IsInvisibleOrIgnored() const
bool HasBoolAttribute(ax::mojom::BoolAttribute attribute) const
const std::string & GetStringAttribute(ax::mojom::StringAttribute attribute) const
ax::mojom::TextPosition GetTextPosition() const
void RemoveStringAttribute(ax::mojom::StringAttribute attribute)
std::vector< std::pair< ax::mojom::BoolAttribute, bool > > bool_attributes
void RemoveStringListAttribute(ax::mojom::StringListAttribute attribute)
bool SupportsExpandCollapse() const
void SetListStyle(ax::mojom::ListStyle list_style)
bool GetString16Attribute(ax::mojom::StringAttribute attribute, std::u16string *value) const
void SetCheckedState(ax::mojom::CheckedState checked_state)
void SetNameFrom(ax::mojom::NameFrom name_from)
bool IsMenuButton() const
void AddAction(ax::mojom::Action action)
int32_t strikethrough_style
std::string ToString() const
#define BASE_DCHECK(condition)
#define BASE_UNREACHABLE()