Fix top toolbar getting huge when switching modes

The issue was caused by the min-height hack to align the background images. A call to web.adjustHeightToFit would set the toolbar to the same height as the main webview, as the function makes use of document.offsetHeight.
This commit is contained in:
Matthias Metelka 2023-01-15 17:58:35 +01:00
parent 9449c9bcb2
commit 7327f77dec

View file

@ -153,7 +153,6 @@ class TopWebView(ToolbarWebView):
f"""document.body.style.setProperty("background-position-y", "-{self.web_height}px"); """
)
self.mw.web.evalWithCallback(
"""window.getComputedStyle(document.body).background; """,
set_background,
@ -163,7 +162,11 @@ class TopWebView(ToolbarWebView):
self.eval(
f"""document.body.style.setProperty("min-height", "{self.mw.web.height()}px"); """
)
def adjustHeightToFit(self) -> None:
self.eval("""document.body.style.setProperty("min-height", "0px"); """)
self.evalWithCallback("document.documentElement.offsetHeight", self._onHeight)
def resizeEvent(self, event: QResizeEvent) -> None:
super().resizeEvent(event)