Merge "[Tizen] support capture in gles 2.0" into tizen_7.0
authorsunghyun kim <scholb.kim@samsung.com>
Fri, 16 Feb 2024 07:08:50 +0000 (07:08 +0000)
committerGerrit Code Review <gerrit@review>
Fri, 16 Feb 2024 07:08:50 +0000 (07:08 +0000)
dali/internal/accessibility/bridge/bridge-accessible.cpp
dali/internal/accessibility/bridge/bridge-accessible.h
dali/internal/accessibility/bridge/bridge-collection.cpp
dali/internal/accessibility/bridge/bridge-collection.h

index 8fa36d2..c57a887 100644 (file)
@@ -394,6 +394,7 @@ void BridgeAccessible::RegisterInterfaces()
   AddFunctionToInterface(desc, "GetReadingMaterial", &BridgeAccessible::GetReadingMaterial);
   AddFunctionToInterface(desc, "GetRelationSet", &BridgeAccessible::GetRelationSet);
   AddFunctionToInterface(desc, "SetListenPostRender", &BridgeAccessible::SetListenPostRender);
+  AddFunctionToInterface(desc, "GetNodeInfo", &BridgeAccessible::GetNodeInfo);
   mDbusServer.addInterface("/", desc, true);
 }
 
@@ -599,6 +600,51 @@ BridgeAccessible::ReadingMaterialType BridgeAccessible::GetReadingMaterial()
     describedByObject};
 }
 
+BridgeAccessible::NodeInfoType BridgeAccessible::GetNodeInfo()
+{
+  auto self         = FindSelf();
+  auto roleName     = self->GetRoleName();
+  auto name         = self->GetName();
+  auto toolkitName  = "dali";
+  auto attributes   = self->GetAttributes();
+  auto states       = self->GetStates();
+
+  auto* component   = Component::DownCast(self);
+  Dali::Rect<> screenExtents = {0, 0, 0, 0};
+  Dali::Rect<> windowExtents = {0, 0, 0, 0};
+  if (component)
+  {
+    screenExtents = component->GetExtents(CoordinateType::SCREEN);
+    windowExtents = component->GetExtents(CoordinateType::WINDOW);
+  }
+
+  auto* valueInterface    = Value::DownCast(self);
+  double currentValue     = 0.0;
+  double minimumIncrement = 0.0;
+  double maximumValue     = 0.0;
+  double minimumValue     = 0.0;
+  if(valueInterface)
+  {
+    currentValue     = valueInterface->GetCurrent();
+    minimumIncrement = valueInterface->GetMinimumIncrement();
+    maximumValue     = valueInterface->GetMaximum();
+    minimumValue     = valueInterface->GetMinimum();
+  }
+
+  return {
+    roleName,
+    name,
+    toolkitName,
+    attributes,
+    states,
+    {screenExtents.x, screenExtents.y, screenExtents.width, screenExtents.height},
+    {windowExtents.x, windowExtents.y, windowExtents.width, windowExtents.height},
+    currentValue,
+    minimumIncrement,
+    maximumValue,
+    minimumValue};
+}
+
 DBus::ValueOrError<bool> BridgeAccessible::DoGesture(Dali::Accessibility::Gesture type, int32_t startPositionX, int32_t startPositionY, int32_t endPositionX, int32_t endPositionY, Dali::Accessibility::GestureState state, uint32_t eventTime)
 {
   // Please be aware of sending GestureInfo point in the different order with parameters
index 329fc43..0f8533d 100644 (file)
@@ -92,6 +92,20 @@ public:
     Dali::Accessibility::Accessible*  // describedByObject
     >;
 
+  using NodeInfoType = DBus::ValueOrError<
+    std::string,                                    // role name
+    std::string,                                    // name
+    std::string,                                    // toolkit name
+    std::unordered_map<std::string, std::string>,   // attributes
+    Dali::Accessibility::States,                    // states
+    std::tuple<int32_t, int32_t, int32_t, int32_t>, // screen extents
+    std::tuple<int32_t, int32_t, int32_t, int32_t>, // window extents
+    double,                                         // current value
+    double,                                         // minimum increment
+    double,                                         // maximum value
+    double                                          // minimum value
+    >;
+
   using Relation = std::tuple<uint32_t, std::vector<Dali::Accessibility::Accessible*>>;
 
   /**
@@ -213,6 +227,12 @@ public:
    */
   DBus::ValueOrError<void> SetListenPostRender(bool enabled);
 
+  /**
+   * @brief Gets Node information of the self object.
+   * @return Node information
+   */
+  NodeInfoType GetNodeInfo();
+
 private:
   /**
    * @brief Calculates Neighbor candidate object in root node.
index d6caa90..2011130 100644 (file)
@@ -47,6 +47,8 @@ void BridgeCollection::RegisterInterfaces()
 {
   DBus::DBusInterfaceDescription desc{Accessible::GetInterfaceName(AtspiInterface::COLLECTION)};
   AddFunctionToInterface(desc, "GetMatches", &BridgeCollection::GetMatches);
+  AddFunctionToInterface(desc, "GetMatchesInMatches", &BridgeCollection::GetMatchesInMatches);
+
   mDbusServer.addInterface("/", desc, true);
 }
 
@@ -449,6 +451,17 @@ struct BridgeCollection::Comparer
            CompareFunc(mState, obj);
   }
 
+  bool IsShowing(Accessible* obj)
+  {
+    if (mState.mMode == Mode::NONE) return true;
+    mState.Update(obj);
+    if (mState.IsRequestEmpty() || mState.IsObjectEmpty()) return true;
+    if (!mState.mRequested[State::SHOWING] ) return true;
+    if (mState.mObject[State::SHOWING]) return true;
+
+    return false;
+  }
+
   ComparerInterfaces mInterface;
   ComparerAttributes mAttribute;
   ComparerRoles      mRole;
@@ -473,6 +486,11 @@ void BridgeCollection::VisitNodes(Accessible* obj, std::vector<Accessible*>& res
     }
   }
 
+  if (!comparer.IsShowing(obj))
+  {
+    return;
+  }
+
   for(auto i = 0u; i < obj->GetChildCount(); ++i)
   {
     VisitNodes(obj->GetChildAtIndex(i), result, comparer, maxCount);
@@ -508,3 +526,44 @@ DBus::ValueOrError<std::vector<Accessible*> > BridgeCollection::GetMatches(Match
 
   return res;
 }
+
+DBus::ValueOrError<std::vector<Accessible*> > BridgeCollection::GetMatchesInMatches(MatchRule firstRule, MatchRule secondRule, uint32_t sortBy, int32_t firstCount, int32_t secondCount, bool traverse)
+{
+  std::vector<Accessible*> res;
+  std::vector<Accessible*> firstRes;
+  std::vector<Accessible*> secondRes;
+  auto                     self          = BridgeBase::FindCurrentObject();
+  auto                     firstMatcher  = Comparer{&firstRule};
+  auto                     secondMatcher = Comparer{&secondRule};
+  VisitNodes(self, firstRes, firstMatcher, firstCount);
+
+  for (auto &obj : firstRes)
+  {
+    VisitNodes(obj, secondRes, secondMatcher, secondCount);
+
+    res.insert(res.end(), secondRes.begin(), secondRes.end());
+    secondRes.clear();
+  }
+
+  switch(static_cast<SortOrder>(sortBy))
+  {
+    case SortOrder::CANONICAL:
+    {
+      break;
+    }
+
+    case SortOrder::REVERSE_CANONICAL:
+    {
+      std::reverse(res.begin(), res.end());
+      break;
+    }
+
+    default:
+    {
+      throw std::domain_error{"unsupported sorting order"};
+    }
+      //TODO: other cases
+  }
+
+  return res;
+}
index 88f4d02..32ea9c1 100644 (file)
@@ -112,6 +112,19 @@ public:
    * @return The matching Accessible objects
    */
   DBus::ValueOrError<std::vector<Dali::Accessibility::Accessible*> > GetMatches(MatchRule rule, uint32_t sortBy, int32_t count, bool traverse);
+
+  /**
+   * @brief Gets the matching Accessible objects with two MatchRules.
+   *
+   * @param[in] firstRule The initial BridgeCollection::MatchRule.
+   * @param[in] secondRule An secondary BridgeCollection::MatchRule.
+   * @param[in] sortBy SortOrder::CANONICAL or SortOrder::REVERSE_CANONICAL
+   * @param[in] firstCount The maximum number of objects to return for the initial match.
+   * @param[in] secondCount The maximum number of objects to return for the secondary match.
+   * @param[in] traverse True if it is traverse, otherwise false.
+   * @return The matching Accessible objects
+   */
+  DBus::ValueOrError<std::vector<Dali::Accessibility::Accessible*> > GetMatchesInMatches(MatchRule firstRule, MatchRule secondRule, uint32_t sortBy, int32_t firstCount, int32_t secondCount,  bool traverse);
 };
 
 #endif // DALI_INTERNAL_ACCESSIBILITY_BRIDGE_COLLECTION_H