fix(core): a logo image no longer renders stretched to the frame bottom (#7179)

* fix(core): a logo image no longer renders stretched to the frame bottom

* style(core): name the image layout exception instead of commenting it
This commit is contained in:
Miguel Ángel
2026-11-04 19:11:32 +00:00
committed by GitHub
parent d4e4b07e3c
commit 3d78ac0fa6
2 changed files with 20 additions and 2 deletions
+17
View File
@@ -5755,6 +5755,23 @@ describe("initSandboxRuntimeModular", () => {
expect(card.style.height).toBe("100%");
});
it("leaves a still-loading image at its own size instead of filling the frame", () => {
const root = makeRoot();
const logo = document.createElement("img");
logo.setAttribute("data-start", "0");
logo.setAttribute("data-duration", "5");
logo.style.width = "340px";
root.appendChild(logo);
// Before its file loads, a width-only <img> measures 0px tall.
modelBrowserLayout(logo, { width: "340px", height: "0px" });
window.__timelines = { main: createMockTimeline(10) };
initSandboxRuntimeModular();
expect(logo.style.height).toBe("");
expect(logo.style.width).toBe("340px");
});
it("puts back an author's display:none !important after measuring the clip", () => {
const root = makeRoot();
const card = document.createElement("div");
+3 -2
View File
@@ -1027,6 +1027,7 @@ export function initSandboxRuntimeModular(): void {
el.style.position = "absolute";
}
if (tag !== "audio") {
const sizedByItsFile = tag === "img";
const forcedWidth = parseDimensionPx(el.getAttribute("data-width"));
const forcedHeight = parseDimensionPx(el.getAttribute("data-height"));
const hasMeaningfulComputedWidth = computed.width !== "0px" && computed.width !== "auto";
@@ -1035,14 +1036,14 @@ export function initSandboxRuntimeModular(): void {
if (!el.style.width && !hasMeaningfulComputedWidth) {
el.style.width = forcedWidth;
}
} else if (!el.style.width && computed.width === "0px") {
} else if (!sizedByItsFile && !el.style.width && computed.width === "0px") {
el.style.width = "100%";
}
if (forcedHeight) {
if (!el.style.height && !hasMeaningfulComputedHeight) {
el.style.height = forcedHeight;
}
} else if (!el.style.height && computed.height === "0px") {
} else if (!sizedByItsFile && !el.style.height && computed.height === "0px") {
el.style.height = "100%";
}
}