Make hitTestResult work with frames correctly

This commit is contained in:
Florian Bruhin 2014-05-12 08:28:44 +02:00
parent 4eebe2dc57
commit 31a1e91866
2 changed files with 4 additions and 3 deletions

2
TODO
View File

@ -77,8 +77,6 @@ Bugs
- Hinting problems on http://wiki.gentoo.org/wiki/Lenovo_ThinkPad_T440s (top navbar, e.g. lists, etc.) - Hinting problems on http://wiki.gentoo.org/wiki/Lenovo_ThinkPad_T440s (top navbar, e.g. lists, etc.)
- clicking on text fields at https://bugreports.qt-project.org/secure/Dashboard.jspa doesn't go into insert mode. (because of iframes?)
- scroll_page doesn't care about always visible bars, so content gets hidden - scroll_page doesn't care about always visible bars, so content gets hidden
e.g. http://www.mtb-news.de/forum/t/welcher-schuh-five-ten-vs-oneal.529148/ e.g. http://www.mtb-news.de/forum/t/welcher-schuh-five-ten-vs-oneal.529148/

View File

@ -358,7 +358,10 @@ class WebView(QWebView):
# sometimes. # sometimes.
logging.debug("Clicked at {} but frame is None!".format(pos)) logging.debug("Clicked at {} but frame is None!".format(pos))
return super().mousePressEvent(e) return super().mousePressEvent(e)
pos -= frame.geometry().topLeft() # You'd think we have to subtract frame.geometry().topLeft() from the
# position, but it seems QWebFrame::hitTestContent wants a position
# relative to the QWebView, not to the frame. This makes no sense to
# me, but it works this way.
hitresult = frame.hitTestContent(pos) hitresult = frame.hitTestContent(pos)
if self._is_editable(hitresult): if self._is_editable(hitresult):
logging.debug("Clicked editable element!") logging.debug("Clicked editable element!")