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

Workaround about visible rectangles for Webkit-based browsers causes problem in the general case #393

Open
HGuillemet opened this issue Jun 3, 2017 · 3 comments

Comments

@HGuillemet
Copy link

This issue is a Bug

Observed behaviour

isElementVisible sometimes returns a wrong value.

In cfi_navigation_logic.js, the function adjustRectangle offsets the clientRects one column to the left if the top of the rectangle is < 0. From the comments, I understand it's a workaround for a bug in Webkit. But I have situations (tested on Firefox with Open Dyslexic font) where the rectangle has a negative top for another reason: depending on the font used, the clientRects for a word on the first visible line of text may be taller than the line-height css property and thus the top of the clientRect is above the top of the viewport. This is more or less normal I believe. This results in isElementVisible returning a wrong value for elements containing the first visible line.

Is the Webkit workaround still necessary for the recent versions of webkit browser ? If yes, is it possible to find a way to distinguish the case where the rectangle must be adjusted from the case described above ?

Product

development branch of readium-shared-js
Firefox 52.1

@HGuillemet HGuillemet changed the title Workaround about visible rectangles for Webkit-based browsers cause problem in the general case Workaround about visible rectangles for Webkit-based browsers causes problem in the general case Jun 3, 2017
@danielweck
Copy link
Member

Thank you very much for the detailed report.
CC @jccr
Any thoughts Juan? (something you have come across before?)

@jccr
Copy link
Member

jccr commented Jul 10, 2017

@HGuillemet @danielweck
Added to my to-do list

@HGuillemet
Copy link
Author

Any news about this one ?

A simple way to reproduce the bug is to open a book with some problematic font (open sans or opendyslexic for instance), flip one page right, go back to library and back to the book : the saved CFI position is restored and it's the previous page that is shown, not the last one flipped.
Commenting out the content of adjustRectangle solves the problem, but I'm not sure to understand what's the rationale behind this function and the Webkit behaviour it's supposed to work around, and thus what's the implication of removing adjustRectangle.

(Tested with Firefox 58.0.1)

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

4 participants