return CalculateStates();
}
-Dali::Accessibility::Attributes ControlAccessible::GetAttributes() const
+void ControlAccessible::UpdateAttributes(Accessibility::Attributes& attributes) const
{
- std::unordered_map<std::string, std::string> attributeMap;
- auto control = Dali::Toolkit::Control::DownCast(Self());
- auto attribute = control.GetProperty(Dali::Toolkit::DevelControl::Property::ACCESSIBILITY_ATTRIBUTES);
- auto map = attribute.GetMap();
+ static const std::string automationIdKey = "automationId";
- if(map)
- {
- auto mapSize = map->Count();
+ ActorAccessible::UpdateAttributes(attributes);
- for(unsigned int i = 0; i < mapSize; i++)
- {
- auto mapKey = map->GetKeyAt(i);
- if(mapKey.type == Dali::Property::Key::STRING)
- {
- std::string mapValue;
- if(map->GetValue(i).Get(mapValue))
- {
- attributeMap.emplace(std::move(mapKey.stringKey), std::move(mapValue));
- }
- }
- }
- }
+ Toolkit::Control control = Toolkit::Control::DownCast(Self());
+ auto automationId = control.GetProperty<std::string>(DevelControl::Property::AUTOMATION_ID);
- auto automationId = control.GetProperty<std::string>(Dali::Toolkit::DevelControl::Property::AUTOMATION_ID);
- if(!automationId.empty())
+ if(automationId.empty())
{
- attributeMap.emplace("automationId", std::move(automationId));
+ attributes.erase(automationIdKey);
+ }
+ else
+ {
+ attributes.insert_or_assign(automationIdKey, std::move(automationId));
}
-
- return attributeMap;
}
bool ControlAccessible::IsHidden() const