Skip to content

fix: render native image alt fallback - #428

Closed
tiensonqin wants to merge 6 commits into
native-parity-0.1-backportsfrom
devin/1795785752-image-fallback
Closed

tiensonqin wants to merge 6 commits into
native-parity-0.1-backportsfrom
devin/1795785752-image-fallback

Conversation

@tiensonqin

@tiensonqin tiensonqin commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Render measurable alt text for native typed images when no decoded bitmap is available. Browser images expose alt text as inline fallback content while loading or after decode failure; the native backend previously measured those images as zero-sized and painted nothing, so broken images collapsed invisibly.

lui_layout now falls back to the host text measurer for non-empty alt text when image_measure has no bitmap, and lui_paint emits the corresponding text operations when image_of has no bitmap. Focused layout and paint tests cover the fallback contract.

Validation:

  • opam exec --switch=5.5.0 -- dune build platform/native/lui_layout platform/native/lui_paint
  • opam exec --switch=5.5.0 -- dune exec platform/native/lui_layout/test/lui_layout_test.exe (81 tests)
  • opam exec --switch=5.5.0 -- dune exec platform/native/lui_paint/test/lui_paint_test.exe (82 tests)

Link to Devin session: https://app.devin.ai/sessions/c5d7e54b078e47e28153404536bb3def
Open in Devin Desktop: https://app.devin.ai/desktop/session/c5d7e54b078e47e28153404536bb3def?variant=devin
Requested by: @tiensonqin


🟢 Devin fixed all 5 findings · Follow Devin's work

Devin Review

Measure and paint image alt text when no decoded bitmap is available, matching browser fallback behavior for broken or pending typed images.
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

Classify alt text changes as layout-affecting so a mounted image without a bitmap remeasures its inline fallback instead of retaining stale bounds.
Clip image alt fallback text to the image box so long labels cannot overlap neighboring content.
Record the native typed-image fallback sizing and clipping behavior in the migration guide.
Assert that fallback text operations are emitted inside the image-bounds clip rather than merely counting clip operations.
Track clip depth and count in the fallback paint test so unmatched clips cannot satisfy the assertion.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 5 findings. Devin automatically fixed all 5 findings.

Fixed by Devin (5)
  • Clip test misses an unmatched push — The test now tracks numeric clip depth and requires exactly one balanced image-bounds clip containing the marker text operation.
  • Undocumented image sizing default — The migration guide now documents the native typed-image alt fallback sizing/clipping behavior and migration impact.
  • Image fallback clipping lacks coverage — Strengthened the paint test to emit a marker text operation and assert both its position inside the clip and the exact image clip bounds.
  • Stale image bounds after alt updates — Alt changes now invalidate layout as well as paint/semantics, so mounted bitmap-less images remeasure instead of retaining stale bounds.
  • Alt text overlaps neighboring content — Alt fallback text is now painted inside a clip matching the image box, preventing overlap into neighboring content.

View findings in Devin Review · Follow Devin's work

Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant