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

Unified Diff: pdf/pdfium/pdfium_engine.h

Issue 691273003: PDF: Fix potential bad indexes in find results. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 6 years, 1 month 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 | « pdf/out_of_process_instance.cc ('k') | pdf/pdfium/pdfium_engine.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/pdfium/pdfium_engine.h
diff --git a/pdf/pdfium/pdfium_engine.h b/pdf/pdfium/pdfium_engine.h
index cb3d0f4030e8f0aa2cd497dfe4bb10f4559f4d57..4bea1e6280671dae05950ad2c73a96d5d0523eb1 100644
--- a/pdf/pdfium/pdfium_engine.h
+++ b/pdf/pdfium/pdfium_engine.h
@@ -151,6 +151,26 @@ class PDFiumEngine : public PDFEngine,
DISALLOW_COPY_AND_ASSIGN(MouseDownState);
};
+ // Used to store the state of a text search.
+ class FindTextIndex {
+ public:
+ FindTextIndex();
+ ~FindTextIndex();
+
+ bool valid() const { return valid_; }
+ void Invalidate();
+
+ size_t GetIndex() const;
+ void SetIndex(size_t index);
+ size_t IncrementIndex();
+
+ private:
+ bool valid_; // Whether |index_| is valid or not.
+ size_t index_; // The current search result, 0-based.
+
+ DISALLOW_COPY_AND_ASSIGN(FindTextIndex);
+ };
+
friend class SelectionChangeInvalidator;
struct FileAvail : public FX_FILEAVAIL {
@@ -391,6 +411,9 @@ class PDFiumEngine : public PDFEngine,
// Called when the selection changes.
void OnSelectionChanged();
+ // Common code shared by RotateClockwise() and RotateCounterclockwise().
+ void RotateInternal();
+
// FPDF_FORMFILLINFO callbacks.
static void Form_Invalidate(FPDF_FORMFILLINFO* param,
FPDF_PAGE page,
@@ -540,9 +563,9 @@ class PDFiumEngine : public PDFEngine,
int last_page_to_search_;
int last_character_index_to_search_; // -1 if search until end of page.
// Which result the user has currently selected.
- int current_find_index_;
+ FindTextIndex current_find_index_;
// Where to resume searching.
- int resume_find_index_;
+ FindTextIndex resume_find_index_;
// Permissions bitfield.
unsigned long permissions_;
« no previous file with comments | « pdf/out_of_process_instance.cc ('k') | pdf/pdfium/pdfium_engine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698