parent
27330bd4d1
commit
0b16a36120
@ -36,7 +36,7 @@ from qutebrowser.utils import log, usertypes, utils, qtutils
|
|||||||
|
|
||||||
|
|
||||||
Group = usertypes.enum('Group', ['all', 'links', 'images', 'url', 'prevnext',
|
Group = usertypes.enum('Group', ['all', 'links', 'images', 'url', 'prevnext',
|
||||||
'focus', 'inputs'])
|
'inputs'])
|
||||||
|
|
||||||
|
|
||||||
SELECTORS = {
|
SELECTORS = {
|
||||||
@ -47,7 +47,6 @@ SELECTORS = {
|
|||||||
Group.images: 'img',
|
Group.images: 'img',
|
||||||
Group.url: '[src], [href]',
|
Group.url: '[src], [href]',
|
||||||
Group.prevnext: 'a, area, button, link, [role=button]',
|
Group.prevnext: 'a, area, button, link, [role=button]',
|
||||||
Group.focus: '*:focus',
|
|
||||||
Group.inputs: ('input[type=text], input[type=email], input[type=url], '
|
Group.inputs: ('input[type=text], input[type=email], input[type=url], '
|
||||||
'input[type=tel], input[type=number], '
|
'input[type=tel], input[type=number], '
|
||||||
'input[type=password], input[type=search], '
|
'input[type=password], input[type=search], '
|
||||||
|
@ -353,5 +353,5 @@ def focus_elem(frame):
|
|||||||
Args:
|
Args:
|
||||||
frame: The QWebFrame to search in.
|
frame: The QWebFrame to search in.
|
||||||
"""
|
"""
|
||||||
elem = frame.findFirstElement(webelem.SELECTORS[webelem.Group.focus])
|
elem = frame.findFirstElement('*:focus')
|
||||||
return WebKitElement(elem)
|
return WebKitElement(elem)
|
||||||
|
@ -325,7 +325,7 @@ class WebView(QWebView):
|
|||||||
return
|
return
|
||||||
frame = self.page().currentFrame()
|
frame = self.page().currentFrame()
|
||||||
try:
|
try:
|
||||||
elem = webkitelem.WebKitElement(frame.findFirstElement(':focus'))
|
elem = webkitelem.focus_elem(frame)
|
||||||
except webkitelem.IsNullError:
|
except webkitelem.IsNullError:
|
||||||
log.webview.debug("Focused element is null!")
|
log.webview.debug("Focused element is null!")
|
||||||
return
|
return
|
||||||
|
@ -188,7 +188,7 @@ class SelectionAndFilterTests:
|
|||||||
webelem.Group.url]),
|
webelem.Group.url]),
|
||||||
]
|
]
|
||||||
|
|
||||||
GROUPS = [e for e in webelem.Group if e != webelem.Group.focus]
|
GROUPS = list(webelem.Group)
|
||||||
|
|
||||||
COMBINATIONS = list(itertools.product(TESTS, GROUPS))
|
COMBINATIONS = list(itertools.product(TESTS, GROUPS))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user