Move scrollbar suppression into the load pipeline and only suppress until load is completed

This commit is contained in:
Kovid Goyal 2019-10-06 22:51:54 +05:30
parent 0ccedfdcc7
commit 7e49092f17
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 6 additions and 1 deletions

View File

@ -260,6 +260,10 @@ class IframeBoss:
self.content_loaded_stage2()
def content_loaded_stage2(self):
# this is the loading styles used to suppress scrollbars during load
# added in unserialize_html
document.head.firstChild.textContent = ''
self.connect_links()
self.content_ready = True
csi = current_spine_item()

View File

@ -239,6 +239,7 @@ def unserialize_html(serialized_data, proceed, postprocess_dom):
head, body = tree[1], tree[2] # noqa: unused-local
clear(document.head, document.body)
remove_all_attributes(document.head, document.body)
document.head.appendChild(E.style(type='text/css', 'html::-webkit-scrollbar, body::-webkit-scrollbar { display: none !important }'))
# Default stylesheet
if not runtime.is_standalone_viewer:
# for the standalone viewer the default font family is set

View File

@ -45,7 +45,7 @@ def apply_colors():
else:
text = ''
ss.textContent = text + '\n\nhtml::-webkit-scrollbar, body::-webkit-scrollbar { display: none !important }'
ss.textContent = text
def apply_stylesheet():