Expand workaround for macOS 11 WebView origin offset bug. Fixes #2916

Move the code that twiddles the window frame from DetailWebView.viewDidEndLiveResize() into a new bigSurOffsetFix() API so it can also be called by setFrameSize() when the frame size is changed outside of a live resize.
This commit is contained in:
Chris Campbell 2021-04-29 23:55:23 -04:00
parent 8e34187821
commit bf77d77669
No known key found for this signature in database
GPG Key ID: 77DB1B61A93AFC6C
1 changed files with 10 additions and 0 deletions

View File

@ -53,7 +53,17 @@ final class DetailWebView: WKWebView {
override func viewDidEndLiveResize() {
super.viewDidEndLiveResize()
evaluateJavaScript("document.body.style.overflow = 'visible';", completionHandler: nil)
bigSurOffsetFix()
}
override func setFrameSize(_ newSize: NSSize) {
super.setFrameSize(newSize)
if (!self.inLiveResize) {
bigSurOffsetFix()
}
}
private func bigSurOffsetFix() {
/*
On macOS 11, when a user exits full screen
or exits zoomed mode by disconnecting an external display