[orca] Eliminate some redundant work we were doing handling text selection
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Eliminate some redundant work we were doing handling text selection
- Date: Fri, 13 Mar 2020 19:09:39 +0000 (UTC)
commit f3a3408388f69493250a8df0bba5a2b1eec7b9c3
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Fri Mar 13 15:08:37 2020 -0400
Eliminate some redundant work we were doing handling text selection
src/orca/scripts/web/script_utilities.py | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 584ed952f..e9e15671f 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1829,13 +1829,16 @@ class Utilities(script_utilities.Utilities):
start, end = self._getSelectionAnchorAndFocus(obj)
self._script.pointOfReference['selectionAnchorAndFocus'] = (start, end)
- oldSubtree = self._getSubtree(oldStart, oldEnd)
- newSubtree = self._getSubtree(start, end)
-
def _cmp(obj1, obj2):
return self.pathComparison(pyatspi.getPath(obj1), pyatspi.getPath(obj2))
- descendants = sorted(set(oldSubtree).union(newSubtree), key=functools.cmp_to_key(_cmp))
+ oldSubtree = self._getSubtree(oldStart, oldEnd)
+ if start == oldStart and end == oldEnd:
+ descendants = oldSubtree
+ else:
+ newSubtree = self._getSubtree(start, end)
+ descendants = sorted(set(oldSubtree).union(newSubtree), key=functools.cmp_to_key(_cmp))
+
for descendant in descendants:
if descendant not in (oldStart, oldEnd, start, end) \
and pyatspi.findAncestor(descendant, lambda x: x in descendants):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]