Revert "Return all visual elements needed (#8100) fixes #7027" (#8453)
authorShane Neuville <shneuvil@microsoft.com>
Mon, 11 Nov 2019 14:42:46 +0000 (07:42 -0700)
committerRui Marinho <me@ruimarinho.net>
Mon, 11 Nov 2019 14:42:46 +0000 (14:42 +0000)
This reverts commit da769d8c8d4c87db9368d7d8952e8ab0db318a69.

Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue7027.cs [deleted file]
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
Xamarin.Forms.Core/TabIndexExtensions.cs
Xamarin.Forms.Core/TableView.cs

diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue7027.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue7027.cs
deleted file mode 100644 (file)
index 1f5a709..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-using Xamarin.Forms.CustomAttributes;
-using Xamarin.Forms.Internals;
-
-//#if UITEST
-//using Xamarin.Forms.Core.UITests;
-//using Xamarin.UITest;
-//using NUnit.Framework;
-//#endif
-
-namespace Xamarin.Forms.Controls.Issues
-{
-//#if UITEST
-//     [Category(UITestCategories.TableView)]
-//#endif
-       [Preserve(AllMembers = true)]
-       [Issue(IssueTracker.Github, 7027, "[Bug] Tabbing through entries crashes when inside tableview",
-               PlatformAffected.iOS)]
-       public class Issue7027 : TestContentPage
-       {
-               const string Entry1 = "Entry1";
-               const string Entry2 = "Entry2";
-               const string Entry3 = "Entry3";
-               const string Entry4 = "Entry4";
-
-               public Issue7027()
-               {
-                       Title = "Issue 7027";
-               }
-
-               protected override void Init()
-               {
-                       TableView tableView = new TableView();
-
-                       var section1 = new TableSection("Section One")
-                       {
-                               new ViewCell { View = new Entry { Placeholder = "Entry 1", AutomationId = Entry1 } },
-                               new ViewCell { View = new Entry { Placeholder = "Entry 2", AutomationId = Entry2 } }
-                       };
-
-                       var section2Stack = new StackLayout() { Orientation = StackOrientation.Horizontal };
-                       section2Stack.Children.Add(new Entry { Placeholder = "Entry 3", AutomationId = Entry3 });
-                       section2Stack.Children.Add(new Entry { Placeholder = "Entry 4", AutomationId = Entry4 });
-
-                       var section2 = new TableSection("Section Two")
-                       {
-                               new ViewCell { View = section2Stack }
-                       };
-
-                       var section3 = new TableSection("Section Three")
-                       {
-                               new ViewCell { View = new Entry { Placeholder = "Entry 5" } },
-                               new ViewCell { View = new Entry { Placeholder = "Entry 6" } }
-                       };
-
-                       tableView.Root.Add(section1);
-                       tableView.Root.Add(section2);
-                       tableView.Root.Add(section3);
-
-                       var layout = new StackLayout { Children = { tableView } };
-
-                       Content = layout;
-               }
-
-//#if UITEST
-//             [Test]
-//             public void TabInTableViewWillNotCrash()
-//             {
-//                     RunningApp.WaitForElement(Entry1);
-//                     RunningApp.Tap(Entry1);
-//                     RunningApp.EnterText("First entry");
-//                     RunningApp.DismissKeyboard();
-//                     RunningApp.PressEnter();
-//             }
-//#endif
-       }
-}
index 7f6fabf..b7c031c 100644 (file)
       <DependentUpon>Issue7886.xaml</DependentUpon>
     </Compile>
     <Compile Include="$(MSBuildThisFileDirectory)Issue7898.cs" />
-    <Compile Include="$(MSBuildThisFileDirectory)Issue7027.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Issue8198.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Issue7249.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Issue8200.cs" />
index 9cdaada..1bd0c0c 100644 (file)
@@ -17,7 +17,6 @@ namespace Xamarin.Forms
                        countChildrensWithTabStopWithoutThis = 0;
 
                        Element parentPage = (element as Element)?.Parent;
-
                        while (parentPage != null && !(parentPage is Page))
                                parentPage = parentPage.Parent;
 
@@ -33,18 +32,7 @@ namespace Xamarin.Forms
                        foreach (var descendant in descendantsOnPage)
                        {
                                if (descendant is ITabStopElement visualElement && visualElement.IsTabStop)
-                               {
-                                       if (descendant is TableView tableView)
-                                       {
-                                               foreach (var child in tableView.AllChildren)
-                                               {
-                                                       if (child is ITabStopElement childElement && childElement.IsTabStop)
-                                                               childrensWithTabStop.Add(childElement);
-                                               }
-                                       }
-
                                        childrensWithTabStop.Add(visualElement);
-                               }
                        }
 
                        if (checkContainsElement && !childrensWithTabStop.Contains(element))
index 216178a..12a5785 100644 (file)
@@ -4,8 +4,6 @@ using System.ComponentModel;
 using System.Linq;
 using Xamarin.Forms.Platform;
 using Xamarin.Forms.Internals;
-using System.Collections.ObjectModel;
-using System.Collections.Generic;
 
 namespace Xamarin.Forms
 {
@@ -25,9 +23,6 @@ namespace Xamarin.Forms
 
                TableModel _model;
 
-               ReadOnlyCollection<Element> _logicalChildrenReadOnly;
-               internal override ReadOnlyCollection<Element> LogicalChildrenInternal => _logicalChildrenReadOnly ?? (_logicalChildrenReadOnly = new ReadOnlyCollection<Element>(GetInternalChildren()));
-
                public TableView() : this(null)
                {
                }
@@ -113,9 +108,6 @@ namespace Xamarin.Forms
 
                protected virtual void OnModelChanged()
                {
-                       if(_logicalChildrenReadOnly != null)
-                               _logicalChildrenReadOnly = null;
-
                        foreach (Cell cell in Root.SelectMany(r => r))
                                cell.Parent = this;
 
@@ -159,17 +151,6 @@ namespace Xamarin.Forms
                                OnModelChanged();
                }
 
-               IList<Element> GetInternalChildren()
-               {
-                       List<Element> elements = new List<Element>();
-                       foreach(var item in Root.SelectMany(r => r).Cast<Element>().ToList())
-                       {
-                               elements.AddRange(item.VisibleDescendants());
-                       }
-
-                       return elements;
-               }
-
                internal class TableSectionModel : TableModel
                {
                        static readonly BindableProperty PathProperty = BindableProperty.Create("Path", typeof(Tuple<int, int>), typeof(Cell), null);