From 6f36d3a07747619f28228e44c33b0d54498405ef Mon Sep 17 00:00:00 2001 From: James Teh Date: Fri, 6 Dec 2019 12:01:17 +1000 Subject: [PATCH] Remove Mozilla specific setFocus implementation which waits for a focus event before returning. This was added in #8678 to mitigate focus "rubber-banding" and spurious switching to focus mode when moving fast in browse mode. However, this degrades performance. Removing this code, this no longer seems to be a problem. It's likely that changes in Firefox, NVDA or both mitigated this. The changes to Firefox to avoid extraneous tree re-creation are a likely candidate. --- source/NVDAObjects/IAccessible/mozilla.py | 28 ----------------------- 1 file changed, 28 deletions(-) diff --git a/source/NVDAObjects/IAccessible/mozilla.py b/source/NVDAObjects/IAccessible/mozilla.py index 55f899f75db..186787a61c9 100755 --- a/source/NVDAObjects/IAccessible/mozilla.py +++ b/source/NVDAObjects/IAccessible/mozilla.py @@ -17,39 +17,11 @@ import textInfos.offsets from NVDAObjects.behaviors import RowWithFakeNavigation from virtualBuffers import VirtualBuffer -import api from . import IA2TextTextInfo from . import ia2Web class Mozilla(ia2Web.Ia2Web): - def _getPhysicalFocus(self): - try: - paccParent=self.IAccessibleObject.accParent - except COMError: - paccParent=None - if not paccParent: - return - try: - paccFocus=paccParent.accFocus - except COMError: - paccFocus=None - if not paccFocus: - return - return IAccessible(IAccessibleObject=IAccessibleHandler.normalizeIAccessible(paccFocus),IAccessibleChildID=0) - - def setFocus(self): - oldFocus=self._getPhysicalFocus() - super(Mozilla,self).setFocus() - # Although all versions of Firefox block inSetFocus or in accFocus until the physical focus has moved, - # Firefox 57 and above return before they fire a focus winEvent communicating the focus change to ATs. - # Therefore, If the call to setFocus did change the physical focus, - # Wait for a focus event to be queued to NVDA before returning. - newFocus=self._getPhysicalFocus() - if newFocus and newFocus!=oldFocus: - while not eventHandler.isPendingEvents("gainFocus"): - api.processPendingEvents(processEventQueue=False) - def _get_parent(self): #Special code to support Mozilla node_child_of relation (for comboboxes) res=IAccessibleHandler.accNavigate(self.IAccessibleObject,self.IAccessibleChildID,IAccessibleHandler.NAVRELATION_NODE_CHILD_OF)