| OLD | NEW |
| 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 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 }, | 35 }, |
| 36 | 36 |
| 37 bookmarkChanged_: function() { | 37 bookmarkChanged_: function() { |
| 38 this.$.expand.style.visibility = | 38 this.$.expand.style.visibility = |
| 39 this.bookmark.children.length > 0 ? 'visible' : 'hidden'; | 39 this.bookmark.children.length > 0 ? 'visible' : 'hidden'; |
| 40 }, | 40 }, |
| 41 | 41 |
| 42 depthChanged: function() { | 42 depthChanged: function() { |
| 43 this.childDepth = this.depth + 1; | 43 this.childDepth = this.depth + 1; |
| 44 this.$.item.style.paddingLeft = (this.depth * BOOKMARK_INDENT) + 'px'; | 44 this.$.item.style.webkitPaddingStart = |
| 45 (this.depth * BOOKMARK_INDENT) + 'px'; |
| 45 }, | 46 }, |
| 46 | 47 |
| 47 onClick: function() { | 48 onClick: function() { |
| 48 if (this.bookmark.hasOwnProperty('page')) | 49 if (this.bookmark.hasOwnProperty('page')) |
| 49 this.fire('change-page', {page: this.bookmark.page}); | 50 this.fire('change-page', {page: this.bookmark.page}); |
| 50 }, | 51 }, |
| 51 | 52 |
| 52 toggleChildren: function(e) { | 53 toggleChildren: function(e) { |
| 53 this.childrenShown_ = !this.childrenShown_; | 54 this.childrenShown_ = !this.childrenShown_; |
| 54 if (this.childrenShown_) | 55 if (this.childrenShown_) |
| 55 this.$.expand.classList.add('open'); | 56 this.$.expand.classList.add('open'); |
| 56 else | 57 else |
| 57 this.$.expand.classList.remove('open'); | 58 this.$.expand.classList.remove('open'); |
| 58 e.stopPropagation(); // Prevent the above onClick handler from firing. | 59 e.stopPropagation(); // Prevent the above onClick handler from firing. |
| 59 } | 60 } |
| 60 }); | 61 }); |
| 61 })(); | 62 })(); |
| OLD | NEW |