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

Unified Diff: chrome/browser/resources/pdf/pdf.js

Issue 2127383002: Open hyperlinks in PDF in a new tab when middle mouse clicking. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Open hyperlinks in PDF in a new tab when middle mouse clicking. 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: chrome/browser/resources/pdf/pdf.js
diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js
index d4beae6f9cb67452e8f9801ab982b911f3bd0990..727991c0ba2cd95ea96b150c263e1a4787e01240 100644
--- a/chrome/browser/resources/pdf/pdf.js
+++ b/chrome/browser/resources/pdf/pdf.js
@@ -604,6 +604,28 @@ PDFViewer.prototype = {
'&body=' + message.data.body;
window.location.href = href;
break;
+ case 'getLinkPositionReply':
+ var visiblePage = this.viewport_.getMostVisiblePage();
+ var visiblePageDimensions =
+ this.viewport_.getPageScreenRect(visiblePage);
+
+ var linkExists = false;
+ var viewportCoordinateX;
+ var viewportCoordinateY;
+ if (message.data.x !== undefined && message.data.y !== undefined) {
raymes 2016/07/13 02:03:25 The position of the first link in the test documen
+ linkExists = true;
+ viewportCoordinateX = message.data.x + visiblePageDimensions.x;
+ viewportCoordinateY = message.data.y + visiblePageDimensions.y +
+ PDFViewer.MATERIAL_TOOLBAR_HEIGHT;
+ }
+
+ this.sendScriptingMessage_({
+ type: 'getLinkPositionReply',
+ linkExists: linkExists,
+ x: viewportCoordinateX,
+ y: viewportCoordinateY
+ });
+ break;
case 'getPassword':
// If the password screen isn't up, put it up. Otherwise we're
// responding to an incorrect password so deny it.
@@ -779,6 +801,7 @@ PDFViewer.prototype = {
}
switch (message.data.type.toString()) {
+ case 'getLinkPosition':
case 'getSelectedText':
case 'print':
case 'selectAll':

Powered by Google App Engine
This is Rietveld 408576698