Use dynamic background-repeat for background-image rendering #3003
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.
Summary
Removes bleed around the html2canvas capture of a no-repeat background image, by specifying the repeat type in the canvas context's renderer. Slight bleed was observed when the original element's position had long decimal values.
Note that a tiny variation in the positioning of this corrected image still depends on the browser's window size within the monitor's available screen space or whether the browser's dev tools pane is open when the canvas is captured.
This PR fixes/implements the following bugs/features
Explain the motivation for making this change. What existing problem does the pull request solve?
As a workaround to the unsupported
object-fit: contain;
, using a background-image withbackground-size: contain;
does work well, and this fixes the bleed.Test plan (required)
Test the repeat.html template. The "edges" sample image has the peak of a roof on its left edge, which we expect to not show as any bleed pixels on the right edge of the snapshot.
Code formatting
passes existing tests and formatting. I'm not sure where the expected image gets stored, but this new test does show the bleed without this rendering fix, and has no bleed with this rendering fix.
Closing issues
Fixes #1147
closes #1147
Fixes #1408
closes #1408