Use the DOM Y position to restore the scroll offset. This mostly fixes Issue #1494.

This commit is contained in:
Maurice Parker 2020-01-19 11:48:26 -07:00
parent 110c7ae2e8
commit 88f565e03f
1 changed files with 5 additions and 3 deletions

View File

@ -180,9 +180,9 @@ class WebViewController: UIViewController {
}
func fullReload() {
if let offset = webView?.scrollView.contentOffset.y {
restoreOffset = Int(offset)
webView?.reload()
webView?.evaluateJavaScript("window.scrollY") { (scrollY, _) in
self.restoreOffset = scrollY as! Int
self.reloadHTML()
}
}
@ -436,7 +436,9 @@ private extension WebViewController {
// play on the iPad where we aren't constantly pushing and popping this controller.
if (renderingTracker > 10) {
reloadHTML()
return
}
renderingTracker += 1
let style = ArticleStylesManager.shared.currentStyle