Fix hints when zoomed with QtWebEngine

We mutated rect (coming from self._js_dict), which means we used the
already adjusted values the second time we called rect_on_view.

Fixes #1863.
This commit is contained in:
Florian Bruhin 2016-09-21 20:09:31 +02:00
parent a637de4bc5
commit 57d896e989
2 changed files with 5 additions and 9 deletions

View File

@ -140,16 +140,15 @@ class WebEngineElement(webelem.AbstractWebElement):
# height = rect.get("height", 0) # height = rect.get("height", 0)
width = rect['width'] width = rect['width']
height = rect['height'] height = rect['height']
left = rect['left']
top = rect['top']
if width > 1 and height > 1: if width > 1 and height > 1:
# Fix coordinates according to zoom level # Fix coordinates according to zoom level
# We're not checking for zoom-text-only here as that doesn't # We're not checking for zoom-text-only here as that doesn't
# exist for QtWebEngine. # exist for QtWebEngine.
zoom = self._tab.zoom.factor() zoom = self._tab.zoom.factor()
rect["left"] *= zoom rect = QRect(left * zoom, top * zoom,
rect["top"] *= zoom width * zoom, height * zoom)
width *= zoom
height *= zoom
rect = QRect(rect["left"], rect["top"], width, height)
# FIXME:qtwebengine # FIXME:qtwebengine
# frame = self._elem.webFrame() # frame = self._elem.webFrame()
# while frame is not None: # while frame is not None:

View File

@ -1,9 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!-- target: hello.txt -->
target: hello.txt
qtwebengine_todo: Doesn't seem to work?
-->
<html> <html>
<head> <head>