pub fn logical_insets(physical: [f64; 8], scale: f64) -> WindowInsetsExpand description
Build a logical (density-independent) WindowInsets from the platform’s
raw physical-px per-edge inset values and an already-sanitize_scaled
scale factor.
physical packs the two per-edge sets a shell reads from the platform, in
device px, in this fixed order:
[0] view_padding.left [4] view_insets.left
[1] view_padding.top [5] view_insets.top
[2] view_padding.right [6] view_insets.right
[3] view_padding.bottom [7] view_insets.bottomwhere view_padding is the system-UI occlusion (status/navigation bars,
cutout) and view_insets the fully-obscured area (the IME) — see
WindowInsets. Each edge value is sanitized (non-finite or negative → 0.0)
before being divided by scale to convert device px to logical px,
mirroring logical_size’s HiDPI math and sanitize_scale’s defensive
posture. A platform-supplied inset must never propagate non-finite or negative
into the layout/paint passes. The framework receives insets in the same
logical space it lays out in (the logical-coordinate contract — the
same discipline pointer events follow).
scale must already have passed through sanitize_scale (finite,
strictly positive); a shell’s per-frame driver sanitizes the platform
density exactly once and reuses the identical result here and for
logical_size so the two never disagree on scale — this function trusts
that contract exactly as logical_size does.