summaryrefslogtreecommitdiffstats
path: root/pdf
diff options
context:
space:
mode:
authordeepak.m1 <deepak.m1@samsung.com>2015-01-16 03:37:59 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-16 11:39:52 +0000
commit6989b943b34eab8ff10aada9a0b9ce6f472919e8 (patch)
treef41f72315e20e9d0260b4b3fa08bea6ea4b987ab /pdf
parent57d45a3acb200e9009c0faf549f7ac751c41cfe6 (diff)
downloadchromium_src-6989b943b34eab8ff10aada9a0b9ce6f472919e8.zip
chromium_src-6989b943b34eab8ff10aada9a0b9ce6f472919e8.tar.gz
chromium_src-6989b943b34eab8ff10aada9a0b9ce6f472919e8.tar.bz2
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}
Diffstat (limited to 'pdf')
-rw-r--r--pdf/pdfium/pdfium_engine.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc
index 87f8d65..29ef475 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -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.