Skip to content

Honor object-fit and object-position for retained images #789

Description

@wieslawsoltes

Parent epic: #235
Layout owner: #240
Paint owner: #241
Release owner: #227

Problem

Unchanged VS Code OSS 645f29cc3176500b4b5762ba887cf2a7f0ffdf2c uses object-fit in at least 20 stylesheet declarations for account/profile imagery, workbench thumbnails, extension surfaces, and session UI. WebScene main a74d7e4024c093ee755b4dd0710e11c557b49046 exposes neither object-fit nor object-position. Retained <img> paint currently stretches the decoded image to the whole element layout rectangle, distorting intrinsic aspect ratios and producing the wrong crop and alignment.

Focused implementation

  • expose, retain, cascade, reset, mutate, and serialize object-fit and object-position without enlarging every hot DOM node;
  • apply fill, contain, cover, none, and scale-down to complete raster and SVG replaced images from their intrinsic dimensions;
  • resolve one- and two-axis object-position keywords, percentages, and lengths against the difference between the content box and fitted object size;
  • clip overflow to the replaced element content box, preserve border radii and transforms, and avoid changing the element's layout box;
  • keep changes product-neutral and leave unchanged VS Code source untouched.

Quality and performance gates

Author focused native and browser-candidate contracts for intrinsic ratio, content-box/border-box edges, center/corner positioning, cover clipping, contain letterboxing, scale-down, raster/SVG parity, invalid/global values, stylesheet/inline mutation and removal, CSSOM aliases, transforms, and rounded corners. Add a 4,096-image mutation/scene benchmark that bounds recascade, layout, scene commands, publications, allocation, heap/RSS, and idle frames. Gate exact-package avatar/thumbnail regions against Chromium after implementation.

Acceptance status

  • Focused reusable implementation merged in PR Implement object-fit for retained images #790 at c8f44e44d1dfce77e643421cc801ac00799a19a6.
  • Browser/native geometry and pixel contracts passed.
  • Mutation, performance, memory, lifecycle, and idle-publication bounds passed.
  • Exact-package unchanged Code OSS regions passed.

Per the current implementation-only instruction, implementation may merge after source review and git diff --check; no unexecuted validation may be reported as evidence.

Merge record — 20 September 2026

PR #790 merged to main at c8f44e44d1dfce77e643421cc801ac00799a19a6. Source review and git diff --check passed. Native scene, Flutter pixel, WPT/browser, exact Code OSS visual/package, lifecycle/memory, and 4,096-image performance gates are authored but were not executed under the active fast-merge direction; evidence remains zero and the remaining qualification debt stays tracked by #235, #240, #241, #263, and #227.

Metadata

Metadata

Assignees

No one assigned

    Labels

    vscode-oss/plannedPlanned for the AppScene/WebScene VS Code OSS integration

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions