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

canvas: Properly restore all the remaining items in stateStack in endDrawing #12363

Merged
merged 1 commit into from
Sep 12, 2020

Conversation

emilio
Copy link
Contributor

@emilio emilio commented Sep 11, 2020

We were correctly finishing the SMask group but not restoring all the extra transformations applied in stateStack, so if somebody ends up drawing to the same context after canceling mid-draw we'd get artifacts.

This fixes Mozilla bug 16641781.

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/3d5540d0a448259/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.215.176.217:8877/a5d801e91e7441f/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/3d5540d0a448259/output.txt

Total script time: 21.72 mins

  • Font tests: Passed
  • Unit tests: FAILED
  • Regression tests: FAILED

Image differences available at: http://54.67.70.0:8877/3d5540d0a448259/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.215.176.217:8877/a5d801e91e7441f/output.txt

Total script time: 24.42 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://54.215.176.217:8877/a5d801e91e7441f/reftest-analyzer.html#web=eq.log

@Snuffleupagus
Copy link
Collaborator

Unfortunately, as can be seen above, this causes a number of outright regressions in existing reference tests.

Please see https://github.com/mozilla/pdf.js/wiki/Contributing#4-run-lint-and-testing for information about running tests locally.

@emilio
Copy link
Contributor Author

emilio commented Sep 11, 2020

Ah, thank you! I naively just ran npm test before submitting.

It seems we reset to default also to draw annotations, so that change is probably not quite correct... will look into the failures. Thanks @Snuffleupagus!

@emilio
Copy link
Contributor Author

emilio commented Sep 11, 2020

(And I can try to add a test for this too :P)

@emilio
Copy link
Contributor Author

emilio commented Sep 11, 2020

@Snuffleupagus can you run automation on the current PR? I'm running gulp makeref, but it's taking forever downloading PDFs so this may be faster :)

@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented Sep 11, 2020

Please remove the unwanted commit properly, using something like git rebase -i HEAD~3 and make the necessary edits, rather than adding a "revert" commit to the PR.

can you run automation on the current PR?

Let's try once more; but if there's still issues you'll unfortunately have to bite the bullet and run tests locally, since developing using the bots aren't exactly practical.

I'm running gulp makeref, but it's taking forever downloading PDFs so this may be faster :)

That's an unfortunate side-effect of not being able, for copyright reasons, to include all test PDF files in the repository. (Often times, creating reduced test-cases are unfortunately not that simple.)

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/ab7e9da1268f368/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.215.176.217:8877/ab82944e55017cc/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/ab7e9da1268f368/output.txt

Total script time: 21.48 mins

  • Font tests: Passed
  • Unit tests: FAILED
  • Regression tests: FAILED

Image differences available at: http://54.67.70.0:8877/ab7e9da1268f368/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.215.176.217:8877/ab82944e55017cc/output.txt

Total script time: 23.31 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://54.215.176.217:8877/ab82944e55017cc/reftest-analyzer.html#web=eq.log

@Snuffleupagus
Copy link
Collaborator

@emilio If you're still having trouble downloading the PDF files for testing, send me an email (the address is in my Github profile) and I can provide all of them through a private Dropbox link.

…Drawing.

We were correctly finishing the SMask group but not restoring all the extra
transformations applied in stateStack, so if somebody ends up drawing to the
same context after canceling mid-draw we'd get artifacts.

This fixes Mozilla bug 1664178[1].

[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1664178
@emilio
Copy link
Contributor Author

emilio commented Sep 12, 2020

Please remove the unwanted commit properly, using something like git rebase -i HEAD~3 and make the necessary edits, rather than adding a "revert" commit to the PR.

Yup, I just didn't want to make destructive changes without knowing if that commit was the cuplrit, done now :)

can you run automation on the current PR?

Let's try once more; but if there's still issues you'll unfortunately have to bite the bullet and run tests locally, since developing using the bots aren't exactly practical.

Yeah, I understand, thanks!

I'm running gulp makeref, but it's taking forever downloading PDFs so this may be faster :)

That's an unfortunate side-effect of not being able, for copyright reasons, to include all test PDF files in the repository. (Often times, creating reduced test-cases are unfortunately not that simple.)

I see, that is indeed unfortunate... Anyhow I left my laptop downloading yesterday and now I have all the test files locally :)

The image differences above all seem like minor subpixel differences, unless I'm missing something? Which are not totally unexpected, I guess, as they are from tests that use this cancellation machinery which was leaving some existing state before this patch.

Do you know how should I update the references? Or I guess that happens automatically after merging the change anyways...

@timvandermeij
Copy link
Contributor

timvandermeij commented Sep 12, 2020

I have checked the unit test and reference test failures. You're right that your patch doesn't cause any regressions anymore and these unit/reference test failures are unfortunately intermittent and being dealt with in #12123, so for this patch it looks good.

Updating references is done by our bot on command when we merge the PR, so you don't have to do anything for that.

@timvandermeij timvandermeij changed the title Some minor fixes to RenderTask cancellation / restart. canvas: Properly restore all the remaining items in stateStack in endDrawing Sep 12, 2020
@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 0

Live output at: http://54.67.70.0:8877/fea874aa1a7268e/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/fea874aa1a7268e/output.txt

Total script time: 3.53 mins

Published

@timvandermeij timvandermeij merged commit cdac6f4 into mozilla:master Sep 12, 2020
@timvandermeij
Copy link
Contributor

Looks good. Thanks!

/botio makeref

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_makeref from @timvandermeij received. Current queue size: 0

Live output at: http://54.67.70.0:8877/18f4740e7bac01c/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_makeref from @timvandermeij received. Current queue size: 1

Live output at: http://54.215.176.217:8877/dabf632c20c22e0/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/18f4740e7bac01c/output.txt

Total script time: 19.91 mins

  • Lint: Passed
  • Make references: FAILED

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.215.176.217:8877/dabf632c20c22e0/output.txt

Total script time: 21.59 mins

  • Lint: Passed
  • Make references: FAILED

@timvandermeij
Copy link
Contributor

Hm, not sure why this didn't fail in the test run, but https://github.com/mozilla/pdf.js/blob/master/test/pdfs/bug852992_reduced.pdf now shows Uncaught (in promise) TypeError: ctx is undefined in the console :(

@emilio
Copy link
Contributor Author

emilio commented Sep 12, 2020

Thanks, looking.

emilio added a commit to emilio/pdf.js that referenced this pull request Sep 12, 2020
…stateStack is empty.

This fixes the issue that caused mozilla#12363 to get reverted, see mozilla#12367.
When we end the SMask group and stateStack.length is zero, nothing updates
this.current to reflect it.
emilio added a commit to emilio/pdf.js that referenced this pull request Sep 12, 2020
…Drawing.

We were correctly finishing the SMask group but not restoring all the extra
transformations applied in stateStack, so if somebody ends up drawing to the
same context after canceling mid-draw we'd get artifacts.

This re-lands mozilla#12363 and fixes Mozilla bug 1664178[1].

[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1664178
timvandermeij added a commit that referenced this pull request Sep 15, 2020
canvas: fix restore() with existing SMask groups and re-land #12363.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants