mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-03-03 16:46:00 +01:00
Avoid multiple calls to getComputedStyle()
This commit is contained in:
parent
b0e1506976
commit
769ca0c59f
2 changed files with 5 additions and 5 deletions
|
|
@ -164,8 +164,8 @@ def current_page_width():
|
|||
def layout(is_single_page, on_resize):
|
||||
nonlocal _in_paged_mode, col_width, col_and_gap, screen_height, gap, screen_width, is_full_screen_layout, cols_per_screen, number_of_cols
|
||||
line_height(True)
|
||||
scroll_viewport.initialize_on_layout()
|
||||
body_style = window.getComputedStyle(document.body)
|
||||
scroll_viewport.initialize_on_layout(body_style)
|
||||
first_layout = not _in_paged_mode
|
||||
cps = calc_columns_per_screen()
|
||||
if first_layout:
|
||||
|
|
|
|||
|
|
@ -23,13 +23,13 @@ def set_mode(self, mode):
|
|||
for attr in FUNCTIONS:
|
||||
self[attr] = self[prefix + attr]
|
||||
|
||||
def initialize_on_layout(self):
|
||||
self.rtl = False
|
||||
self.ltr = True
|
||||
body_style = window.getComputedStyle(document.body)
|
||||
def initialize_on_layout(self, body_style):
|
||||
if body_style.direction is "rtl":
|
||||
self.rtl = True
|
||||
self.ltr = False
|
||||
else:
|
||||
self.rtl = False
|
||||
self.ltr = True
|
||||
|
||||
def flow_x(self):
|
||||
if self.rtl:
|
||||
|
|
|
|||
Loading…
Reference in a new issue