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

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

Issue 2074813002: Roll Polymer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: chromium.patch Created 4 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: third_party/polymer/v1_0/components-chromium/iron-collapse/iron-collapse-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/iron-collapse/iron-collapse-extracted.js b/third_party/polymer/v1_0/components-chromium/iron-collapse/iron-collapse-extracted.js
index 9e5f2aa6f5b7772555c95321167e71254f7b8cdb..394a0184993009957f46f2ec14db2e147ef280e4 100644
--- a/third_party/polymer/v1_0/components-chromium/iron-collapse/iron-collapse-extracted.js
+++ b/third_party/polymer/v1_0/components-chromium/iron-collapse/iron-collapse-extracted.js
@@ -46,6 +46,22 @@ Polymer({
return this.horizontal ? 'width' : 'height';
},
+ /**
+ * `maxWidth` or `maxHeight`.
+ * @private
+ */
+ get _dimensionMax() {
+ return this.horizontal ? 'maxWidth' : 'maxHeight';
+ },
+
+ /**
+ * `max-width` or `max-height`.
+ * @private
+ */
+ get _dimensionMaxCss() {
+ return this.horizontal ? 'max-width' : 'max-height';
+ },
+
hostAttributes: {
role: 'group',
'aria-hidden': 'true',
@@ -78,9 +94,15 @@ Polymer({
this.opened = false;
},
+ /**
+ * Updates the size of the element.
+ * @param {string} size The new value for `maxWidth`/`maxHeight` as css property value, usually `auto` or `0px`.
+ * @param {boolean=} animated if `true` updates the size with an animation, otherwise without.
+ */
updateSize: function(size, animated) {
// No change!
- if (this.style[this.dimension] === size) {
+ var curSize = this.style[this._dimensionMax];
+ if (curSize === size || (size === 'auto' && !curSize)) {
return;
}
@@ -92,11 +114,11 @@ Polymer({
// For `auto` we must calculate what is the final size for the animation.
// After the transition is done, _transitionEnd will set the size back to `auto`.
if (size === 'auto') {
- this.style[this.dimension] = size;
+ this.style[this._dimensionMax] = '';
size = this._calcSize();
}
// Go to startSize without animation.
- this.style[this.dimension] = startSize;
+ this.style[this._dimensionMax] = startSize;
// Force layout to ensure transition will go. Set offsetHeight to itself
// so that compilers won't remove it.
this.offsetHeight = this.offsetHeight;
@@ -104,7 +126,11 @@ Polymer({
this._updateTransition(true);
}
// Set the final size.
- this.style[this.dimension] = size;
+ if (size === 'auto') {
+ this.style[this._dimensionMax] = '';
+ } else {
+ this.style[this._dimensionMax] = size;
+ }
},
/**
@@ -115,7 +141,7 @@ Polymer({
* @deprecated since version 1.0.4
*/
enableTransition: function(enabled) {
- console.warn('`enableTransition()` is deprecated, use `noAnimation` instead.');
+ Polymer.Base._warn('`enableTransition()` is deprecated, use `noAnimation` instead.');
this.noAnimation = !enabled;
},
@@ -124,8 +150,8 @@ Polymer({
},
_horizontalChanged: function() {
- this.style.transitionProperty = this.dimension;
- var otherDimension = this.dimension === 'width' ? 'height' : 'width';
+ this.style.transitionProperty = this._dimensionMaxCss;
+ var otherDimension = this._dimensionMax === 'maxWidth' ? 'maxHeight' : 'maxWidth';
this.style[otherDimension] = '';
this.updateSize(this.opened ? 'auto' : '0px', false);
},
@@ -149,7 +175,7 @@ Polymer({
_transitionEnd: function() {
if (this.opened) {
- this.style[this.dimension] = 'auto';
+ this.style[this._dimensionMax] = '';
}
this.toggleClass('iron-collapse-closed', !this.opened);
this.toggleClass('iron-collapse-opened', this.opened);
@@ -174,4 +200,4 @@ Polymer({
return this.getBoundingClientRect()[this.dimension] + 'px';
}
- });
+ });

Powered by Google App Engine
This is Rietveld 408576698