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

Side by Side Diff: third_party/polymer/v1_0/components-chromium/iron-collapse/iron-collapse-extracted.js

Issue 1862213002: Roll third_party/polymer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove obsolete appearance_browsertest.js, result of a previous bad merge. Created 4 years, 8 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 Polymer({ 1 Polymer({
2 2
3 is: 'iron-collapse', 3 is: 'iron-collapse',
4 4
5 behaviors: [ 5 behaviors: [
6 Polymer.IronResizableBehavior 6 Polymer.IronResizableBehavior
7 ], 7 ],
8 8
9 properties: { 9 properties: {
10 10
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 }, 79 },
80 80
81 updateSize: function(size, animated) { 81 updateSize: function(size, animated) {
82 // No change! 82 // No change!
83 if (this.style[this.dimension] === size) { 83 if (this.style[this.dimension] === size) {
84 return; 84 return;
85 } 85 }
86 86
87 this._updateTransition(false); 87 this._updateTransition(false);
88 // If we can animate, must do some prep work. 88 // If we can animate, must do some prep work.
89 if (animated && !this.noAnimation) { 89 if (animated && !this.noAnimation && this._isDisplayed) {
90 // Animation will start at the current size. 90 // Animation will start at the current size.
91 var startSize = this._calcSize(); 91 var startSize = this._calcSize();
92 // For `auto` we must calculate what is the final size for the animation . 92 // For `auto` we must calculate what is the final size for the animation .
93 // After the transition is done, _transitionEnd will set the size back t o `auto`. 93 // After the transition is done, _transitionEnd will set the size back t o `auto`.
94 if (size === 'auto') { 94 if (size === 'auto') {
95 this.style[this.dimension] = size; 95 this.style[this.dimension] = size;
96 size = this._calcSize(); 96 size = this._calcSize();
97 } 97 }
98 // Go to startSize without animation. 98 // Go to startSize without animation.
99 this.style[this.dimension] = startSize; 99 this.style[this.dimension] = startSize;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 _transitionEnd: function() { 150 _transitionEnd: function() {
151 if (this.opened) { 151 if (this.opened) {
152 this.style[this.dimension] = 'auto'; 152 this.style[this.dimension] = 'auto';
153 } 153 }
154 this.toggleClass('iron-collapse-closed', !this.opened); 154 this.toggleClass('iron-collapse-closed', !this.opened);
155 this.toggleClass('iron-collapse-opened', this.opened); 155 this.toggleClass('iron-collapse-opened', this.opened);
156 this._updateTransition(false); 156 this._updateTransition(false);
157 this.notifyResize(); 157 this.notifyResize();
158 }, 158 },
159 159
160 /**
161 * Simplistic heuristic to detect if element has a parent with display: none
162 *
163 * @private
164 */
165 get _isDisplayed() {
166 var rect = this.getBoundingClientRect();
167 for (var prop in rect) {
168 if (rect[prop] !== 0) return true;
169 }
170 return false;
171 },
172
160 _calcSize: function() { 173 _calcSize: function() {
161 return this.getBoundingClientRect()[this.dimension] + 'px'; 174 return this.getBoundingClientRect()[this.dimension] + 'px';
162 } 175 }
163 176
164 }); 177 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698