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

Side by Side Diff: chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js

Issue 1654683002: PDF: Allow external navigation links in PDF bookmarks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/pdf/pdf.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 (function() { 5 (function() {
6 /** Amount that each level of bookmarks is indented by (px). */ 6 /** Amount that each level of bookmarks is indented by (px). */
7 var BOOKMARK_INDENT = 20; 7 var BOOKMARK_INDENT = 20;
8 8
9 Polymer({ 9 Polymer({
10 is: 'viewer-bookmark', 10 is: 'viewer-bookmark',
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 depthChanged: function() { 59 depthChanged: function() {
60 this.childDepth = this.depth + 1; 60 this.childDepth = this.depth + 1;
61 this.$.item.style.webkitPaddingStart = 61 this.$.item.style.webkitPaddingStart =
62 (this.depth * BOOKMARK_INDENT) + 'px'; 62 (this.depth * BOOKMARK_INDENT) + 'px';
63 }, 63 },
64 64
65 onClick: function() { 65 onClick: function() {
66 if (this.bookmark.hasOwnProperty('page')) 66 if (this.bookmark.hasOwnProperty('page'))
67 this.fire('change-page', {page: this.bookmark.page}); 67 this.fire('change-page', {page: this.bookmark.page});
68 else if (this.bookmark.hasOwnProperty('uri'))
69 this.fire('navigate', {uri: this.bookmark.uri, newtab: true});
68 }, 70 },
69 71
70 onEnter_: function(e) { 72 onEnter_: function(e) {
71 // Don't allow events which have propagated up from the expand button to 73 // Don't allow events which have propagated up from the expand button to
72 // trigger a click. 74 // trigger a click.
73 if (e.detail.keyboardEvent.target != this.$.expand) 75 if (e.detail.keyboardEvent.target != this.$.expand)
74 this.onClick(); 76 this.onClick();
75 }, 77 },
76 78
77 onSpace_: function(e) { 79 onSpace_: function(e) {
78 // paper-icon-button stops propagation of space events, so there's no need 80 // paper-icon-button stops propagation of space events, so there's no need
79 // to check the event source here. 81 // to check the event source here.
80 this.onClick(); 82 this.onClick();
81 // Prevent default space scroll behavior. 83 // Prevent default space scroll behavior.
82 e.detail.keyboardEvent.preventDefault(); 84 e.detail.keyboardEvent.preventDefault();
83 }, 85 },
84 86
85 toggleChildren: function(e) { 87 toggleChildren: function(e) {
86 this.childrenShown = !this.childrenShown; 88 this.childrenShown = !this.childrenShown;
87 e.stopPropagation(); // Prevent the above onClick handler from firing. 89 e.stopPropagation(); // Prevent the above onClick handler from firing.
88 } 90 }
89 }); 91 });
90 })(); 92 })();
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/pdf/pdf.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698