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

Users reporting that pages are being laid out larger than the window #504

Closed
rkwright opened this issue Mar 8, 2016 · 5 comments
Closed

Comments

@rkwright
Copy link
Contributor

rkwright commented Mar 8, 2016

This issue is a:

Bug report

Related issue(s), pull request(s)

None

Expected behaviour

Pages should lay out on the screen such that no part of the page is cropped

Observed behaviour

On SOME users' machines the pages are laid out such that they are over-size and part of the page is cropped. If the user selects "Fit to Screen" then it fits that page to the screen, but advancing the page to the next results in the same problem.

Steps to reproduce

  1. Open the test document
  2. Go to the first chapter
  3. See the page is too large
  4. Select "Fit to screen"
  5. Go to the next page and see the problem again.

Test file(s)

(if relevant, please indicate public EPUB URL(s), or whether you can share ebook(s) privately)

Product

Readium Chrome Extension, 2.22.2?

  • latest official version available from the Chrome Web Store

Web browser

Chrome

Operating system

Unknown so far

Additional information

This problem was reported by Holbrook.com who created the book. This problem has been reported by several users, but not all and Holbrook has not themselves been able to reproduce it.

@rkwright
Copy link
Contributor Author

I have managed to reproduce the issue on Windows 7. Here are the steps:

  1. Load the EPUB
  2. Make sure the scaling of the page is such that it is LESS than 100%
  3. Go to the Compass page
  4. Click on one of the "Enter" buttons - doesn't matter which
  5. You will see that the page is scaled such that it is cropped
  6. Click "Fit to Screen" and it rescales
  7. If you click on any of the links to a new page you will see the new page is also cropped...

I am going to try backing out this fix and see if that "fixes" the problem. Ironically, that fix was made to work around another wonky InDesign EPUB.

@rkwright
Copy link
Contributor Author

In fact, now that I know how to reproduce it on Windows 7 I can reproduce in on my MacBookPro running OSX 10.11.3 and Chrome 49. Again if you have a large monitor and the scaling is >100% then the pages SHRINK while <100% they grow. If you set the scaling to 100% no shrinking or growing occurs.

@rkwright
Copy link
Contributor Author

I have confirmed that backing out this fix by changing the flag to "false" fixes the problem. Of course it will then re-create the other bug(s) that change was introduced to fix. :-(

@danielweck
Copy link
Member

Related issue: #508

@danielweck
Copy link
Member

Ah, I found the source of the problem! (both FXL scaling error, and broken internal navigation)
This is not a bug in Readium. The HTML scaling function is fine.

Culprit in idGeneratedScript.js:

function goToDestination(ref) {
window.location.href = ref;
}

Explanation: any dynamic / scripted redirect (via window.location.href or any other means) of the iframe that hosts EPUB content documents, will always break Readium (in several critical ways). That's because Readium can only preprocess and handle hyperlinks that are statically encoded (represented in a declarative way in the HTML files). Using scripted navigation is bad practice in the general case anyway, although I must admit that maybe it works fine in iBooks (and other reading systems) that capture / intercept dynamic URI loading.

In Readium, it may have "looked" like everything is working fine with some combination of web browsers / OS, but in fact the HTML is forcibly loaded into the iframe with no reading system intervention / checks / injections (MathJax, navigator.epubReadingSystem, annotations CSS, viewport dimensions, audio Media Overlays, etc.). In other words: this leads to a complete disconnection of the displayed HTML and the hosting reading system. It's just like loading the HTML file directly inside any arbitrary iframe.

I am filing a new issue: readium/readium-shared-js#275

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

No branches or pull requests

2 participants