[ATSPI] Check parents to define SHOWING state 78/266578/9
authorShinwoo Kim <cinoo.kim@samsung.com>
Mon, 15 Nov 2021 11:19:47 +0000 (20:19 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Tue, 23 Nov 2021 07:53:17 +0000 (16:53 +0900)
It will not be SHOWING if an accessible has invisible parent in its ascendant.

This is necessary for the following case.
The NUI navigator has more than 2 pages, and the below page's controls have
SHOWING state without this patch.

Change-Id: I27a7a998154267a14c2aa295a48b48b9e2896520

automated-tests/src/dali-toolkit-internal/utc-Dali-Accessibility-Accessible.cpp
dali-toolkit/devel-api/controls/accessible-impl.cpp

index 423893a..12abee1 100644 (file)
@@ -128,5 +128,16 @@ int UtcDaliAccessibilityCheckShowingState(void)
   states = q->GetStates();
   DALI_TEST_EQUALS((int) states[Dali::Accessibility::State::SHOWING], (int) false, TEST_LOCATION);
 
   states = q->GetStates();
   DALI_TEST_EQUALS((int) states[Dali::Accessibility::State::SHOWING], (int) false, TEST_LOCATION);
 
+  // Make SHOWING parent invisible
+  parentButton.SetProperty(Actor::Property::VISIBLE, false);
+
+  application.SendNotification();
+  application.Render(16);
+
+  q = Dali::Accessibility::Accessible::Get(buttonA);
+  DALI_TEST_CHECK(q);
+  states = q->GetStates();
+  DALI_TEST_EQUALS((int) states[Dali::Accessibility::State::SHOWING], (int) false, TEST_LOCATION);
+
   END_TEST;
   END_TEST;
-}
\ No newline at end of file
+}
index 9f6f4f9..1cf9a26 100644 (file)
@@ -36,7 +36,8 @@
 
 namespace Dali::Toolkit::DevelControl
 {
 
 namespace Dali::Toolkit::DevelControl
 {
-
+namespace
+{
 static std::string GetLocaleText(std::string string, const char *domain = "dali-toolkit")
 {
 #ifdef DGETTEXT_ENABLED
 static std::string GetLocaleText(std::string string, const char *domain = "dali-toolkit")
 {
 #ifdef DGETTEXT_ENABLED
@@ -48,6 +49,23 @@ static std::string GetLocaleText(std::string string, const char *domain = "dali-
 #endif
 }
 
 #endif
 }
 
+static Dali::Actor CreateHighlightIndicatorActor()
+{
+  std::string focusBorderImagePath(AssetManager::GetDaliImagePath());
+  focusBorderImagePath += "/keyboard_focus.9.png";
+
+  // Create the default if it hasn't been set and one that's shared by all the
+  // keyboard focusable actors
+  auto actor = Toolkit::ImageView::New(focusBorderImagePath);
+  actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
+
+  DevelControl::AppendAccessibilityAttribute(actor, "highlight", std::string());
+  actor.SetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE, false);
+
+  return actor;
+}
+} // unnamed namespace
+
 AccessibleImpl::AccessibleImpl(Dali::Actor self, Dali::Accessibility::Role role, bool modal)
 : mSelf(self),
   mIsModal(modal)
 AccessibleImpl::AccessibleImpl(Dali::Actor self, Dali::Accessibility::Role role, bool modal)
 : mSelf(self),
   mIsModal(modal)
@@ -203,7 +221,7 @@ std::string AccessibleImpl::GetLocalizedRoleName()
 bool AccessibleImpl::IsShowing()
 {
   Dali::Actor self = Self();
 bool AccessibleImpl::IsShowing()
 {
   Dali::Actor self = Self();
-  if(self.GetProperty(Dali::DevelActor::Property::CULLED).Get<bool>() || !self.GetCurrentProperty<bool>(Actor::Property::VISIBLE))
+  if(!self.GetProperty<bool>(Actor::Property::VISIBLE) || self.GetProperty<Vector4>(Actor::Property::WORLD_COLOR).a == 0 || self.GetProperty<bool>(Dali::DevelActor::Property::CULLED))
   {
     return false;
   }
   {
     return false;
   }
@@ -219,6 +237,10 @@ bool AccessibleImpl::IsShowing()
   while(parent)
   {
     auto control      = Dali::Toolkit::Control::DownCast(parent->Self());
   while(parent)
   {
     auto control      = Dali::Toolkit::Control::DownCast(parent->Self());
+    if(!control.GetProperty<bool>(Actor::Property::VISIBLE))
+    {
+      return false;
+    }
     auto clipMode     = control.GetProperty(Actor::Property::CLIPPING_MODE).Get<bool>();
     auto parentExtent = parent->GetExtents(Dali::Accessibility::CoordinateType::WINDOW);
     if ((clipMode != ClippingMode::DISABLED) && !parentExtent.Intersects(childExtent))
     auto clipMode     = control.GetProperty(Actor::Property::CLIPPING_MODE).Get<bool>();
     auto parentExtent = parent->GetExtents(Dali::Accessibility::CoordinateType::WINDOW);
     if ((clipMode != ClippingMode::DISABLED) && !parentExtent.Intersects(childExtent))
@@ -250,7 +272,7 @@ Dali::Accessibility::States AccessibleImpl::CalculateStates()
   state[Dali::Accessibility::State::HIGHLIGHTED] = GetCurrentlyHighlightedActor() == self;
   state[Dali::Accessibility::State::ENABLED]     = true;
   state[Dali::Accessibility::State::SENSITIVE]   = true;
   state[Dali::Accessibility::State::HIGHLIGHTED] = GetCurrentlyHighlightedActor() == self;
   state[Dali::Accessibility::State::ENABLED]     = true;
   state[Dali::Accessibility::State::SENSITIVE]   = true;
-  state[Dali::Accessibility::State::VISIBLE]     = true;
+  state[Dali::Accessibility::State::VISIBLE]     = self.GetProperty<bool>(Actor::Property::VISIBLE);
 
   if(mIsModal)
   {
 
   if(mIsModal)
   {
@@ -335,22 +357,6 @@ bool AccessibleImpl::GrabFocus()
   return Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor(Self());
 }
 
   return Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor(Self());
 }
 
-static Dali::Actor CreateHighlightIndicatorActor()
-{
-  std::string focusBorderImagePath(AssetManager::GetDaliImagePath());
-  focusBorderImagePath += "/keyboard_focus.9.png";
-
-  // Create the default if it hasn't been set and one that's shared by all the
-  // keyboard focusable actors
-  auto actor = Toolkit::ImageView::New(focusBorderImagePath);
-  actor.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
-
-  DevelControl::AppendAccessibilityAttribute(actor, "highlight", std::string());
-  actor.SetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE, false);
-
-  return actor;
-}
-
 void AccessibleImpl::ScrollToSelf()
 {
   auto* child = this;
 void AccessibleImpl::ScrollToSelf()
 {
   auto* child = this;