Rename rect_on_screen to rect_on_view
This commit is contained in:
parent
50f31ca7cb
commit
419caf7116
@ -247,7 +247,7 @@ class HintManager(QObject):
|
|||||||
# FIXME Instead of clicking the center, we could have nicer heuristics.
|
# FIXME Instead of clicking the center, we could have nicer heuristics.
|
||||||
# e.g. parse (-webkit-)border-radius correctly and click text fields at
|
# e.g. parse (-webkit-)border-radius correctly and click text fields at
|
||||||
# the bottom right, and everything else on the top left or so.
|
# the bottom right, and everything else on the top left or so.
|
||||||
pos = webelem.rect_on_screen(elem).center()
|
pos = webelem.rect_on_view(elem).center()
|
||||||
logging.debug("Clicking on \"{}\" at {}/{}".format(
|
logging.debug("Clicking on \"{}\" at {}/{}".format(
|
||||||
elem.toPlainText(), pos.x(), pos.y()))
|
elem.toPlainText(), pos.x(), pos.y()))
|
||||||
events = [
|
events = [
|
||||||
|
@ -74,7 +74,7 @@ def is_visible(elem, mainframe):
|
|||||||
# Most likely an invisible link
|
# Most likely an invisible link
|
||||||
return False
|
return False
|
||||||
# First check if the element is visible on screen
|
# First check if the element is visible on screen
|
||||||
elem_rect = rect_on_screen(elem)
|
elem_rect = rect_on_view(elem)
|
||||||
visible_on_screen = mainframe.geometry().intersects(elem_rect)
|
visible_on_screen = mainframe.geometry().intersects(elem_rect)
|
||||||
# Then check if it's visible in its frame if it's not in the main frame.
|
# Then check if it's visible in its frame if it's not in the main frame.
|
||||||
elem_frame = elem.webFrame()
|
elem_frame = elem.webFrame()
|
||||||
@ -88,8 +88,8 @@ def is_visible(elem, mainframe):
|
|||||||
return all([visible_on_screen, visible_in_frame])
|
return all([visible_on_screen, visible_in_frame])
|
||||||
|
|
||||||
|
|
||||||
def rect_on_screen(elem):
|
def rect_on_view(elem):
|
||||||
"""Get the geometry of the element relative to the screen."""
|
"""Get the geometry of the element relative to the webview."""
|
||||||
frame = elem.webFrame()
|
frame = elem.webFrame()
|
||||||
rect = elem.geometry()
|
rect = elem.geometry()
|
||||||
while frame is not None:
|
while frame is not None:
|
||||||
|
Loading…
Reference in New Issue
Block a user