From 8de0c610eab273c190b8c27eff95073f4c0e0317 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 20 Jun 2012 17:43:49 +0530 Subject: [PATCH] ... --- resources/compiled_coffeescript.zip | Bin 39482 -> 39253 bytes src/calibre/ebooks/oeb/display/paged.coffee | 21 +++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/resources/compiled_coffeescript.zip b/resources/compiled_coffeescript.zip index 180e44166d0286232a869435d48469b670fb8acf..094c46a3729060edbfcf7b6b55308e5abaa0b0f4 100644 GIT binary patch delta 498 zcmdnBh3V=hCg}igW)=|!5Gd@u;_&j-sh1Ku3=AMFJvmTUY@?wauS9A^Nl{{aZeme- zW}c2hT6%JRPJWS&Lf+(hUggOvc}+8mQqy!4;(??ggffCq#@1X4V33lZT$-DjSE84c zpHit;TvC~nss}MHB)>qxRzcmMph6v{7}++U9E#q_=h!3!^h)vzV2aDj6>KLv%1LeB z&cBCg@;Xf=W}xKcgPLNK7YZs&o+M-y_Ui-n5hAS^P58f!fHiKzPI`(peo#?kRPn?H#qHSwZE-Q>iXQA~k4 VllRW_Vsf#V%sES&EqMkgf&ox8oX`LO delta 562 zcmcb*iD}msCg}igW)=|!5ZKUs#bNS`bN~P9Fff3y^yGL8v5kgyyaH+I$@w|?MLG(3 zK$M@7I=P)!nYFm2GADKN3SM)LoYXuM9fkPZ$#;0AO@WM})HDzuNSRu5DS!cpqhPC$ zlAm0fo0?ammz1AUsh6CQnUmrNG_QE_MIjeKkjX$bAf?gqnX%SflO>|%Cht$;pS+u2 z!51W}2{R64W@eg#h6YHnAy5<8F?uPP#RWNum6{5+wzdlDNjdq++3E^4HDDuwsz8Dz ziAg!B>XQ$qh)n({COrALARm{yK|zH&*yzai_v6@{!*`2`RXwq^B!BV& zVX4Ur1x@%%GBS(xaubWvGxOq0@(U(63Mxz%6`IayG@T7^`880r@#OzN)>;uB5##9iY_Kv!aG6X#D+2Vs zs4%0+?_}tCBVo6QBC{aGSW=0f~neOBS3(?7MXP7c+S^}BUlkH~;uzAb` GB@h6z>9U>x diff --git a/src/calibre/ebooks/oeb/display/paged.coffee b/src/calibre/ebooks/oeb/display/paged.coffee index 793b935a40..d16c7e1f44 100644 --- a/src/calibre/ebooks/oeb/display/paged.coffee +++ b/src/calibre/ebooks/oeb/display/paged.coffee @@ -73,16 +73,13 @@ class PagedDisplay this.cols_per_screen = cols_per_screen layout: () -> - # Remove the top margin from the first child of body as that gets added - # to the top margin of body. This is done here just in case - # getComputedStyle() causes a relayout. The re-layout will be much - # faster before we implement the multi-column layout. - for node in document.body.childNodes - if node.nodeType == 1 # Element node - style = window.getComputedStyle(node) - if style.display in ['block', 'table'] - node.style.setProperty('margin-top', '0px') - break + # When laying body out in columns, webkit bleeds the top margin of the + # first block element out above the columns, leading to an extra top + # margin for the page. We compensate for that here. Computing the + # boundingrect of body is very expensive with column layout, so we do + # it before the column layout is applied. + document.body.style.marginTop = '0px' + extra_margin = document.body.getBoundingClientRect().top ww = window.innerWidth @@ -110,9 +107,9 @@ class PagedDisplay bs.setProperty('-webkit-column-width', col_width+'px') bs.setProperty('-webkit-column-rule-color', fgcolor) bs.setProperty('overflow', 'visible') - bs.setProperty('height', 'auto') + bs.setProperty('height', (window.innerHeight - this.margin_top - this.margin_bottom) + 'px') bs.setProperty('width', 'auto') - bs.setProperty('margin-top', this.margin_top+'px') + bs.setProperty('margin-top', (this.margin_top - extra_margin)+'px') bs.setProperty('margin-bottom', this.margin_bottom+'px') bs.setProperty('margin-left', sm+'px') bs.setProperty('margin-right', sm+'px')