Fix scrollbar not visible in footnote popup

This commit is contained in:
Kovid Goyal 2020-08-08 09:57:33 +05:30
parent 2d1b73b99b
commit 8a322d1a69
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 15 additions and 11 deletions

View File

@ -242,9 +242,12 @@ class PopupIframeBoss:
if not self.comm.encrypted_communications: if not self.comm.encrypted_communications:
window.setTimeout(self.content_loaded, 2) window.setTimeout(self.content_loaded, 2)
return return
# this is the loading styles used to suppress scrollbars during load
# added in unserialize_html
document.head.removeChild(document.head.firstChild)
document.body.classList.add('calibre-footnote-container') document.body.classList.add('calibre-footnote-container')
set_color_scheme_class() set_color_scheme_class()
apply_settings() apply_settings(True)
self.comm.send_message('content_loaded', height=document.documentElement.scrollHeight + 25) self.comm.send_message('content_loaded', height=document.documentElement.scrollHeight + 25)

View File

@ -56,7 +56,7 @@ def make_selection_background_opaque(selbg):
styles_id = 'calibre-color-scheme-style-overrides' styles_id = 'calibre-color-scheme-style-overrides'
def apply_colors(): def apply_colors(is_content_popup):
for elem in (document.documentElement, document.body): for elem in (document.documentElement, document.body):
elem.style.color = opts.color_scheme.foreground elem.style.color = opts.color_scheme.foreground
# set background color to transparent so that the users background # set background color to transparent so that the users background
@ -88,6 +88,7 @@ def apply_colors():
selbg = make_selection_background_opaque(selbg) selbg = make_selection_background_opaque(selbg)
text += f'\n::selection {{ background-color: {selbg}; color: {selfg} }}' text += f'\n::selection {{ background-color: {selbg}; color: {selfg} }}'
text += f'\n::selection:window-inactive {{ background-color: {selbg}; color: {selfg} }}' text += f'\n::selection:window-inactive {{ background-color: {selbg}; color: {selfg} }}'
if not is_content_popup:
# In Chrome when content overflows in RTL and vertical layouts on the left side, # In Chrome when content overflows in RTL and vertical layouts on the left side,
# it is not displayed properly when scrolling unless overflow:visible is set, # it is not displayed properly when scrolling unless overflow:visible is set,
# but this causes scrollbars to appear. # but this causes scrollbars to appear.
@ -136,7 +137,7 @@ def apply_stylesheet():
style.textContent = opts.user_stylesheet style.textContent = opts.user_stylesheet
def apply_settings(): def apply_settings(is_content_popup):
apply_font_size() apply_font_size()
apply_colors() apply_colors(is_content_popup)
apply_stylesheet() apply_stylesheet()