mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 13:31:29 +11:00
Fix failing assertion on start-up with Safari (#1736)
The initial media query that's used to watch for device pixel ratio changes should match. Unfortunately it doesn't with Safari and the corresponding assertion fails. This is because resolution is not a supported support property for queries. As a workaround, this patch extends the query to optionally match for the webkit specific DPR property directly. This fixes #1734
This commit is contained in:
parent
676fb947f2
commit
5a78fe33e8
|
@ -59,9 +59,9 @@ impl ScaleChangeDetectorInternal {
|
|||
// We add 0.0001 to the lower and upper bounds such that it won't fail
|
||||
// due to floating point precision limitations.
|
||||
let media_query = format!(
|
||||
"(min-resolution: {:.4}dppx) and (max-resolution: {:.4}dppx)",
|
||||
current_scale - 0.0001,
|
||||
current_scale + 0.0001,
|
||||
"(min-resolution: {min_scale:.4}dppx) and (max-resolution: {max_scale:.4}dppx),
|
||||
(-webkit-min-device-pixel-ratio: {min_scale:.4}) and (-webkit-max-device-pixel-ratio: {max_scale:.4})",
|
||||
min_scale = current_scale - 0.0001, max_scale= current_scale + 0.0001,
|
||||
);
|
||||
let mql = MediaQueryListHandle::new(&media_query, closure);
|
||||
if let Some(mql) = &mql {
|
||||
|
|
Loading…
Reference in a new issue