Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use dynamic background-repeat for background-image rendering #3003

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

TreehouseNorris
Copy link

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

  • [ x ] Bug 1
  • Bug 2
  • Feature 1
  • Feature 2
  • Breaking changes

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 with background-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

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.

Background-image can see repeat leaking over sides of container Background repeat not working
1 participant