Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix browse mode in Firefox extension popups. #7809

Merged
merged 1 commit into from Dec 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 23 additions & 8 deletions source/virtualBuffers/gecko_ia2.py
Expand Up @@ -2,7 +2,7 @@
#A part of NonVisual Desktop Access (NVDA)
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Copyright (C) 2008-2017 NV Access Limited, Babbage B.V.
#Copyright (C) 2008-2017 NV Access Limited, Babbage B.V., Mozilla Corporation

from . import VirtualBuffer, VirtualBufferTextInfo, VBufStorage_findMatch_word, VBufStorage_findMatch_notEmpty
import treeInterceptorHandler
Expand Down Expand Up @@ -99,14 +99,29 @@ def _get_shouldPrepare(self):
return False
return True

def _getExpandedComboBox(self, obj):
"""If obj is an item in an expanded combo box, get the combo box.
"""
if not (obj.windowClassName.startswith('Mozilla') and obj.windowStyle & winUser.WS_POPUP):
# This is not a Mozilla popup window, so it can't be an expanded combo box.
return None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same NIT as below.

if obj.role not in (controlTypes.ROLE_LISTITEM, controlTypes.ROLE_LIST):
return None
parent = obj.parent
# Try a maximum of 2 ancestors, since we might be on the list item or the list.
for i in xrange(2):
obj = obj.parent
if not obj:
return None
if obj.role == controlTypes.ROLE_COMBOBOX:
return obj
return None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: return None is just return


def __contains__(self,obj):
#Special code to handle Mozilla combobox lists
if obj.windowClassName.startswith('Mozilla') and winUser.getWindowStyle(obj.windowHandle)&winUser.WS_POPUP:
parent=obj.parent
while parent and parent.windowHandle==obj.windowHandle:
parent=parent.parent
if parent:
obj=parent.parent
# if this is a Mozilla combo box popup, we want to work with the combo box.
combo = self._getExpandedComboBox(obj)
if combo:
obj = combo
if not (isinstance(obj,NVDAObjects.IAccessible.IAccessible) and isinstance(obj.IAccessibleObject,IAccessibleHandler.IAccessible2)) or not obj.windowClassName.startswith('Mozilla') or not winUser.isDescendantWindow(self.rootNVDAObject.windowHandle,obj.windowHandle):
return False
if self.rootNVDAObject.windowHandle==obj.windowHandle:
Expand Down