Fix LVDocView::getBookmark() which could be slow or wrong #313
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix issue noticed at koreader/koreader#5436 (comment).
Since 5967f72 (#312) and some change to be able to traverse RTL tables for text selection,
LVDocView::getBookmark()
, which is used to get the current page xpointer, could be slow on some pages, or wrong on others.So, make it clear that, with
createXPointer(lvPoint, direction)
andelementFromPoint(lvPoint, direction)
, using direction=0 will check for x, while direction=1/-1 will not.Wherever we are only interested in y, and provide a dummy x=0, we should use direction=1 or -1:
getPageDocumentRange()
was already using 1/-1 exclusively.getBookmark()
now does too.getNodeByPoint()
uses 0 to find the exact node at x/y.Previous related fixes on this topic in #195 #249 #299 ... I hope this doesn't break other things...