hints: ignore too small rectangles returned by getClientRects()
Apparently we can have a '1px x 1px' rectangle at some zoom levels and '0px x 0px' at others. We can't reliably click these, so let's ignore them.
This commit is contained in:
parent
891a31a0ca
commit
d630f966e7
@ -424,12 +424,12 @@ class HintManager(QObject):
|
|||||||
"""Return the element's first client rectangle with positive size.
|
"""Return the element's first client rectangle with positive size.
|
||||||
|
|
||||||
Uses the getClientRects() JavaScript method to obtain the collection of
|
Uses the getClientRects() JavaScript method to obtain the collection of
|
||||||
rectangles containing the element and returns the first with positive
|
rectangles containing the element and returns the first rectangle which
|
||||||
dimensions. Falls back to elem.rect_on_view() in case all rectangles
|
is large enough (larger than 1px times 1px). If all rectangles returned
|
||||||
returned by getClientRects() have zero dimensions.
|
by getClientRects() are too small, falls back to elem.rect_on_view().
|
||||||
|
|
||||||
Skipping of rectangles with zero dimensions is due to <a> elements
|
Skipping of small rectangles is due to <a> elements containing other
|
||||||
containing other elements with "display:block" style, see
|
elements with "display:block" style, see
|
||||||
https://github.com/The-Compiler/qutebrowser/issues/1298
|
https://github.com/The-Compiler/qutebrowser/issues/1298
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -442,7 +442,7 @@ class HintManager(QObject):
|
|||||||
rect = rects[str(i)]
|
rect = rects[str(i)]
|
||||||
width = rect.get("width", 0)
|
width = rect.get("width", 0)
|
||||||
height = rect.get("height", 0)
|
height = rect.get("height", 0)
|
||||||
if width > 0 and height > 0:
|
if width > 1 and height > 1:
|
||||||
# fix coordinates according to zoom level
|
# fix coordinates according to zoom level
|
||||||
zoom = elem.webFrame().zoomFactor()
|
zoom = elem.webFrame().zoomFactor()
|
||||||
if not config.get('ui', 'zoom-text-only'):
|
if not config.get('ui', 'zoom-text-only'):
|
||||||
|
Loading…
Reference in New Issue
Block a user