[AT-SPI] Remove ShouldReportZeroChildren() 67/275067/3
authorArtur Świgoń <a.swigon@samsung.com>
Mon, 16 May 2022 08:02:59 +0000 (10:02 +0200)
committerArtur Świgoń <a.swigon@samsung.com>
Mon, 16 May 2022 11:33:27 +0000 (13:33 +0200)
This method originated as a hack to cut the AT-SPI tree at a specific
node in the case of compound controls (i.e. composed of multiple views
overlaid on top of each other), so that there is only one leaf node
(instead of a subtree) for Button, Slider, etc.

However, the AccessibilityHidden property was introduced to allow for
controlling which nodes should be removed from the AT-SPI tree, and has
since become the recommended solution over ShouldReportZeroChildren(),
because the latter is less flexible ("all-or-nothing" approach) and
itself requires a hack in dali-csharp-binder to make sure the highlight
frame actor is never removed from the tree.

Change-Id: I761bfaf207e76a23962dcaa0b6c604a163cf8fe5

dali-csharp-binder/src/nui-view-accessible.cpp
dali-csharp-binder/src/nui-view-accessible.h

index b6d9647..4e4cda6 100644 (file)
@@ -40,7 +40,7 @@ struct NUIViewAccessible::AccessibilityDelegate
     std::uint64_t           (*calculateStates)              (RefObject *, std::uint64_t);       //  4
     int                     (*getActionCount)               (RefObject *);                      //  5
     char *                  (*getActionName)                (RefObject *, int);                 //  6
-    bool                    (*shouldReportZeroChildren)     (RefObject *);                      //  7
+    std::uint32_t           (*getInterfaces)                (RefObject *);                      //  7
     double                  (*getMinimum)                   (RefObject *);                      //  8
     double                  (*getCurrent)                   (RefObject *);                      //  9
     double                  (*getMaximum)                   (RefObject *);                      // 10
@@ -69,8 +69,7 @@ struct NUIViewAccessible::AccessibilityDelegate
     bool                    (*selectAll)                    (RefObject *);                      // 33
     bool                    (*clearSelection)               (RefObject *);                      // 34
     bool                    (*deselectChild)                (RefObject *, int);                 // 35
-    std::uint32_t           (*getInterfaces)                (RefObject *);                      // 36
-    Rect<int> *             (*getRangeExtents)              (RefObject *, int, int, int);       // 37
+    Rect<int> *             (*getRangeExtents)              (RefObject *, int, int, int);       // 36
 };
 
 NUIViewAccessible::NUIViewAccessible(Actor actor)
@@ -202,14 +201,6 @@ Property::Index NUIViewAccessible::GetDescriptionPropertyIndex()
     return Property::INVALID_INDEX;
 }
 
-// Ideally, this could be removed along with the DoGetChildren() below if NUI controls
-// switch to setting the AccessibilityHidden property instead. It can be used for the same
-// purpose, and it offers more fine-grained control.
-bool NUIViewAccessible::ShouldReportZeroChildren() const
-{
-    return CallMethod<Interface::ACCESSIBLE>(mTable->shouldReportZeroChildren);
-}
-
 bool NUIViewAccessible::IsScrollable() const
 {
     return CallMethod<Interface::COMPONENT>(mTable->isScrollable);
@@ -220,23 +211,6 @@ bool NUIViewAccessible::ScrollToChild(Actor child)
     return CallMethod<Interface::ACCESSIBLE>(mTable->scrollToChild, new Actor(child));
 }
 
-void NUIViewAccessible::DoGetChildren(std::vector<Accessible*>& children)
-{
-    if (ShouldReportZeroChildren())
-    {
-        // We still allow the highlight frame to be reported as a child of this actor
-        // even though its ShouldReportZeroChildren() method returned true.
-        if (Self() == Accessibility::Accessible::GetCurrentlyHighlightedActor())
-        {
-            children.push_back(Accessibility::Accessible::Get(mCurrentHighlightActor.GetHandle()));
-        }
-    }
-    else
-    {
-        Accessibility::ActorAccessible::DoGetChildren(children);
-    }
-}
-
 Accessibility::AtspiInterfaces NUIViewAccessible::DoGetInterfaces() const
 {
     using Interfaces = Accessibility::AtspiInterfaces;
index 76c0ec8..0d275f7 100644 (file)
@@ -69,14 +69,10 @@ public:
 
     Dali::Property::Index GetDescriptionPropertyIndex() override;
 
-    virtual bool ShouldReportZeroChildren() const;
-
     bool IsScrollable() const override;
 
     bool ScrollToChild(Dali::Actor child) override;
 
-    void DoGetChildren(std::vector<Accessible*>& children) override;
-
     Dali::Accessibility::AtspiInterfaces DoGetInterfaces() const override;
 
     // Value interface