diff --git a/resources/compiled_coffeescript.zip b/resources/compiled_coffeescript.zip index c9ed508913..726167b97c 100644 Binary files a/resources/compiled_coffeescript.zip and b/resources/compiled_coffeescript.zip differ diff --git a/src/calibre/ebooks/oeb/display/indexing.coffee b/src/calibre/ebooks/oeb/display/indexing.coffee index cd4a5a83e5..efe42199e9 100644 --- a/src/calibre/ebooks/oeb/display/indexing.coffee +++ b/src/calibre/ebooks/oeb/display/indexing.coffee @@ -81,6 +81,11 @@ class BookIndexing if elem == null pos = [body.scrollWidth+1000, body.scrollHeight+1000] 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() pos = viewport_to_document(br.left, br.top, elem.ownerDocument) diff --git a/src/calibre/ebooks/oeb/display/paged.coffee b/src/calibre/ebooks/oeb/display/paged.coffee index 2f698966dd..80aa9b9d7f 100644 --- a/src/calibre/ebooks/oeb/display/paged.coffee +++ b/src/calibre/ebooks/oeb/display/paged.coffee @@ -410,7 +410,7 @@ class PagedDisplay elem.scrollIntoView() if this.in_paged_mode # 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: () -> # Ensure that the viewport is positioned at the start of the column diff --git a/src/calibre/ebooks/oeb/display/utils.coffee b/src/calibre/ebooks/oeb/display/utils.coffee index cc98a06d04..b90fbc55b6 100644 --- a/src/calibre/ebooks/oeb/display/utils.coffee +++ b/src/calibre/ebooks/oeb/display/utils.coffee @@ -86,7 +86,9 @@ class CalibreUtils absleft: (elem) -> # {{{ # The left edge of elem in document co-ords. Works in all # 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() return this.viewport_to_document(r.left, 0, elem.ownerDocument)[0] # }}}