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

Unified Diff: pdf/pdfium/pdfium_engine.cc

Issue 553453002: PDF Viewer - Show context menu for links on right click (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 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) {
« 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