Skip to content

Make "become background" include "expand to fill space" (BL-16117)#7804

Open
JohnThomson wants to merge 1 commit intomasterfrom
bakgroundIncludesExpand
Open

Make "become background" include "expand to fill space" (BL-16117)#7804
JohnThomson wants to merge 1 commit intomasterfrom
bakgroundIncludesExpand

Conversation

@JohnThomson
Copy link
Copy Markdown
Contributor

@JohnThomson JohnThomson commented Apr 2, 2026


Open with Devin

This change is Reviewable

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 2 additional findings in Devin Review.

Open in Devin Review

Comment on lines 1915 to 1919
theOneCanvasElementManager.setActiveElement(
bgImageCe,
);
theOneCanvasElementManager.expandImageToFillSpace();
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚩 Potential race between expandImageToFillSpace and deferred adjustBackgroundImageSize from updateCanvasElementForChangedImage

When haveRealBgImage is true, updateCanvasElementForChangedImage(bgImg) at line 1904 calls adjustBackgroundImageSize with useSizeOfNewImage=true, which sets up a deferred adjustment (~100ms timeout or image load listener) at CanvasElementManager.ts:7276-7312. Then expandImageToFillSpace() runs in the next animation frame (~16ms). If expandImageToFillSpace succeeds first (setting bgCanvasElement to fill the canvas), the deferred adjustment computes imgAspectRatio from the now-filled canvas element dimensions (CanvasElementManager.ts:7317-7319), which equals the container aspect ratio, so it re-sets the same dimensions — effectively a no-op. The cropping adjustment at CanvasElementManager.ts:7424 also computes a scale of ~1, preserving the fill. So the race resolves correctly. If expandImageToFillSpace fails (image not loaded), the deferred adjustment puts the image in 'contain' mode (not 'fill'), meaning the fill intent of this PR wouldn't take effect for the haveRealBgImage case. This is unlikely since the image was previously displayed as an overlay and should be browser-cached.

(Refers to lines 1904-1919)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This seems to be a classic Devin "if something changed you might have a problem". I don't think it's worth addressing.

Copy link
Copy Markdown
Contributor Author

@JohnThomson JohnThomson left a comment

Choose a reason for hiding this comment

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

@JohnThomson made 1 comment.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion.

Comment on lines 1915 to 1919
theOneCanvasElementManager.setActiveElement(
bgImageCe,
);
theOneCanvasElementManager.expandImageToFillSpace();
});
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This seems to be a classic Devin "if something changed you might have a problem". I don't think it's worth addressing.

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