[AT-SPI] Add DevelControl::Property::ACCESSIBILITY_HIDDEN 19/266919/11
authorArtur Świgoń <a.swigon@samsung.com>
Mon, 22 Nov 2021 10:04:15 +0000 (11:04 +0100)
committerArtur Świgoń <a.swigon@samsung.com>
Mon, 3 Jan 2022 11:04:05 +0000 (12:04 +0100)
Change-Id: Ib9e67ae2bda4e38d9f5eed3cf0977948b3573eac

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

index 6d2e281aca0d11fd52567eef1a74d9167a336a6a..643b5524dc84341c29126cb4510bd9fba965b442 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <dali.h>
 #include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
 
 #include <dali/devel-api/adaptor-framework/accessibility.h>
 #include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
@@ -142,3 +143,24 @@ int UtcDaliAccessibilityCheckShowingState(void)
 
   END_TEST;
 }
+
+int utcDaliAccessibilityHidden(void)
+{
+  ToolkitTestApplication application;
+
+  auto  control    = Toolkit::Control::New();
+  auto* accessible = Dali::Accessibility::Accessible::Get(control);
+
+  // Check not hidden
+  DALI_TEST_CHECK(accessible);
+  DALI_TEST_CHECK(!accessible->IsHidden());
+  DALI_TEST_CHECK(!control.GetProperty<bool>(Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN));
+
+  control.SetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN, true);
+
+  // Check hidden
+  DALI_TEST_CHECK(accessible->IsHidden());
+  DALI_TEST_CHECK(control.GetProperty<bool>(Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN));
+
+  END_TEST;
+}
index de618749ec2a719797792ce1e7008da0337671e0..21fc8e2bf4885b68e5a082092cab72b554e6fda3 100644 (file)
@@ -282,6 +282,16 @@ Dali::Accessibility::Attributes ControlAccessible::GetAttributes() const
   return attributeMap;
 }
 
+bool ControlAccessible::IsHidden() const
+{
+  auto control = Dali::Toolkit::Control::DownCast(Self());
+
+  Internal::Control&       internalControl = Toolkit::Internal::GetImplementation(control);
+  Internal::Control::Impl& controlImpl     = Internal::Control::Impl::Get(internalControl);
+
+  return controlImpl.mAccessibilityHidden;
+}
+
 bool ControlAccessible::GrabFocus()
 {
   return Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor(Self());
index bbff32750c6e57a754d18a6eb00fdb2404844a02..7b0ae78a30ebdaad7424ad56caa98c5e6bb57b3a 100644 (file)
@@ -115,6 +115,11 @@ public:
    */
   Dali::Accessibility::Attributes GetAttributes() const override;
 
+  /**
+   * @copydoc Dali::Accessibility::Accessible::IsHidden()
+   */
+  bool IsHidden() const override;
+
   /**
    * @copydoc Dali::Accessibility::Component::GrabFocus()
    */
index 5d276cbbb3ccaa3cf413f687589fa44576960226..33e02f53b3aaa7bba6ecfe0c9322d505e80caf25 100644 (file)
@@ -175,11 +175,13 @@ enum
    * @see Dali::Accessibility::Role
    */
   ACCESSIBILITY_ROLE,
+
   /**
    * @brief Mark of able to highlight object.
    * @details Name "accessibilityHighlightable", type Property::BOOLEAN.
    */
   ACCESSIBILITY_HIGHLIGHTABLE,
+
   /**
    * @brief Set of accessibility attributes describing object in accessibility hierarchy
    * @details Name "accessibilityAttributes", type Property::MAP
@@ -192,6 +194,13 @@ enum
    * @note If a control's dispatchKeyEvents is set to false, then it's children will not emit a key event signal either.
    */
   DISPATCH_KEY_EVENTS,
+
+  /**
+   * @brief Marks the object as invisible to AT-SPI clients.
+   * @details Name "accessibilityHidden", type Property::BOOLEAN.
+   * @note The representative Accessible object will not appear in the AT-SPI tree.
+   */
+  ACCESSIBILITY_HIDDEN,
 };
 
 } // namespace Property
index a476ecae4597998195fbccecfea852ee5e9dde3c..e3cea9273ccb0787d4e0510c320be4eea56f1015 100644 (file)
@@ -468,7 +468,8 @@ const PropertyRegistration Control::Impl::PROPERTY_18(typeRegistration, "accessi
 const PropertyRegistration Control::Impl::PROPERTY_19(typeRegistration, "accessibilityRole",              Toolkit::DevelControl::Property::ACCESSIBILITY_ROLE,               Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
 const PropertyRegistration Control::Impl::PROPERTY_20(typeRegistration, "accessibilityHighlightable",     Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE,      Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
 const PropertyRegistration Control::Impl::PROPERTY_21(typeRegistration, "accessibilityAttributes",        Toolkit::DevelControl::Property::ACCESSIBILITY_ATTRIBUTES,         Property::MAP,     &Control::Impl::SetProperty, &Control::Impl::GetProperty);
-const PropertyRegistration Control::Impl::PROPERTY_22(typeRegistration, "dispatchKeyEvents",              Toolkit::DevelControl::Property::DISPATCH_KEY_EVENTS,               Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
+const PropertyRegistration Control::Impl::PROPERTY_22(typeRegistration, "dispatchKeyEvents",              Toolkit::DevelControl::Property::DISPATCH_KEY_EVENTS,              Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
+const PropertyRegistration Control::Impl::PROPERTY_23(typeRegistration, "accessibilityHidden",            Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN,             Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
 
 // clang-format on
 
@@ -1369,6 +1370,16 @@ void Control::Impl::SetProperty(BaseObject* object, Property::Index index, const
         }
         break;
       }
+
+      case Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN:
+      {
+        bool hidden;
+        if(value.Get(hidden))
+        {
+          controlImpl.mImpl->mAccessibilityHidden = hidden;
+        }
+        break;
+      }
     }
   }
 }
@@ -1529,11 +1540,18 @@ Property::Value Control::Impl::GetProperty(BaseObject* object, Property::Index i
         value = controlImpl.mImpl->mAccessibilityAttributes;
         break;
       }
+
       case Toolkit::DevelControl::Property::DISPATCH_KEY_EVENTS:
       {
         value = controlImpl.mImpl->mDispatchKeyEvents;
         break;
       }
+
+      case Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN:
+      {
+        value = controlImpl.mImpl->mAccessibilityHidden;
+        break;
+      }
     }
   }
 
index e616e52b32654bede8e0602a197decb7bac60d88..a227648a92852d7f56c41372093cadd2169048d9 100644 (file)
@@ -546,6 +546,8 @@ public:
   bool mAccessibilityHighlightable    = false;
   bool mAccessibilityHighlightableSet = false;
 
+  bool mAccessibilityHidden = false;
+
   Dali::Accessibility::Role mAccessibilityRole = Dali::Accessibility::Role::UNKNOWN;
 
   std::map<Dali::Accessibility::RelationType, std::set<Accessibility::Accessible*>> mAccessibilityRelations;
@@ -596,6 +598,7 @@ public:
   static const PropertyRegistration PROPERTY_20;
   static const PropertyRegistration PROPERTY_21;
   static const PropertyRegistration PROPERTY_22;
+  static const PropertyRegistration PROPERTY_23;
 
 private:
   // Accessibility - notification for highlighted object to check if it is showing.
index db9972878c83b129b1815b0715e49e8caec4c309..9c52f227df25a8bf0c33072b78d48e67e978f61a 100644 (file)
@@ -566,7 +566,7 @@ void Control::OnPropertySet(Property::Index index, const Property::Value& proper
     }
     case Actor::Property::VISIBLE:
     {
-      if(Dali::Accessibility::IsUp())
+      if(Dali::Accessibility::IsUp() && !Self().GetProperty<bool>(Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN))
       {
         Dali::Accessibility::Accessible::Get(Self())->EmitVisible(Self().GetProperty(Actor::Property::VISIBLE).Get<bool>());
       }