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

Move more code/methods into BaseViewer, and simplify the PDFSinglePageViewer._scrollIntoView method slightly #10489

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

  1. Move additional code/methods into BaseViewer and have the extending classes override/extend methods as necessary

    This attempts to provide more "default" methods in the base class, in order to reduce unnecessary duplication and to improve self-documentation of the BaseViewer class slightly.
    The following changes are made (in no particular order):

    • Have BaseViewer implement the _scrollIntoView method, and extend it as necessary in PDFViewer/PDFSinglePageViewer.
    • Simply inline the BaseViewer._resizeBuffer method, in BaseViewer.update, since there's only one call-site at this point.
    • Provide a default implementation of _isScrollModeHorizontal in BaseViewer, and have PDFSinglePageViewer override it.
    • Provide a default implementation of _getVisiblePages, and have PDFViewer extend it and PDFSinglePageViewer override it.
  2. Try to simplify the PDFSinglePageViewer._scrollIntoView method slightly, by unconditionally ensuring that rendering always occurs

… classes override/extend methods as necessary

This attempts to provide more "default" methods in the base class, in order to reduce unnecessary duplication and to improve self-documentation of the `BaseViewer` class slightly.
The following changes are made (in no particular order):
 - Have `BaseViewer` implement the `_scrollIntoView` method, and *extend* it as necessary in `PDFViewer`/`PDFSinglePageViewer`.
 - Simply inline the `BaseViewer._resizeBuffer` method, in `BaseViewer.update`, since there's only one call-site at this point.
 - Provide a default implementation of `_isScrollModeHorizontal` in `BaseViewer`, and have `PDFSinglePageViewer` override it.
 - Provide a default implementation of `_getVisiblePages`, and have `PDFViewer` extend it and `PDFSinglePageViewer` override it.
…htly, by unconditionally ensuring that rendering always occurs
@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/d6d33f2e11cc688/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

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

Total script time: 1.71 mins

Published

@timvandermeij timvandermeij merged commit 40863eb into mozilla:master Jan 25, 2019
@timvandermeij
Copy link
Contributor

Looks good. Thank you!

@Snuffleupagus Snuffleupagus deleted the single-page-scrollIntoView branch January 25, 2019 23:13
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