Index: pdf/pdfium/pdfium_engine.cc |
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc |
index 679719f2f9683bbe118f8789c7f6efa1b585d0be..168b3e9b2b12945cfcedf589f142d978f2e92c16 100644 |
--- a/pdf/pdfium/pdfium_engine.cc |
+++ b/pdf/pdfium/pdfium_engine.cc |
@@ -1605,8 +1605,25 @@ PDFiumPage::Area PDFiumEngine::GetCharIndex( |
} |
bool PDFiumEngine::OnMouseDown(const pp::MouseInputEvent& event) { |
- if (event.GetButton() != PP_INPUTEVENT_MOUSEBUTTON_LEFT) |
+ if (event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) |
gene
2015/01/07 23:16:01
nit: could you please check (GetButton() != LEFT &
Deepak
2015/01/08 08:44:57
Done.
|
return false; |
+ if (event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) { |
+ if (!selection_.size()) |
+ return false; |
+ std::vector<pp::Rect> selection_rect_vector; |
+ GetAllScreenRectsUnion(selection_, GetVisibleRect().point(), |
+ &selection_rect_vector); |
+ pp::Point point = event.GetPosition(); |
+ for (size_t i = 0; i < selection_rect_vector.size(); ++i) { |
+ if (selection_rect_vector[i].IsEmpty() || |
gene
2015/01/07 23:16:01
Could you please explain why you exit here if at l
Deepak
2015/01/08 08:44:57
first condition is not required so removing this.
|
+ selection_rect_vector[i].Contains(point.x(), point.y())) { |
+ return false; |
+ } |
+ } |
+ SelectionChangeInvalidator selection_invalidator(this); |
+ selection_.clear(); |
+ return true; |
+ } |
SelectionChangeInvalidator selection_invalidator(this); |
selection_.clear(); |
@@ -2178,18 +2195,22 @@ void PDFiumEngine::StopFind() { |
find_factory_.CancelAll(); |
} |
-void PDFiumEngine::UpdateTickMarks() { |
- std::vector<pp::Rect> tickmarks; |
- for (size_t i = 0; i < find_results_.size(); ++i) { |
+void PDFiumEngine::GetAllScreenRectsUnion(std::vector<PDFiumRange>& rect_range, |
+ const pp::Point offset_point, |
+ std::vector<pp::Rect>* rect_vector) { |
+ for (size_t i = 0; i < rect_range.size(); ++i) { |
pp::Rect rect; |
- // Always use an origin of 0,0 since scroll positions don't affect tickmark. |
- std::vector<pp::Rect> rects = find_results_[i].GetScreenRects( |
- pp::Point(0, 0), current_zoom_, current_rotation_); |
+ std::vector<pp::Rect> rects = rect_range[i].GetScreenRects( |
+ offset_point, current_zoom_, current_rotation_); |
for (size_t j = 0; j < rects.size(); ++j) |
rect = rect.Union(rects[j]); |
- tickmarks.push_back(rect); |
+ rect_vector->push_back(rect); |
} |
+} |
+void PDFiumEngine::UpdateTickMarks() { |
+ std::vector<pp::Rect> tickmarks; |
+ GetAllScreenRectsUnion(find_results_, pp::Point(0, 0), &tickmarks); |
client_->UpdateTickMarks(tickmarks); |
} |