Fix zoom handling with QtWebKit

This commit is contained in:
Florian Bruhin 2017-02-04 23:30:12 +01:00
parent 385969e05f
commit 2c46f8ecdb
3 changed files with 4 additions and 3 deletions

View File

@ -95,8 +95,7 @@ class MouseEventFilter(QObject):
self._ignore_wheel_event = True
if e.button() != Qt.NoButton:
zoom = self._tab.zoom.factor()
self._tab.elements.find_at_pos(e.pos() / zoom,
self._tab.elements.find_at_pos(e.pos(),
self._mousepress_insertmode_cb)
return False

View File

@ -442,6 +442,7 @@ class WebEngineElements(browsertab.AbstractElements):
def find_at_pos(self, pos, callback):
assert pos.x() >= 0
assert pos.y() >= 0
pos /= self._tab.zoom.factor()
js_code = javascript.assemble('webelem', 'element_at_pos',
pos.x(), pos.y())
js_cb = functools.partial(self._js_cb_single, callback)

View File

@ -35,7 +35,7 @@ import pytest
('autofocus.html', 'qute-input-autofocus', 'keypress', 'cutebrowser',
'true'),
])
@pytest.mark.parametrize('zoom', [100, 125])
@pytest.mark.parametrize('zoom', [100, 125, 250])
def test_insert_mode(file_name, elem_id, source, input_text, auto_insert, zoom,
quteproc, request):
url_path = 'data/insert_mode_settings/html/{}'.format(file_name)
@ -88,6 +88,7 @@ def test_auto_leave_insert_mode(quteproc):
quteproc.open_path(url_path)
quteproc.set_setting('input', 'auto-leave-insert-mode', 'true')
quteproc.send_cmd(':zoom 100')
quteproc.press_keys('abcd')