mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
E-book viewer: Fix clicking links going to slightly incorrect locations in some books. Fixes #1132641 (Private bug)
This commit is contained in:
parent
8add71a50c
commit
40daeaa9b4
Binary file not shown.
@ -81,6 +81,11 @@ class BookIndexing
|
|||||||
if elem == null
|
if elem == null
|
||||||
pos = [body.scrollWidth+1000, body.scrollHeight+1000]
|
pos = [body.scrollWidth+1000, body.scrollHeight+1000]
|
||||||
else
|
else
|
||||||
|
# Because of a bug in WebKit's getBoundingClientRect() in
|
||||||
|
# column mode, this position can be inaccurate,
|
||||||
|
# see https://bugs.launchpad.net/calibre/+bug/1132641 for a
|
||||||
|
# test case. The usual symptom of the inaccuracy is br.top is
|
||||||
|
# highly negative.
|
||||||
br = elem.getBoundingClientRect()
|
br = elem.getBoundingClientRect()
|
||||||
pos = viewport_to_document(br.left, br.top, elem.ownerDocument)
|
pos = viewport_to_document(br.left, br.top, elem.ownerDocument)
|
||||||
|
|
||||||
|
@ -410,7 +410,7 @@ class PagedDisplay
|
|||||||
elem.scrollIntoView()
|
elem.scrollIntoView()
|
||||||
if this.in_paged_mode
|
if this.in_paged_mode
|
||||||
# Ensure we are scrolled to the column containing elem
|
# Ensure we are scrolled to the column containing elem
|
||||||
this.scroll_to_xpos(calibre_utils.absleft(elem) + 5)
|
this.scroll_to_xpos(calibre_utils.viewport_to_document(elem.scrollLeft+this.margin_side, elem.scrollTop, elem.ownerDocument)[0])
|
||||||
|
|
||||||
snap_to_selection: () ->
|
snap_to_selection: () ->
|
||||||
# Ensure that the viewport is positioned at the start of the column
|
# Ensure that the viewport is positioned at the start of the column
|
||||||
|
@ -86,7 +86,9 @@ class CalibreUtils
|
|||||||
absleft: (elem) -> # {{{
|
absleft: (elem) -> # {{{
|
||||||
# The left edge of elem in document co-ords. Works in all
|
# The left edge of elem in document co-ords. Works in all
|
||||||
# circumstances, including column layout. Note that this will cause
|
# circumstances, including column layout. Note that this will cause
|
||||||
# a relayout if the render tree is dirty.
|
# a relayout if the render tree is dirty. Also, because of a bug in the
|
||||||
|
# version of WebKit bundled with Qt 4.8, this does not always work, see
|
||||||
|
# https://bugs.launchpad.net/bugs/1132641 for a test case.
|
||||||
r = elem.getBoundingClientRect()
|
r = elem.getBoundingClientRect()
|
||||||
return this.viewport_to_document(r.left, 0, elem.ownerDocument)[0]
|
return this.viewport_to_document(r.left, 0, elem.ownerDocument)[0]
|
||||||
# }}}
|
# }}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user