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

Unified Diff: pdf/pdfium/pdfium_engine.cc

Issue 2166193002: Handle ctrl + shift + left click on links in PDF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
Index: pdf/pdfium/pdfium_engine.cc
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc
index d0796a5e4eca0a9a2515f452110d92f5ecea0aad..5ca61a2850bbf8818951928c97c5ba39c37bdeba 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -1643,9 +1643,25 @@ 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) ||
+ NavigateOption option = OPEN_IN_CURRENT_TAB;
Lei Zhang 2016/07/21 05:34:28 No need to initialize since all the cases are cove
jaepark 2016/07/21 22:34:33 Done.
+ bool ctrl = !!(event.GetModifiers() & kDefaultKeyModifier) ||
Lei Zhang 2016/07/21 05:34:28 Maybe control can stay as open_in_new_tab?
jaepark 2016/07/21 22:34:33 Done.
!!(event.GetModifiers() & PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN);
- client_->NavigateTo(target.url, open_in_new_tab);
+
+ bool shift = !!(event.GetModifiers() & PP_INPUTEVENT_MODIFIER_SHIFTKEY);
+
+ if (ctrl) {
+ if (shift)
+ option = OPEN_IN_NEW_FOREGROUND_TAB;
+ else
+ option = OPEN_IN_NEW_BACKGROUND_TAB;
+ } else {
+ if (shift)
+ option = OPEN_IN_NEW_WINDOW;
+ else
+ option = OPEN_IN_CURRENT_TAB;
+ }
+
+ client_->NavigateTo(target.url, option);
client_->FormTextFieldFocusChange(false);
return true;
}
@@ -3524,7 +3540,7 @@ void PDFiumEngine::Form_SetTextFieldFocus(FPDF_FORMFILLINFO* param,
void PDFiumEngine::Form_DoURIAction(FPDF_FORMFILLINFO* param,
FPDF_BYTESTRING uri) {
PDFiumEngine* engine = static_cast<PDFiumEngine*>(param);
- engine->client_->NavigateTo(std::string(uri), false);
+ engine->client_->NavigateTo(std::string(uri), OPEN_IN_CURRENT_TAB);
}
void PDFiumEngine::Form_DoGoToAction(FPDF_FORMFILLINFO* param,

Powered by Google App Engine
This is Rietveld 408576698