From 5f4533cc6b93a69fdb9a5cfffb10c8601fae688b Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sun, 20 Apr 2025 21:36:50 -0700 Subject: [PATCH] Fixed layout recursion warning by getting rid of bigSurOffsetFix hack, which no longer appears to be needed. Fix #4590. --- Mac/MainWindow/Detail/DetailWebView.swift | 41 ----------------------- 1 file changed, 41 deletions(-) diff --git a/Mac/MainWindow/Detail/DetailWebView.swift b/Mac/MainWindow/Detail/DetailWebView.swift index a6e4a5c45..e235b7d7b 100644 --- a/Mac/MainWindow/Detail/DetailWebView.swift +++ b/Mac/MainWindow/Detail/DetailWebView.swift @@ -53,47 +53,6 @@ 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 (!inLiveResize) { - bigSurOffsetFix() - } - } - - private var inBigSurOffsetFix = false - - private func bigSurOffsetFix() { - /* - On macOS 11, when a user exits full screen - or exits zoomed mode by disconnecting an external display - the webview's `origin.y` is offset by a sizeable amount. - - This code adjusts the height of the window by -1pt/+1pt, - which puts the webview back in the correct place. - */ - if #available(macOS 11, *) { - guard var frame = window?.frame else { - return - } - - guard !inBigSurOffsetFix else { - return - } - - inBigSurOffsetFix = true - - defer { - inBigSurOffsetFix = false - } - - frame.size = NSSize(width: window!.frame.width, height: window!.frame.height - 1) - window!.setFrame(frame, display: false) - frame.size = NSSize(width: window!.frame.width, height: window!.frame.height + 1) - window!.setFrame(frame, display: false) - } } }