Index: pdf/pdfium/pdfium_engine.cc |
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc |
index 08e869de6e40c95f10dd6b9a4b9d46ea3c83b558..b829f4774f4c0cbb5d48ab879f65033573bdab4b 100644 |
--- a/pdf/pdfium/pdfium_engine.cc |
+++ b/pdf/pdfium/pdfium_engine.cc |
@@ -1527,8 +1527,11 @@ bool PDFiumEngine::OnMouseDown(const pp::MouseInputEvent& event) { |
selection_.clear(); |
return true; |
} |
- if (event.GetButton() != PP_INPUTEVENT_MOUSEBUTTON_LEFT) |
+ |
+ if (event.GetButton() != PP_INPUTEVENT_MOUSEBUTTON_LEFT && |
+ event.GetButton() != PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) { |
return false; |
+ } |
SelectionChangeInvalidator selection_invalidator(this); |
selection_.clear(); |
@@ -1546,6 +1549,9 @@ bool PDFiumEngine::OnMouseDown(const pp::MouseInputEvent& event) { |
if (area == PDFiumPage::WEBLINK_AREA) |
return true; |
+ if (event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) |
Lei Zhang
2016/07/14 00:03:39
Add a comment to explain why we return here.
jaepark
2016/07/14 00:59:40
Done.
|
+ return false; |
+ |
if (area == PDFiumPage::DOCLINK_AREA) { |
Lei Zhang
2016/07/14 00:03:40
What about middle clicks on DOCLINK_AREAs? How do
jaepark
2016/07/14 00:59:40
I assume you mean ctrl + left (not shift + left) c
Lei Zhang
2016/07/14 01:25:04
Yes, I meant ctrl, though I just discovered what s
|
client_->ScrollToPage(target.page); |
client_->FormTextFieldFocusChange(false); |
@@ -1620,8 +1626,11 @@ void PDFiumEngine::OnMultipleClick(int click_count, |
} |
bool PDFiumEngine::OnMouseUp(const pp::MouseInputEvent& event) { |
- if (event.GetButton() != PP_INPUTEVENT_MOUSEBUTTON_LEFT) |
+ |
+ if (event.GetButton() != PP_INPUTEVENT_MOUSEBUTTON_LEFT && |
+ event.GetButton() != PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) { |
return false; |
+ } |
int page_index = -1; |
int char_index = -1; |
@@ -1633,13 +1642,17 @@ bool PDFiumEngine::OnMouseUp(const pp::MouseInputEvent& event) { |
// Open link on mouse up for same link for which mouse down happened earlier. |
if (mouse_down_state_.Matches(area, target)) { |
if (area == PDFiumPage::WEBLINK_AREA) { |
- bool open_in_new_tab = !!(event.GetModifiers() & kDefaultKeyModifier); |
+ bool open_in_new_tab = !!(event.GetModifiers() & kDefaultKeyModifier) || |
+ !!(event.GetModifiers() & PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN); |
client_->NavigateTo(target.url, open_in_new_tab); |
client_->FormTextFieldFocusChange(false); |
return true; |
} |
} |
+ if (event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) |
+ return false; |
+ |
if (page_index != -1) { |
double page_x, page_y; |
pp::Point point = event.GetPosition(); |