Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2094)

Unified Diff: pdf/pdfium/pdfium_engine.cc

Issue 823523005: PDF: Fix missing character when selecting backwards (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/pdfium/pdfium_engine.cc
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc
index 87f8d65dc90e3a09695495146564febe52b6ce6c..29ef475cfb89e8d294fec9ba9d1e2d181ff28857 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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698