Repository navigation
Fix layout previews stretching to fill the entire device canvas - #4
Merged
Merged
Conversation
EngineAdapter.inflateOrNull now inflates against a throwaway FrameLayout parent with attachToRoot=false instead of a null parent, so the root element's own layout_width/layout_height/margins/gravity generate real LayoutParams (Studio's content-frame equivalent) instead of being silently discarded and defaulted to MATCH_PARENT x MATCH_PARENT. Adds engineTest pixel-probe coverage (RootLayoutParamsTest) over four new framework-gallery fixtures for wrap_content sizing, root margins, the match_parent regression guard, and layout_gravity positioning (LAY-08 AC1-AC3).
T89's engine-level verification found the original "stays transparent" assumption factually wrong: decor=false only maps to SessionParams.setForceNoDecor(), which suppresses system chrome, not window-background painting. Bridge paints the resolved theme's windowBackground/colorBackground onto the content root regardless (confirmed: a dark framework theme painted background_material_dark exactly, a light one background_material_light exactly). Revises AC4, AC7, and the uncovered-canvas assumption row to the corrected outcome (theme background shows through, matching what the spec's own root-cause section already documents Android Studio doing) per user decision superseding the original spec-approval assumption.
Extends RootLayoutParamsTest with engineTests over five new framework-gallery fixtures: a missing root height and a missing root width (both must render ok and paint nothing, not crash — the pinned engine's native 0px axis handling), a <merge> root (must stay full-bleed, unaffected by the LAY-08 fix), a data-binding <layout> root (the unwrapped inner root's own params must be honored), and a tools:layout_height override (must govern over the real wrap_content value). The tools:-override edge case needed one production change: ToolsAttributes.CORE_ATTRS did not include layout_height, so tools:layout_height was previously dropped rather than promoted — added it so the already-approved LAY-08 edge case text is actually true.
Adds RootParamsConstraintTest, rendering the two shapes from the original user report through the full routing path with the bundled androidx/ConstraintLayout closure (2.2.1): - shape (a): a match_parent x wrap_content card with margins and padding wraps to its content, with the margins showing as insets. - shape (b): a child constrained top_toBottomOf a sibling AND bottom_toBottomOf="parent" sits directly below the sibling inside the wrapped bounds, instead of floating at the device's vertical center (the exact pre-fix defect signature from the report).
40 of 42 configs are byte-identical after the root-params fix, verified against every corpus fixture's XML: every layout-kind root is match_parent x match_parent (root-param honoring is a no-op for match_parent), and the 6 drawable-kind configs never go through the affected inflation path. Only material/gallery (default, night) changed (0.031% diff): a nested MaterialToolbar's android:title="Title" text, previously invisible, now renders. Isolated via a throwaway worktree at the pre-fix commit with only EngineAdapter's inflateOrNull change reapplied — confirmed deterministic and caused exactly by that change, not by root geometry (this fixture's root was already match_parent x match_parent, unchanged in size). The mechanism is a side effect one level down: Paparazzi's addView() takes a different internal code path once the root carries pre-set LayoutParams instead of null ones, which also affects how the nested Toolbar resolves its internal title TextView. Since a Toolbar with a title attribute is genuinely supposed to show that text, the new render is more correct than the old golden, which was quietly encoding a second, unrelated rendering defect the same way the root-params bug was.
Documents the DF-4 root-params fix in user-facing language: layout previews now respect the root element's own layout_width/height, margins, and layout_gravity instead of always stretching over the entire device canvas.
Records AD-022 in STATE.md Decisions (the inflation-seam fix, the bytecode-verified reasoning chain, the two mid-execution corrections found during T89/T90, and the corpus golden trade-off); replaces the Handoff's DF-4 entry with the completed record (commits, gate evidence); flips LAY-08's traceability row to implemented-pending- Verifier in spec.md; marks all T89-T94 task statuses complete in tasks.md. Full gate green at close: host build+test+engineTest (58 testcases, 0 failures), corpus (42/42), extension sanity (206/206 unit).
Author != verifier: a fresh sub-agent re-derived LAY-08's 7 ACs + 3 edge cases from spec.md against file:line assertions (10/10 matched, 0 gaps), re-ran every gate from clean (engineTest 58/23 classes, corpus 42/42, extension 206/206), and ran a 3-mutation discrimination sensor in scratch state (null-parent revert, ViewGroup-vs-FrameLayout parent-type swap, CORE_ATTRS regression) — 3/3 killed. Appends the dated verification section to validation.md, flips LAY-08's spec.md traceability to Verified, and updates STATE.md's Handoff. Also fixes the one non-blocking finding: a fixture comment in rootparams_wrap.xml still described the pre-correction "stays transparent" AC4 assumption instead of the corrected theme-background outcome its own test asserts.
Owner
Author
|
/run ci |
Contributor
|
/run ci accepted from @ionixjunior — running the full gate on this PR's merge result: https://github.com/ionixjunior/inflate/actions/runs/30445034193 |
VS Code 1.131.0 (2026-07-29) is the first stable release without the compatibility symlink for the old "Electron" macOS executable name (microsoft/vscode#326502, the symlink from the Feb 2026 rename in microsoft/vscode#291948 was removed 2026-07-20). @vscode/test-electron 2.5.2 still launches the old hardcoded path, so every integration-test run against 1.131.0+ fails with "spawn .../MacOS/Electron ENOENT" before any test runs (microsoft/vscode-test#348, #349). 3.1.0 fixes this by resolving the executable via the bundle's CFBundleExecutable, falling back to "Electron" for older downloads (microsoft/vscode-test#350). Verified locally: 25/25 integration tests pass against a fresh VS Code 1.131.0 download.
Owner
Author
|
/run ci |
Contributor
|
/run ci accepted from @ionixjunior — running the full gate on this PR's merge result: https://github.com/ionixjunior/inflate/actions/runs/30447316464 |
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.
Layout previews were ignoring the root element's own
layout_width,layout_height, margins, and gravity. Every preview stretched to fill the whole device canvas instead of rendering at its actual size, exactly like Android Studio does. Awrap_contentcard would balloon to full-screen, and children anchored to the bottom would end up floating in the middle of the screen instead of sitting where they belonged.The cause: the render engine inflated the previewed layout without a parent view, so the root's own size/margin/gravity attributes were silently discarded, and it defaulted to filling the entire screen.
Fix: inflate the layout against a throwaway parent view instead, so the root's own layout attributes are read and applied correctly.
Also includes: updated test fixtures and pixel-level regression tests, refreshed reference images, and a changelog entry for the upcoming patch release.
Also includes: a bump of @vscode/test-electron (2.5.2 → 3.1.0) to fix the macOS integration-test CI job. VS Code 1.131.0 (released today) is the first release without a compatibility symlink for the old Electron executable name, which broke @vscode/test-electron 2.5.2's hardcoded launch path (microsoft/vscode-test#348 (microsoft/vscode-test#348 (microsoft/vscode-test#349)), every integration run failed with spawn .../MacOS/Electron ENOENT before any test was executed. 3.1.0 fixes the resolver.