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

Only display the loadingIcons when rendering is currently running #15867

Merged
merged 2 commits into from
Dec 27, 2022

Conversation

Snuffleupagus
Copy link
Collaborator

  • Only display the page-loadingIcon when rendering is currently running

    Given that we only render one page at a time, this will lead to only one page-loadingIcon being displayed at a time even if multiple pages are visible in the viewer. However, this will make it clearer which page is the currently parsing/rendering one.

    To simplify toggling of the page-loadingIcon visibility, the existing PDFPageView.renderingState is changed into a getter/setter-pair with the latter also handling the page-loadingIcon state.
    An additional benefit of these changes is that the PDFViewer no longer needs to handling toggling of page-loadingIcon visibility during rendering, since there can only ever be one page rendering.
    Finally, this may also simplify future changes w.r.t. page-loadingIcon visibility toggling (using e.g. a show-timeout).

  • Only display the pageNumber-loadingIcon when rendering is currently running

    This makes the same kind of changes as in the previous patch, but for the pageNumber-loadingIcon in the main toolbar.

    To display the pageNumber-loadingIcon when rendering starts, if the page is the most visible one, we'll utilize the existing "pagerender" event.
    To toggle the pageNumber-loadingIcon as the user moves through the document we'll now instead utilize the "pagechanging" event, which should actually be slightly more efficient overall[1]. Note how we'd, in the old code, only consider the most visible page anyway when toggling the pageNumber-loadingIcon.


    [1] Even in a PDF document as relatively short/simple as tracemonkey.pdf, scrolling through the entire document can easily trigger the "updateviewarea" event more than a thousand times.

@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.241.84.105:8877/3957e1ae9ca5a38/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/3957e1ae9ca5a38/output.txt

Total script time: 1.25 mins

Published

Copy link
Contributor

@calixteman calixteman left a comment

Choose a reason for hiding this comment

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

LGTM.
The code in pdf_page_view is a way more simple like this.

Given that we only render one page at a time, this will lead to only *one* page-loadingIcon being displayed at a time even if multiple pages are visible in the viewer. However, this will make it clearer which page is the currently parsing/rendering one.

To simplify toggling of the page-loadingIcon visibility, the existing `PDFPageView.renderingState` is changed into a getter/setter-pair with the latter also handling the page-loadingIcon state.
An additional benefit of these changes is that the `PDFViewer` no longer needs to handling toggling of page-loadingIcon visibility during rendering, since there can only ever be *one* page rendering.
Finally, this may also simplify future changes w.r.t. page-loadingIcon visibility toggling (using e.g. a show-timeout).
…unning

*This makes the same kind of changes as in the previous patch, but for the pageNumber-loadingIcon in the main toolbar.*

To display the pageNumber-loadingIcon when rendering starts, if the page is the most visible one, we'll utilize the existing "pagerender" event.
To toggle the pageNumber-loadingIcon as the user moves through the document we'll now instead utilize the "pagechanging" event, which should actually be slightly more efficient overall[1]. Note how we'd, in the old code, only consider the most visible page anyway when toggling the pageNumber-loadingIcon.

---
[1] Even in a PDF document as relatively short/simple as `tracemonkey.pdf`, scrolling through the entire document can easily trigger the "updateviewarea" event more than a thousand times.
@Snuffleupagus
Copy link
Collaborator Author

/botio integrationtest

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_integrationtest from @Snuffleupagus received. Current queue size: 1

Live output at: http://54.193.163.58:8877/538fc1fb03eca90/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.241.84.105:8877/86928786123bf89/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/86928786123bf89/output.txt

Total script time: 4.21 mins

  • Integration Tests: Passed

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/538fc1fb03eca90/output.txt

Total script time: 11.07 mins

  • Integration Tests: FAILED

@Snuffleupagus Snuffleupagus merged commit 35ca6ab into mozilla:master Dec 27, 2022
@Snuffleupagus Snuffleupagus deleted the loadingIcon-toggle branch December 27, 2022 12:51
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.

3 participants