E-book viewer: Fix rendering of pages for right-to-left text in paged mode is reversed. Fixes #1132626 (Ebook Viewer - Reversed paging in 'page mode' for RTL epubs)

This commit is contained in:
Kovid Goyal 2013-02-25 17:47:26 +05:30
parent 6b074ffae6
commit 2a419b2a2f
2 changed files with 8 additions and 0 deletions

Binary file not shown.

View File

@ -75,6 +75,13 @@ class PagedDisplay
this.margin_side = margin_side this.margin_side = margin_side
this.margin_bottom = margin_bottom this.margin_bottom = margin_bottom
handle_rtl_body: (body_style) ->
if body_style.direction == "rtl"
for node in document.body.childNodes
if node.nodeType == node.ELEMENT_NODE and window.getComputedStyle(node).direction == "rtl"
node.style.setProperty("direction", "rtl")
document.body.style.direction = "ltr"
layout: (is_single_page=false) -> layout: (is_single_page=false) ->
# start_time = new Date().getTime() # start_time = new Date().getTime()
body_style = window.getComputedStyle(document.body) body_style = window.getComputedStyle(document.body)
@ -84,6 +91,7 @@ class PagedDisplay
# Check if the current document is a full screen layout like # Check if the current document is a full screen layout like
# cover, if so we treat it specially. # cover, if so we treat it specially.
single_screen = (document.body.scrollHeight < window.innerHeight + 75) single_screen = (document.body.scrollHeight < window.innerHeight + 75)
this.handle_rtl_body(body_style)
first_layout = true first_layout = true
ww = window.innerWidth ww = window.innerWidth