[ATSPI] CollectionView - Show highlighed descendant
authorShinwoo Kim <cinoo.kim@samsung.com>
Fri, 12 Nov 2021 04:16:40 +0000 (13:16 +0900)
committerhuiyu <35286162+huiyueun@users.noreply.github.com>
Mon, 29 Nov 2021 08:55:55 +0000 (17:55 +0900)
The 1st generation child ContentContainer is always showing. So
it was not able to show highlighted descendant by AccessibilityScrollToChild.

The child is a descendant of CollectionView from following patch.
https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-toolkit/+/266414/

With this patch set, It is possible to show highlighted descendant.

src/Tizen.NUI.Components/Controls/RecyclerView/CollectionView.cs

index 0e89ad1..fc7e437 100755 (executable)
@@ -850,16 +850,29 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         protected override bool AccessibilityScrollToChild(View child)
         {
-            foreach (RecyclerViewItem item in ContentContainer.Children.Where((item) => item is RecyclerViewItem))
+            if (ScrollingDirection == Direction.Horizontal)
             {
-                if (child == item)
+                if (child.ScreenPosition.X + child.Size.Width <= this.ScreenPosition.X)
+                {
+                    ScrollTo((float)(child.ScreenPosition.X - ContentContainer.ScreenPosition.X), false);
+                }
+                else if (child.ScreenPosition.X >= this.ScreenPosition.X + this.Size.Width)
                 {
-                    ScrollToIndex(item.Index);
-                    return true;
+                    ScrollTo((float)(child.ScreenPosition.X + child.Size.Width - ContentContainer.ScreenPosition.X - this.Size.Width), false);
                 }
             }
-
-            return false;
+            else
+            {
+                if (child.ScreenPosition.Y + child.Size.Height <= this.ScreenPosition.Y)
+                {
+                    ScrollTo((float)(child.ScreenPosition.Y - ContentContainer.ScreenPosition.Y), false);
+                }
+                else if (child.ScreenPosition.Y >= this.ScreenPosition.Y + this.Size.Height)
+                {
+                    ScrollTo((float)(child.ScreenPosition.Y + child.Size.Height - ContentContainer.ScreenPosition.Y - this.Size.Height), false);
+                }
+            }
+            return true;
         }
 
         // Realize and Decorate the item.