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

audit use of parseInt #505

Closed
usmonster opened this issue Jan 19, 2015 · 5 comments
Closed

audit use of parseInt #505

usmonster opened this issue Jan 19, 2015 · 5 comments
Labels

Comments

@usmonster
Copy link
Contributor

There seem to be many places in the code where parseInt is used where parseFloat might be considered more appropriate/correct. This can result in certain rounding errors and blurry renders, as mentioned in, for example, #340 (relevant comment).

It should also be noted that, according to the spec(s), pixel (and most other length/position/dimension/number) values can be floating point numbers, so any regular expressions used to parse number values should probably also be audited to ensure they're checking for a possible decimal part, where appropriate.

@niklasvh
Copy link
Owner

Yes.

Would help a lot as well if we could gather some unit tests that can be tested against while fixing these.

@niklasvh niklasvh added the Bug label Jan 19, 2015
@usmonster
Copy link
Contributor Author

I also wanted to know if there was a way to get (native) screenshots of the Selenium render tests, so we can see exactly why some tests have very low render accuracy on certain browsers?

@niklasvh
Copy link
Owner

The webdriver tests actually compare native screenshots with the html2canvas renders (that's what the percentage on the https://travis-ci.org/niklasvh/html2canvas results refer to).

I've been meaning to have some API setup so the screenshots could be stored and viewed after each commit as well, since computer image matching isn't very reliable here.

@usmonster
Copy link
Contributor Author

Yep, by getting the native screenshots I meant viewing those produced by the webdriver tests, alongside the h2c renders if possible (and/or maybe an image diff?). :] That would be extremely valuable, I think.

usmonster added a commit to usmonster/html2canvas that referenced this issue Jan 20, 2015
- Updates CSS color stop regular expression to accept color names
- Handles arbitrary gradient direction percentages
- Handles certain CSS2 linear gradients (fixes Firefox).

Ref niklasvh#469.

TODO:

- add support for px (see CanvasRenderer.prototype.renderBackgroundGradient)
- update regexps to support floating point numbers (see niklasvh#505)
- add tests
usmonster added a commit to usmonster/html2canvas that referenced this issue Feb 14, 2015
- Updates CSS color stop regular expression to accept color names
- Handles arbitrary gradient direction percentages
- Handles certain CSS2 linear gradients (fixes Firefox).

Ref niklasvh#469.

TODO:

- add support for px (see CanvasRenderer.prototype.renderBackgroundGradient)
- update regexps to support floating point numbers (see niklasvh#505)
- add tests
usmonster added a commit to usmonster/html2canvas that referenced this issue Mar 6, 2015
- Updates CSS color stop regular expression to accept color names
- Handles arbitrary gradient direction percentages
- Handles certain CSS2 linear gradients (fixes Firefox).

Ref niklasvh#469.

TODO:

- add support for px (see CanvasRenderer.prototype.renderBackgroundGradient)
- update regexps to support floating point numbers (see niklasvh#505)
- add tests
@niklasvh
Copy link
Owner

Considering the lib has been rewritten, most of these should be fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants