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

For documents with different page sizes, ensure that the correct page becomes visible on load when e.g. the 'page' hash parameter was provided (bug 1191279, issue 6393) #6318

Merged
merged 1 commit into from
Nov 10, 2015

Conversation

Snuffleupagus
Copy link
Collaborator

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1191279.
Fixes #6393.
Edit: Also resolves this Stack Overflow question.

This issue is actually, in a sense, "caused" by the fact that the API/viewer supports partial loading/rendering. Previously when the entire document was always fetched before rendering begun, we knew all page sizes in advance and this issue didn't exist.

Now we use the size of one page in order to set the initial size of every page, until we've fetched the pages and thus know their correct sizes.
This means that during loading the size of the pages can change, which may cause the initial position to become scrolled out of view.

The most naive solution to this problem would perhaps be to delay setting the initial position on load for all documents, until all pages are fetched. However I think that would be a really bad idea, since doing so would make the initial rendering slower and make it feel sluggish for most documents.

Since there is generally no way of knowing if a document has different sized pages prior to loading it, we can only check once the pages are available.
Hence this patch, which treats documents with different sized pages as a special case, by re-applying the initial position when all pages have become available.

… becomes visible on load when e.g. the 'page' hash parameter was provided (bug 1191279, issue 6393)

This issue is actually, in a sense, "caused" by the fact that the API/viewer supports partial loading/rendering. Previously when the *entire* document was always fetched before rendering begun, we knew all page sizes in advance and this issue didn't exist.

Now we use the size of *one* page in order to set the initial size of every page, until we've fetched the pages and thus know their correct sizes.
This means that during loading the size of the pages can change, which may cause the initial position to become scrolled out of view.

The most naive solution to this problem would perhaps be to delay setting the initial position on load for all documents, until all pages are fetched. However I think that would be a *really* bad idea, since doing so would make the initial rendering slower and make it feel sluggish for most documents.

Since there is generally no way of knowing if a document has different sized pages prior to loading it, we can only check once the pages are available.
Hence this patch, which treats documents with different sized pages as a special case, by re-applying the initial position when all pages have become available.
@Snuffleupagus Snuffleupagus changed the title For documents with different page sizes, ensure that the correct page becomes visible on load when e.g. the 'page' hash parameter was provided (bug 1191279) For documents with different page sizes, ensure that the correct page becomes visible on load when e.g. the 'page' hash parameter was provided (bug 1191279, issue 6393) Sep 6, 2015
@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Sep 6, 2015

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/bb788c28eb6a345/output.txt

@yurydelendik
Copy link
Contributor

Okay, let's go with naive solution first. Thank you for the patch.

yurydelendik added a commit that referenced this pull request Nov 10, 2015
For documents with different page sizes, ensure that the correct page becomes visible on load when e.g. the 'page' hash parameter was provided (bug 1191279, issue 6393)
@yurydelendik yurydelendik merged commit a4ca998 into mozilla:master Nov 10, 2015
@Snuffleupagus Snuffleupagus deleted the bug-1191279 branch November 11, 2015 08:30
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.

Destinations
3 participants