diff options
Diffstat (limited to 'chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js')
-rw-r--r-- | chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js b/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js index 43f9de649e5..4f555296490 100644 --- a/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js +++ b/chromium/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js @@ -2,20 +2,38 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -Polymer('viewer-bookmark', { +(function() { + // Amount that each level of bookmarks is indented by (px). + var BOOKMARK_INDENT = 16; - /** - * @type {Object} - * A bookmark object, each containing a: - * - title - * - page (optional) - * - children (an array of bookmarks) - */ - bookmark: null, + Polymer({ + is: 'viewer-bookmark', - onClick: function() { - if (this.bookmark.hasOwnProperty('page')) - this.fire('change-page', {page: this.bookmark.page}); - }, + properties: { + /** + * A bookmark object, each containing a: + * - title + * - page (optional) + * - children (an array of bookmarks) + */ + bookmark: Object, -}); + depth: { + type: Number, + observer: 'depthChanged' + }, + + childDepth: Number + }, + + depthChanged: function() { + this.childDepth = this.depth + 1; + this.$.item.style.paddingLeft = (this.depth * BOOKMARK_INDENT) + 'px'; + }, + + onClick: function() { + if (this.bookmark.hasOwnProperty('page')) + this.fire('change-page', {page: this.bookmark.page}); + }, + }); +})(); |