0

PDF: Fix missing character when selecting backwards

When selecting backwards across page boundaries, the character count for
the start page of the text selection was one character short. Add one to
the character count to fix the selection.

BUG=445307

Review URL: https://codereview.chromium.org/823523005

Cr-Commit-Position: refs/heads/master@{#311870}
This commit is contained in:
deepak.m1
2015-01-16 03:37:59 -08:00
committed by Commit bot
parent 57d45a3acb
commit 6989b943b3

@ -1863,7 +1863,10 @@ bool PDFiumEngine::OnMouseMove(const pp::MouseInputEvent& event) {
selection_.push_back(PDFiumRange(pages_[page_index], 0, char_index));
} else {
// Selecting into the previous page.
selection_[last].SetCharCount(-selection_[last].char_index());
// The selection's char_index is 0-based, so the character count is one
// more than the index. The character count needs to be negative to
// indicate a backwards selection.
selection_[last].SetCharCount(-(selection_[last].char_index() + 1));
// First make sure that there are no gaps in selection, i.e. if mousedown on
// page three but we only get mousemove over page one, we want page two.