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

Side by Side Diff: chrome/browser/resources/pdf/elements/viewer-toolbar-dropdown/viewer-toolbar-dropdown.js

Issue 1369163002: Material PDF: Drastically reduce time required to stamp complex bookmark trees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
OLDNEW
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 /** 6 /**
7 * Size of additional padding in the inner scrollable section of the dropdown. 7 * Size of additional padding in the inner scrollable section of the dropdown.
8 */ 8 */
9 var DROPDOWN_INNER_PADDING = 12; 9 var DROPDOWN_INNER_PADDING = 12;
10 10
(...skipping 12 matching lines...) Expand all
23 23
24 /** Icon to display when the dropdown is closed. */ 24 /** Icon to display when the dropdown is closed. */
25 closedIcon: String, 25 closedIcon: String,
26 26
27 /** Icon to display when the dropdown is open. */ 27 /** Icon to display when the dropdown is open. */
28 openIcon: String, 28 openIcon: String,
29 29
30 /** True if the dropdown is currently open. */ 30 /** True if the dropdown is currently open. */
31 dropdownOpen: { 31 dropdownOpen: {
32 type: Boolean, 32 type: Boolean,
33 reflectToAttribute: true,
33 value: false 34 value: false
34 }, 35 },
35 36
36 /** Toolbar icon currently being displayed. */ 37 /** Toolbar icon currently being displayed. */
37 dropdownIcon: { 38 dropdownIcon: {
38 type: String, 39 type: String,
39 computed: 'computeIcon_(dropdownOpen, closedIcon, openIcon)' 40 computed: 'computeIcon_(dropdownOpen, closedIcon, openIcon)'
40 }, 41 },
41 42
42 /** Lowest vertical point that the dropdown should occupy (px). */ 43 /** Lowest vertical point that the dropdown should occupy (px). */
(...skipping 19 matching lines...) Expand all
62 63
63 lowerBoundChanged_: function() { 64 lowerBoundChanged_: function() {
64 this.maxHeightValid_ = false; 65 this.maxHeightValid_ = false;
65 if (this.dropdownOpen) 66 if (this.dropdownOpen)
66 this.updateMaxHeight(); 67 this.updateMaxHeight();
67 }, 68 },
68 69
69 toggleDropdown: function() { 70 toggleDropdown: function() {
70 this.dropdownOpen = !this.dropdownOpen; 71 this.dropdownOpen = !this.dropdownOpen;
71 if (this.dropdownOpen) { 72 if (this.dropdownOpen) {
72 this.$.icon.classList.add('open');
73 this.$.dropdown.style.display = 'block'; 73 this.$.dropdown.style.display = 'block';
74 if (!this.maxHeightValid_) 74 if (!this.maxHeightValid_)
75 this.updateMaxHeight(); 75 this.updateMaxHeight();
76 } else {
77 this.$.icon.classList.remove('open');
78 } 76 }
79 this.cancelAnimation_(); 77 this.cancelAnimation_();
80 this.playAnimation_(this.dropdownOpen); 78 this.playAnimation_(this.dropdownOpen);
81 }, 79 },
82 80
83 updateMaxHeight: function() { 81 updateMaxHeight: function() {
84 var scrollContainer = this.$['scroll-container']; 82 var scrollContainer = this.$['scroll-container'];
85 var height = this.lowerBound - 83 var height = this.lowerBound -
86 scrollContainer.getBoundingClientRect().top - 84 scrollContainer.getBoundingClientRect().top -
87 DROPDOWN_INNER_PADDING; 85 DROPDOWN_INNER_PADDING;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 129
132 animateExit_: function() { 130 animateExit_: function() {
133 return this.$.dropdown.animate([ 131 return this.$.dropdown.animate([
134 {transform: 'translateY(0)', opacity: 1}, 132 {transform: 'translateY(0)', opacity: 1},
135 {transform: 'translateY(-5px)', opacity: 0} 133 {transform: 'translateY(-5px)', opacity: 0}
136 ], {duration: 100, easing: 'cubic-bezier(0.4, 0, 1, 1)'}); 134 ], {duration: 100, easing: 'cubic-bezier(0.4, 0, 1, 1)'});
137 } 135 }
138 }); 136 });
139 137
140 })(); 138 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698