[Tizen][AT-SPI] Allow manual control of ReadingMaterial::listChildrenCount
[platform/core/uifw/dali-adaptor.git] / dali / internal / accessibility / bridge / bridge-accessible.cpp
index db9a2aa..8fa36d2 100644 (file)
@@ -488,14 +488,16 @@ BridgeAccessible::ReadingMaterialType BridgeAccessible::GetReadingMaterial()
 
   auto describedByObject = findObjectByRelationType(RelationType::DESCRIBED_BY);
 
-  double currentValue     = 0.0;
-  double minimumIncrement = 0.0;
-  double maximumValue     = 0.0;
-  double minimumValue     = 0.0;
-  auto*  valueInterface   = Value::DownCast(self);
+  double      currentValue     = 0.0;
+  std::string currentValueText;
+  double      minimumIncrement = 0.0;
+  double      maximumValue     = 0.0;
+  double      minimumValue     = 0.0;
+  auto*       valueInterface   = Value::DownCast(self);
   if(valueInterface)
   {
     currentValue     = valueInterface->GetCurrent();
+    currentValueText = valueInterface->GetValueText();
     minimumIncrement = valueInterface->GetMinimumIncrement();
     maximumValue     = valueInterface->GetMaximum();
     minimumValue     = valueInterface->GetMinimum();
@@ -526,9 +528,16 @@ BridgeAccessible::ReadingMaterialType BridgeAccessible::GetReadingMaterial()
     }
   }
 
+  auto    attributes        = self->GetAttributes();
+  auto    itemCount         = attributes.find("item_count");
   auto    atspiRole         = self->GetRole();
   int32_t listChildrenCount = 0;
-  if(atspiRole == Role::DIALOG)
+  if(itemCount != attributes.end())
+  {
+    // "item_count" gives manual control to the application, so it has priority
+    listChildrenCount = std::atoi(itemCount->second.c_str());
+  }
+  else if(atspiRole == Role::DIALOG)
   {
     listChildrenCount = GetItemCountOfFirstDescendantContainer(self, Role::LIST, Role::LIST_ITEM, true);
   }
@@ -544,7 +553,6 @@ BridgeAccessible::ReadingMaterialType BridgeAccessible::GetReadingMaterial()
     nameFromTextInterface = textInterface->GetText(0, textInterface->GetCharacterCount());
   }
 
-  auto attributes        = self->GetAttributes();
   auto name              = self->GetName();
   auto role              = static_cast<uint32_t>(atspiRole);
   auto states            = self->GetStates();
@@ -573,6 +581,7 @@ BridgeAccessible::ReadingMaterialType BridgeAccessible::GetReadingMaterial()
     localizedRoleName,
     childCount,
     currentValue,
+    currentValueText,
     minimumIncrement,
     maximumValue,
     minimumValue,