From: Artur Świgoń Date: Thu, 25 May 2023 11:01:24 +0000 (+0200) Subject: [Tizen][AT-SPI] Allow manual control of ReadingMaterial::listChildrenCount X-Git-Tag: accepted/tizen/7.0/unified/20230526.164250~1^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=4495049cc5078f0685c84ebe89cf5b8951133b5e [Tizen][AT-SPI] Allow manual control of ReadingMaterial::listChildrenCount In complex UIs, where the logical number of children (i.e. not the number of Actors) is difficult to determine, because (1) the children have differing roles, or (2) the children are not direct descendants of the parent object, the best-effort calculation done by the AT-SPI bridge (for the purpose of reading "Showing %d items") will often be wrong. This patch recognizes the "item_count" attribute as a high-priority, manual setting of the number of children for the purpose of reading "Showing %d items" with the provided value. Change-Id: I2d027ea4930d7e9f63dee9fc4bb55a14caebf7b8 --- diff --git a/dali/internal/accessibility/bridge/bridge-accessible.cpp b/dali/internal/accessibility/bridge/bridge-accessible.cpp index 0d0f9ed..8fa36d2 100644 --- a/dali/internal/accessibility/bridge/bridge-accessible.cpp +++ b/dali/internal/accessibility/bridge/bridge-accessible.cpp @@ -528,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); } @@ -546,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(atspiRole); auto states = self->GetStates();