X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fdevel-api%2Fcontrols%2Fcontrol-accessible.cpp;h=5ac6317771d25e1f8f6dbc59dcd07a1694b10626;hb=56fe73b3b5a7482d10bb9c271f494b5a09c2c75f;hp=9a3da6c6a484e80ec546455fe21dd00e10a69eaa;hpb=24513084007fb981ed006ad2e8f8649d7b54e176;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/devel-api/controls/control-accessible.cpp b/dali-toolkit/devel-api/controls/control-accessible.cpp index 9a3da6c..5ac6317 100644 --- a/dali-toolkit/devel-api/controls/control-accessible.cpp +++ b/dali-toolkit/devel-api/controls/control-accessible.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,14 +38,14 @@ namespace Dali::Toolkit::DevelControl { namespace { -static std::string GetLocaleText(std::string string, const char *domain = "dali-toolkit") +static std::string GetLocaleText(std::string string, const char* domain = "dali-toolkit") { #ifdef DGETTEXT_ENABLED - /*TODO: currently non-localized string is used as a key for translation lookup. In case the lookup key formatting is forced + /*TODO: currently non-localized string is used as a key for translation lookup. In case the lookup key formatting is forced consider calling utility function for converting non-localized string into well-formatted key before lookup. */ - return dgettext(domain, string.c_str()); + return dgettext(domain, string.c_str()); #else - return string; + return string; #endif } @@ -104,7 +104,7 @@ std::string ControlAccessible::GetName() const Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control); Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl); - std::string name; + std::string name; if(!controlImpl.mAccessibilityGetNameSignal.Empty()) { @@ -142,7 +142,7 @@ std::string ControlAccessible::GetDescription() const Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control); Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl); - std::string description; + std::string description; if(!controlImpl.mAccessibilityGetDescriptionSignal.Empty()) { @@ -183,7 +183,7 @@ std::string ControlAccessible::GetLocalizedRoleName() const bool ControlAccessible::IsShowing() { Dali::Actor self = Self(); - if(!self.GetProperty(Actor::Property::VISIBLE) || self.GetProperty(Actor::Property::WORLD_COLOR).a == 0 || self.GetProperty(Dali::DevelActor::Property::CULLED)) + if(!self.GetProperty(Actor::Property::VISIBLE) || Dali::EqualsZero(self.GetProperty(Actor::Property::WORLD_COLOR).a) || self.GetProperty(Dali::DevelActor::Property::CULLED)) { return false; } @@ -195,20 +195,13 @@ bool ControlAccessible::IsShowing() return true; } - auto childExtent = child->GetExtents(Dali::Accessibility::CoordinateType::WINDOW); while(parent) { - auto control = Dali::Toolkit::Control::DownCast(parent->Self()); + auto control = Dali::Toolkit::Control::DownCast(parent->Self()); if(!control.GetProperty(Actor::Property::VISIBLE)) { return false; } - auto clipMode = control.GetProperty(Actor::Property::CLIPPING_MODE).Get(); - auto parentExtent = parent->GetExtents(Dali::Accessibility::CoordinateType::WINDOW); - if ((clipMode != ClippingMode::DISABLED) && !parentExtent.Intersects(childExtent)) - { - return false; - } parent = dynamic_cast(parent->GetParent()); } @@ -219,7 +212,7 @@ Dali::Accessibility::States ControlAccessible::CalculateStates() { using Dali::Accessibility::State; - Dali::Actor self = Self(); + Dali::Actor self = Self(); Dali::Accessibility::States states; states[State::FOCUSABLE] = self.GetProperty(Actor::Property::KEYBOARD_FOCUSABLE); @@ -243,9 +236,9 @@ Dali::Accessibility::States ControlAccessible::GetStates() Dali::Accessibility::Attributes ControlAccessible::GetAttributes() const { std::unordered_map attributeMap; - auto control = Dali::Toolkit::Control::DownCast(Self()); - auto attribute = control.GetProperty(Dali::Toolkit::DevelControl::Property::ACCESSIBILITY_ATTRIBUTES); - auto map = attribute.GetMap(); + auto control = Dali::Toolkit::Control::DownCast(Self()); + auto attribute = control.GetProperty(Dali::Toolkit::DevelControl::Property::ACCESSIBILITY_ATTRIBUTES); + auto map = attribute.GetMap(); if(map) { @@ -265,6 +258,12 @@ Dali::Accessibility::Attributes ControlAccessible::GetAttributes() const } } + auto automationId = control.GetProperty(Dali::Toolkit::DevelControl::Property::AUTOMATION_ID); + if(!automationId.empty()) + { + attributeMap.emplace("automationId", std::move(automationId)); + } + return attributeMap; } @@ -285,12 +284,12 @@ bool ControlAccessible::GrabFocus() void ControlAccessible::ScrollToSelf() { - auto* child = this; + auto* child = this; auto* parent = dynamic_cast(child->GetParent()); - while (parent) + while(parent) { - if (parent->IsScrollable()) + if(parent->IsScrollable()) { parent->ScrollToChild(child->Self()); } @@ -317,8 +316,8 @@ void ControlAccessible::UnregisterPositionPropertyNotification() bool ControlAccessible::GrabHighlight() { - Dali::Actor self = Self(); - auto oldHighlightedActor = GetCurrentlyHighlightedActor(); + Dali::Actor self = Self(); + auto oldHighlightedActor = GetCurrentlyHighlightedActor(); if(!Dali::Accessibility::IsUp()) { @@ -457,24 +456,7 @@ std::vector ControlAccessible::GetRelationSet() { auto control = Dali::Toolkit::Control::DownCast(Self()); - Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control); - Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl); - - std::vector ret; - - for(auto& relation : controlImpl.mAccessibilityRelations) - { - auto& targets = relation.second; - - ret.emplace_back(Accessibility::Relation{relation.first, {}}); - - // Map every Accessible* to its Address - std::transform(targets.begin(), targets.end(), std::back_inserter(ret.back().targets), [](auto* x) { - return x->GetAddress(); - }); - } - - return ret; + return DevelControl::GetAccessibilityRelations(control); } bool ControlAccessible::ScrollToChild(Actor child)