Fix squashed rendering on iOS (safe-area surface size mismatch) - #735
Merged
Merged
Conversation
…d use physical safe-area insets
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On iOS the rendered content appeared vertically squashed. The root cause was a size mismatch between the document viewport and the render surface:
SurfaceResizedalready sets the document viewport tosurface_size - safe_area_insets(andwith_viewportsizes the renderer atviewport + insets), but the initialView::initviewport andresume/complete_resumeused inconsistent sizes. The wgpu surface ended up configured at the inset-adjusted height while covering the full window, so Vello's output was stretched/squashed to fit.Fix (all in
blitz-shell/src/window.rs):init: create the initialViewportatsurface_size - safe_area_insetsinstead of the full surface size, matching whatSurfaceResizedlater computes.resume/complete_resume: size the render surface atviewport + insets(the full window), matchingwith_viewport.complete_resume/redraw: pass physical insets topaint_sceneinstead ofinsets.to_logical(scale)—initial_x/initial_yare consumed as physical pixels (see the unit note indebug_overlay.rs), so logical values placed content under the notch on 3x displays.Also in
blitz-paint/src/render.rs: the background rect usedinitial_x * scale, double-scaling the already-physical offset; now usesinitial_x/initial_ydirectly, consistent with the element transform path.No behavior change on platforms with zero safe-area insets (including macOS, where insets are hardcoded to zero).
Verified on an iPhone 17 simulator (3x scale, insets top=186/bottom=102 physical):
Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/4cdd57b070834fc8af874a8aed768c65
Requested by: @nicoburns
WPT results
No changes in test results compared to
main.Generated by the WPT workflow.