diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-08-14 11:38:45 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-08-14 17:16:47 +0000 |
commit | 3a97ca8dd9b96b599ae2d33e40df0dd2f7ea5859 (patch) | |
tree | 43cc572ba067417c7341db81f71ae7cc6e0fcc3e /chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js | |
parent | f61ab1ac7f855cd281809255c0aedbb1895e1823 (diff) |
BASELINE: Update chromium to 45.0.2454.40
Change-Id: Id2121d9f11a8fc633677236c65a3e41feef589e4
Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
Diffstat (limited to 'chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js')
-rw-r--r-- | chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js | 139 |
1 files changed, 95 insertions, 44 deletions
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js b/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js index b291f62348e..62e5cf9a5ec 100644 --- a/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js +++ b/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js @@ -2,45 +2,84 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. (function() { - Polymer('viewer-pdf-toolbar', { - /** - * @type {string} - * The title of the PDF document. - */ - docTitle: '', - - /** - * @type {number} - * The current index of the page being viewed (0-based). - */ - pageIndex: 0, - - /** - * @type {number} - * The current loading progress of the PDF document (0 - 100). - */ - loadProgress: 0, - - /** - * @type {boolean} - * Whether the document has bookmarks. - */ - hasBookmarks: false, - - /** - * @type {number} - * The number of pages in the PDF document. - */ - docLength: 1, - - ready: function() { + Polymer({ + is: 'viewer-pdf-toolbar', + + behaviors: [ + Polymer.NeonAnimationRunnerBehavior + ], + + properties: { + /** + * The current loading progress of the PDF document (0 - 100). + */ + loadProgress: { + type: Number, + observer: 'loadProgressChanged' + }, + + /** + * The title of the PDF document. + */ + docTitle: String, + + /** + * The number of the page being viewed (1-based). + */ + pageNo: Number, + + /** + * Tree of PDF bookmarks (or null if the document has no bookmarks). + */ + bookmarks: { + type: Object, + value: null + }, + + /** + * The number of pages in the PDF document. + */ + docLength: Number, + /** - * @type {Object} - * Used in core-transition to determine whether the animatable is open. - * TODO(tsergeant): Add core-transition back in once it is in Polymer 0.8. + * Whether the toolbar is opened and visible. */ - this.state_ = { opened: false }; - this.show(); + opened: { + type: Boolean, + value: true + }, + + animationConfig: { + value: function() { + return { + 'entry': { + name: 'slide-down-animation', + node: this, + timing: { + easing: 'cubic-bezier(0, 0, 0.2, 1)', + duration: 250 + } + }, + 'exit': { + name: 'slide-up-animation', + node: this, + timing: { + easing: 'cubic-bezier(0.4, 0, 1, 1)', + duration: 250 + } + } + }; + } + } + }, + + listeners: { + 'neon-animation-finish': '_onAnimationFinished' + }, + + _onAnimationFinished: function() { + if (!this.opened) + this.style.visibility = 'hidden'; }, loadProgressChanged: function() { @@ -52,29 +91,41 @@ }, hide: function() { - if (this.state_.opened) + if (this.opened) this.toggleVisibility(); }, show: function() { - if (!this.state_.opened) + if (!this.opened) { this.toggleVisibility(); + this.style.visibility = 'initial'; + } }, toggleVisibility: function() { - this.state_.opened = !this.state_.opened; + this.opened = !this.opened; + this.cancelAnimation(); + this.playAnimation(this.opened ? 'entry' : 'exit'); }, selectPageNumber: function() { this.$.pageselector.select(); }, - rotateRight: function() { - this.fire('rotate-right'); + shouldKeepOpen: function() { + return this.$.bookmarks.dropdownOpen || this.loadProgress < 100; + }, + + setDropdownLowerBound: function(lowerBound) { + this.$.bookmarks.lowerBound = lowerBound; }, - toggleBookmarks: function() { - this.fire('toggle-bookmarks'); + rotateLeft: function() { + this.fire('rotate-left'); + }, + + rotateRight: function() { + this.fire('rotate-right'); }, save: function() { |