OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PDF_PDFIUM_PDFIUM_ENGINE_H_ | 5 #ifndef PDF_PDFIUM_PDFIUM_ENGINE_H_ |
6 #define PDF_PDFIUM_PDFIUM_ENGINE_H_ | 6 #define PDF_PDFIUM_PDFIUM_ENGINE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // This helper class is used to detect the difference in selection between | 128 // This helper class is used to detect the difference in selection between |
129 // construction and destruction. At destruction, it invalidates all the | 129 // construction and destruction. At destruction, it invalidates all the |
130 // parts that are newly selected, along with all the parts that used to be | 130 // parts that are newly selected, along with all the parts that used to be |
131 // selected but are not anymore. | 131 // selected but are not anymore. |
132 class SelectionChangeInvalidator { | 132 class SelectionChangeInvalidator { |
133 public: | 133 public: |
134 explicit SelectionChangeInvalidator(PDFiumEngine* engine); | 134 explicit SelectionChangeInvalidator(PDFiumEngine* engine); |
135 ~SelectionChangeInvalidator(); | 135 ~SelectionChangeInvalidator(); |
136 | 136 |
137 private: | 137 private: |
138 // Sets the given container to the all the currently visible selection | 138 // Returns all the currently visible selection rectangles, in screen |
139 // rectangles, in screen coordinates. | 139 // coordinates. |
140 void GetVisibleSelectionsScreenRects(std::vector<pp::Rect>* rects); | 140 std::vector<pp::Rect> GetVisibleSelections() const; |
141 | 141 |
142 PDFiumEngine* engine_; | 142 PDFiumEngine* const engine_; |
| 143 // The origin at the time this object was constructed. |
| 144 const pp::Point previous_origin_; |
143 // Screen rectangles that were selected on construction. | 145 // Screen rectangles that were selected on construction. |
144 std::vector<pp::Rect> old_selections_; | 146 std::vector<pp::Rect> old_selections_; |
145 // The origin at the time this object was constructed. | |
146 pp::Point previous_origin_; | |
147 }; | 147 }; |
148 | 148 |
149 // Used to store mouse down state to handle it in other mouse event handlers. | 149 // Used to store mouse down state to handle it in other mouse event handlers. |
150 class MouseDownState { | 150 class MouseDownState { |
151 public: | 151 public: |
152 MouseDownState(const PDFiumPage::Area& area, | 152 MouseDownState(const PDFiumPage::Area& area, |
153 const PDFiumPage::LinkTarget& target); | 153 const PDFiumPage::LinkTarget& target); |
154 ~MouseDownState(); | 154 ~MouseDownState(); |
155 | 155 |
156 void Set(const PDFiumPage::Area& area, | 156 void Set(const PDFiumPage::Area& area, |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 bool GetPDFPageSizeByIndex(const void* pdf_buffer, | 810 bool GetPDFPageSizeByIndex(const void* pdf_buffer, |
811 int pdf_buffer_size, | 811 int pdf_buffer_size, |
812 int page_number, | 812 int page_number, |
813 double* width, | 813 double* width, |
814 double* height) override; | 814 double* height) override; |
815 }; | 815 }; |
816 | 816 |
817 } // namespace chrome_pdf | 817 } // namespace chrome_pdf |
818 | 818 |
819 #endif // PDF_PDFIUM_PDFIUM_ENGINE_H_ | 819 #endif // PDF_PDFIUM_PDFIUM_ENGINE_H_ |
OLD | NEW |