[orca/gnome-3-34] Simplify pathComparison()



commit 8472d6e096fff5fad4494b6fc6811963232b94ef
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Sep 26 18:17:50 2019 +0200

    Simplify pathComparison()

 src/orca/script_utilities.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 1432ffbe3..a046a4a16 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2237,24 +2237,24 @@ class Utilities:
         return abs(center1 - center2) <= delta
 
     @staticmethod
-    def pathComparison(path1, path2, treatDescendantAsSame=False):
+    def pathComparison(path1, path2):
         """Compares the two paths and returns -1, 0, or 1 to indicate if path1
         is before, the same, or after path2."""
 
         if path1 == path2:
             return 0
 
+        size = max(len(path1), len(path2))
+        path1 = (path1 + [-1] * size)[:size]
+        path2 = (path2 + [-1] * size)[:size]
+
         for x in range(min(len(path1), len(path2))):
             if path1[x] < path2[x]:
                 return -1
             if path1[x] > path2[x]:
                 return 1
 
-        if treatDescendantAsSame:
-            return 0
-
-        rv = len(path1) - len(path2)
-        return min(max(rv, -1), 1)
+        return 0
 
     @staticmethod
     def sizeComparison(obj1, obj2):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]