Merge pull request #2842 from collindonnell/2833-fullScreenWebViewOverlap

Fix #2833: Titlebar is overlapped by toolbar in fullscreen
This commit is contained in:
Maurice Parker 2021-02-27 19:01:01 -06:00 committed by GitHub
commit a4474f5c49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 7 deletions

View File

@ -98,14 +98,25 @@ final class DetailWebViewController: NSViewController, WKUIDelegate {
box.addSubview(webView)
let constraints = [
webView.topAnchor.constraint(equalTo: view.topAnchor),
webView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
webView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
webView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
]
// Use the safe area layout guides if they are available.
if #available(OSX 11.0, *) {
let constraints = [
webView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
webView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor),
webView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor),
webView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor),
]
NSLayoutConstraint.activate(constraints)
} else {
let constraints = [
webView.topAnchor.constraint(equalTo: view.topAnchor),
webView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
webView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
webView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
]
NSLayoutConstraint.activate(constraints)
}
NSLayoutConstraint.activate(constraints)
// Hide the web view until the first reload (navigation) is complete (plus some delay) to avoid the awful white flash that happens on the initial display in dark mode.
// See bug #901.