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

Unified Diff: chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js
diff --git a/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js b/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js
index d4e8cbd663715bd798986356528b11b0a46e62fb..07b03909149a94ba93e898f527b6ba0c66eb6ae0 100644
--- a/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js
+++ b/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.js
@@ -2,145 +2,126 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(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,
-
- /**
- * Whether the toolbar is opened and visible.
- */
- opened: {
- type: Boolean,
- value: true
- },
-
- strings: Object,
-
- animationConfig: {
- value: function() {
- return {
- 'entry': {
- name: 'transform-animation',
- node: this,
- transformFrom: 'translateY(-100%)',
- transformTo: 'translateY(0%)',
- 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
- }
- }
- };
- }
+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,
+
+ /**
+ * Whether the toolbar is opened and visible.
+ */
+ opened: {type: Boolean, value: true},
+
+ strings: Object,
+
+ animationConfig: {
+ value: function() {
+ return {
+ 'entry': {
+ name: 'transform-animation',
+ node: this,
+ transformFrom: 'translateY(-100%)',
+ transformTo: 'translateY(0%)',
+ 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'
- },
+ listeners: {'neon-animation-finish': '_onAnimationFinished'},
- _onAnimationFinished: function() {
- this.style.transform = this.opened ? 'none' : 'translateY(-100%)';
- },
+ _onAnimationFinished: function() {
+ this.style.transform = this.opened ? 'none' : 'translateY(-100%)';
+ },
- loadProgressChanged: function() {
- if (this.loadProgress >= 100) {
- this.$.pageselector.classList.toggle('invisible', false);
- this.$.buttons.classList.toggle('invisible', false);
- this.$.progress.style.opacity = 0;
- }
- },
+ loadProgressChanged: function() {
+ if (this.loadProgress >= 100) {
+ this.$.pageselector.classList.toggle('invisible', false);
+ this.$.buttons.classList.toggle('invisible', false);
+ this.$.progress.style.opacity = 0;
+ }
+ },
- hide: function() {
- if (this.opened)
- this.toggleVisibility();
- },
+ hide: function() {
+ if (this.opened)
+ this.toggleVisibility();
+ },
- show: function() {
- if (!this.opened) {
- this.toggleVisibility();
- }
- },
-
- toggleVisibility: function() {
- this.opened = !this.opened;
- this.cancelAnimation();
- this.playAnimation(this.opened ? 'entry' : 'exit');
- },
-
- selectPageNumber: function() {
- this.$.pageselector.select();
- },
-
- shouldKeepOpen: function() {
- return this.$.bookmarks.dropdownOpen || this.loadProgress < 100 ||
- this.$.pageselector.isActive();
- },
-
- hideDropdowns: function() {
- if (this.$.bookmarks.dropdownOpen) {
- this.$.bookmarks.toggleDropdown();
- return true;
- }
- return false;
- },
+ show: function() {
+ if (!this.opened) {
+ this.toggleVisibility();
+ }
+ },
+
+ toggleVisibility: function() {
+ this.opened = !this.opened;
+ this.cancelAnimation();
+ this.playAnimation(this.opened ? 'entry' : 'exit');
+ },
+
+ selectPageNumber: function() {
+ this.$.pageselector.select();
+ },
+
+ shouldKeepOpen: function() {
+ return this.$.bookmarks.dropdownOpen || this.loadProgress < 100 ||
+ this.$.pageselector.isActive();
+ },
+
+ hideDropdowns: function() {
+ if (this.$.bookmarks.dropdownOpen) {
+ this.$.bookmarks.toggleDropdown();
+ return true;
+ }
+ return false;
+ },
- setDropdownLowerBound: function(lowerBound) {
- this.$.bookmarks.lowerBound = lowerBound;
- },
+ setDropdownLowerBound: function(lowerBound) {
+ this.$.bookmarks.lowerBound = lowerBound;
+ },
- rotateRight: function() {
- this.fire('rotate-right');
- },
+ rotateRight: function() {
+ this.fire('rotate-right');
+ },
- download: function() {
- this.fire('save');
- },
+ download: function() {
+ this.fire('save');
+ },
- print: function() {
- this.fire('print');
- }
- });
+ print: function() {
+ this.fire('print');
+ }
+});
})();

Powered by Google App Engine
This is Rietveld 408576698