| Index: chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js
|
| diff --git a/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js b/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js
|
| index 9d6399070e7a82868314a24996011b8945cd01d2..1e7164a333fea75926d9be43415a6dc192f08793 100644
|
| --- a/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js
|
| +++ b/chrome/browser/resources/pdf/elements/viewer-bookmark/viewer-bookmark.js
|
| @@ -3,90 +3,75 @@
|
| // found in the LICENSE file.
|
|
|
| (function() {
|
| - /** Amount that each level of bookmarks is indented by (px). */
|
| - var BOOKMARK_INDENT = 20;
|
| +/** Amount that each level of bookmarks is indented by (px). */
|
| +var BOOKMARK_INDENT = 20;
|
|
|
| - Polymer({
|
| - is: 'viewer-bookmark',
|
| +Polymer({
|
| + is: 'viewer-bookmark',
|
|
|
| - properties: {
|
| - /**
|
| - * A bookmark object, each containing a:
|
| - * - title
|
| - * - page (optional)
|
| - * - children (an array of bookmarks)
|
| - */
|
| - bookmark: {
|
| - type: Object,
|
| - observer: 'bookmarkChanged_'
|
| - },
|
| + properties: {
|
| + /**
|
| + * A bookmark object, each containing a:
|
| + * - title
|
| + * - page (optional)
|
| + * - children (an array of bookmarks)
|
| + */
|
| + bookmark: {type: Object, observer: 'bookmarkChanged_'},
|
|
|
| - depth: {
|
| - type: Number,
|
| - observer: 'depthChanged'
|
| - },
|
| + depth: {type: Number, observer: 'depthChanged'},
|
|
|
| - childDepth: Number,
|
| + childDepth: Number,
|
|
|
| - childrenShown: {
|
| - type: Boolean,
|
| - reflectToAttribute: true,
|
| - value: false
|
| - },
|
| + childrenShown: {type: Boolean, reflectToAttribute: true, value: false},
|
|
|
| - keyEventTarget: {
|
| - type: Object,
|
| - value: function() {
|
| - return this.$.item;
|
| - }
|
| + keyEventTarget: {
|
| + type: Object,
|
| + value: function() {
|
| + return this.$.item;
|
| }
|
| - },
|
| -
|
| - behaviors: [
|
| - Polymer.IronA11yKeysBehavior
|
| - ],
|
| + }
|
| + },
|
|
|
| - keyBindings: {
|
| - 'enter': 'onEnter_',
|
| - 'space': 'onSpace_'
|
| - },
|
| + behaviors: [Polymer.IronA11yKeysBehavior],
|
|
|
| - bookmarkChanged_: function() {
|
| - this.$.expand.style.visibility =
|
| - this.bookmark.children.length > 0 ? 'visible' : 'hidden';
|
| - },
|
| + keyBindings: {'enter': 'onEnter_', 'space': 'onSpace_'},
|
|
|
| - depthChanged: function() {
|
| - this.childDepth = this.depth + 1;
|
| - this.$.item.style.webkitPaddingStart =
|
| - (this.depth * BOOKMARK_INDENT) + 'px';
|
| - },
|
| + bookmarkChanged_: function() {
|
| + this.$.expand.style.visibility =
|
| + this.bookmark.children.length > 0 ? 'visible' : 'hidden';
|
| + },
|
|
|
| - onClick: function() {
|
| - if (this.bookmark.hasOwnProperty('page'))
|
| - this.fire('change-page', {page: this.bookmark.page});
|
| - else if (this.bookmark.hasOwnProperty('uri'))
|
| - this.fire('navigate', {uri: this.bookmark.uri, newtab: true});
|
| - },
|
| + depthChanged: function() {
|
| + this.childDepth = this.depth + 1;
|
| + this.$.item.style.webkitPaddingStart =
|
| + (this.depth * BOOKMARK_INDENT) + 'px';
|
| + },
|
|
|
| - onEnter_: function(e) {
|
| - // Don't allow events which have propagated up from the expand button to
|
| - // trigger a click.
|
| - if (e.detail.keyboardEvent.target != this.$.expand)
|
| - this.onClick();
|
| - },
|
| + onClick: function() {
|
| + if (this.bookmark.hasOwnProperty('page'))
|
| + this.fire('change-page', {page: this.bookmark.page});
|
| + else if (this.bookmark.hasOwnProperty('uri'))
|
| + this.fire('navigate', {uri: this.bookmark.uri, newtab: true});
|
| + },
|
|
|
| - onSpace_: function(e) {
|
| - // paper-icon-button stops propagation of space events, so there's no need
|
| - // to check the event source here.
|
| + onEnter_: function(e) {
|
| + // Don't allow events which have propagated up from the expand button to
|
| + // trigger a click.
|
| + if (e.detail.keyboardEvent.target != this.$.expand)
|
| this.onClick();
|
| - // Prevent default space scroll behavior.
|
| - e.detail.keyboardEvent.preventDefault();
|
| - },
|
| + },
|
|
|
| - toggleChildren: function(e) {
|
| - this.childrenShown = !this.childrenShown;
|
| - e.stopPropagation(); // Prevent the above onClick handler from firing.
|
| - }
|
| - });
|
| + onSpace_: function(e) {
|
| + // paper-icon-button stops propagation of space events, so there's no need
|
| + // to check the event source here.
|
| + this.onClick();
|
| + // Prevent default space scroll behavior.
|
| + e.detail.keyboardEvent.preventDefault();
|
| + },
|
| +
|
| + toggleChildren: function(e) {
|
| + this.childrenShown = !this.childrenShown;
|
| + e.stopPropagation(); // Prevent the above onClick handler from firing.
|
| + }
|
| +});
|
| })();
|
|
|