[TIZEN] Check if child is visible in scrollable parent.
[platform/core/uifw/dali-adaptor.git] / dali / internal / accessibility / bridge / bridge-base.h
index 094d2c5..5abe6d5 100644 (file)
@@ -21,6 +21,7 @@
 // EXTERNAL INCLUDES
 #include <dali/public-api/actors/layer.h>
 #include <dali/public-api/dali-adaptor-version.h>
+#include <dali/public-api/object/weak-handle.h>
 #include <dali/public-api/signals/connection-tracker.h>
 #include <memory>
 #include <tuple>
@@ -109,12 +110,10 @@ public:
       result = result | child->GetStates();
     }
 
-    return result;
-  }
+    // The Application object should never have the SENSITIVE state
+    result[Dali::Accessibility::State::SENSITIVE] = false;
 
-  Dali::Accessibility::Attributes GetAttributes() const override
-  {
-    return {};
+    return result;
   }
 
   /**
@@ -301,7 +300,7 @@ struct hash<std::pair<CoalescableMessages, Dali::Accessibility::Accessible*>>
  */
 class BridgeBase : public Dali::Accessibility::Bridge, public Dali::ConnectionTracker
 {
-  std::unordered_map<std::pair<CoalescableMessages, Dali::Accessibility::Accessible*>, std::tuple<unsigned int, unsigned int, std::function<void()>>> mCoalescableMessages;
+  std::map<std::pair<CoalescableMessages, Dali::Accessibility::Accessible*>, std::tuple<unsigned int, unsigned int, std::function<void()>>> mCoalescableMessages;
 
   /**
    * @brief Removes all CoalescableMessages using Tick signal.
@@ -608,9 +607,13 @@ public:
   }
 
 protected:
-  mutable ApplicationAccessible                 mApplication;
-  std::vector<Dali::Accessibility::Accessible*> mDefaultLabels;
-  bool                                          mIsScreenReaderSuppressed = false;
+  // We use a weak handle in order not to keep a window alive forever if someone forgets to UnregisterDefaultLabel()
+  using DefaultLabelType  = std::pair<Dali::WeakHandle<Dali::Window>, Dali::Accessibility::Accessible*>;
+  using DefaultLabelsType = std::list<DefaultLabelType>;
+
+  mutable ApplicationAccessible mApplication;
+  DefaultLabelsType             mDefaultLabels;
+  bool                          mIsScreenReaderSuppressed = false;
 
 private:
   /**
@@ -660,6 +663,19 @@ private:
    */
   CacheElementType CreateCacheElement(Dali::Accessibility::Accessible* item);
 
+  /**
+   * @brief Removes expired elements from the default label collection.
+   */
+  void CompressDefaultLabels();
+
+  /**
+   * @brief Gets the window to which this accessible belongs (or an empty handle).
+   *
+   * @param accessible The accessible
+   * @return The window
+   */
+  static Dali::WeakHandle<Dali::Window> GetWindow(Dali::Accessibility::Accessible* accessible);
+
 protected:
   BridgeBase();
   virtual ~BridgeBase();