Chromium Code Reviews| Index: pdf/pdfium/pdfium_engine.cc |
| diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc |
| index 83c83f4fe439c59c8d971de0d1fbe68ba1d1fda5..4af6436cc32c63a771fa6f90b76b8165b2546961 100644 |
| --- a/pdf/pdfium/pdfium_engine.cc |
| +++ b/pdf/pdfium/pdfium_engine.cc |
| @@ -1242,10 +1242,7 @@ PDFiumPage::Area PDFiumEngine::GetCharIndex( |
| int* char_index, PDFiumPage::LinkTarget* target) { |
| // First figure out which page this is in. |
| pp::Point mouse_point = event.GetPosition(); |
| - pp::Point point( |
| - static_cast<int>((mouse_point.x() + position_.x()) / current_zoom_), |
| - static_cast<int>((mouse_point.y() + position_.y()) / current_zoom_)); |
| - return GetCharIndex(point, page_index, char_index, target); |
| + return GetCharIndex(mouse_point, page_index, char_index, target); |
| } |
| PDFiumPage::Area PDFiumEngine::GetCharIndex( |
|
raymes
2014/09/08 01:25:38
It looks like this function expects |point| to be
Nikhil
2014/09/08 05:59:12
Done.
|
| @@ -1253,9 +1250,13 @@ PDFiumPage::Area PDFiumEngine::GetCharIndex( |
| int* page_index, |
| int* char_index, |
| PDFiumPage::LinkTarget* target) { |
| + pp::Point test_point( |
| + static_cast<int>((point.x() + position_.x()) / current_zoom_), |
| + static_cast<int>((point.y() + position_.y()) / current_zoom_)); |
| + |
| int page = -1; |
| for (size_t i = 0; i < visible_pages_.size(); ++i) { |
| - if (pages_[visible_pages_[i]]->rect().Contains(point)) { |
| + if (pages_[visible_pages_[i]]->rect().Contains(test_point)) { |
| page = visible_pages_[i]; |
| break; |
| } |
| @@ -1271,8 +1272,8 @@ PDFiumPage::Area PDFiumEngine::GetCharIndex( |
| } |
| *page_index = page; |
| - return pages_[page]->GetCharIndex(point, current_rotation_, char_index, |
| - target); |
| + return pages_[page]->GetCharIndex( |
| + test_point, current_rotation_, char_index, target); |
| } |
| bool PDFiumEngine::OnMouseDown(const pp::MouseInputEvent& event) { |