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

Unified 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 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 df3d392b22609d33dcfe1812bd16e8a65cf2568f..9e5f2aa6f5b7772555c95321167e71254f7b8cdb 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
@@ -86,7 +86,7 @@ Polymer({
this._updateTransition(false);
// If we can animate, must do some prep work.
- if (animated && !this.noAnimation) {
+ if (animated && !this.noAnimation && this._isDisplayed) {
// Animation will start at the current size.
var startSize = this._calcSize();
// For `auto` we must calculate what is the final size for the animation.
@@ -157,6 +157,19 @@ Polymer({
this.notifyResize();
},
+ /**
+ * Simplistic heuristic to detect if element has a parent with display: none
+ *
+ * @private
+ */
+ get _isDisplayed() {
+ var rect = this.getBoundingClientRect();
+ for (var prop in rect) {
+ if (rect[prop] !== 0) return true;
+ }
+ return false;
+ },
+
_calcSize: function() {
return this.getBoundingClientRect()[this.dimension] + 'px';
}

Powered by Google App Engine
This is Rietveld 408576698