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

Unified Diff: third_party/polymer/v1_0/components-chromium/paper-menu-button/paper-menu-button-extracted.js

Issue 2158913007: Roll Polymer from 1.5.0 -> 1.6.0 to pick up native CSS custom props (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 5 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/paper-menu-button/paper-menu-button-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/paper-menu-button/paper-menu-button-extracted.js b/third_party/polymer/v1_0/components-chromium/paper-menu-button/paper-menu-button-extracted.js
index 67ef7b0ebc0a816869932da7939bd8fedcc72a20..c8d2c71459ac3bd5ade2f01851ede37b71b8b900 100644
--- a/third_party/polymer/v1_0/components-chromium/paper-menu-button/paper-menu-button-extracted.js
+++ b/third_party/polymer/v1_0/components-chromium/paper-menu-button/paper-menu-button-extracted.js
@@ -1,6 +1,11 @@
(function() {
'use strict';
+ var config = {
+ ANIMATION_CUBIC_BEZIER: 'cubic-bezier(.3,.95,.5,1)',
+ MAX_ANIMATION_TIME_MS: 400
+ };
+
var PaperMenuButton = Polymer({
is: 'paper-menu-button',
@@ -53,6 +58,16 @@
},
/**
+ * If true, the `horizontalAlign` and `verticalAlign` properties will
+ * be considered preferences instead of strict requirements when
+ * positioning the dropdown and may be changed if doing so reduces
+ * the area of the dropdown falling outside of `fitInto`.
+ */
+ dynamicAlign: {
+ type: Boolean
+ },
+
+ /**
* A pixel value that will be added to the position calculated for the
* given `horizontalAlign`. Use a negative value to offset to the
* left, or a positive value to offset to the right.
@@ -75,6 +90,14 @@
},
/**
+ * If true, the dropdown will be positioned so that it doesn't overlap
+ * the button.
+ */
+ noOverlap: {
+ type: Boolean
+ },
+
+ /**
* Set to true to disable animations when opening and closing the
* dropdown.
*/
@@ -93,6 +116,15 @@
},
/**
+ * Set to true to enable automatically closing the dropdown after an
+ * item has been activated, even if the selection did not change.
+ */
+ closeOnActivate: {
+ type: Boolean,
+ value: false
+ },
+
+ /**
* An animation config. If provided, this will be used to animate the
* opening of the dropdown.
*/
@@ -110,14 +142,14 @@
timing: {
delay: 100,
duration: 150,
- easing: PaperMenuButton.ANIMATION_CUBIC_BEZIER
+ easing: config.ANIMATION_CUBIC_BEZIER
}
}, {
name: 'paper-menu-grow-height-animation',
timing: {
delay: 100,
duration: 275,
- easing: PaperMenuButton.ANIMATION_CUBIC_BEZIER
+ easing: config.ANIMATION_CUBIC_BEZIER
}
}];
}
@@ -140,7 +172,7 @@
timing: {
delay: 100,
duration: 50,
- easing: PaperMenuButton.ANIMATION_CUBIC_BEZIER
+ easing: config.ANIMATION_CUBIC_BEZIER
}
}, {
name: 'paper-menu-shrink-height-animation',
@@ -151,6 +183,17 @@
}];
}
},
+
+ /**
+ * By default, the dropdown will constrain scrolling on the page
+ * to itself when opened.
+ * Set to true in order to prevent scroll from being constrained
+ * to the dropdown when it opens.
+ */
+ allowOutsideScroll: {
+ type: Boolean,
+ value: false
+ },
/**
* This is the element intended to be bound as the focus target
@@ -167,6 +210,7 @@
},
listeners: {
+ 'iron-activate': '_onIronActivate',
'iron-select': '_onIronSelect'
},
@@ -221,6 +265,18 @@
},
/**
+ * Closes the dropdown when an `iron-activate` event is received if
+ * `closeOnActivate` is true.
+ *
+ * @param {CustomEvent} event A CustomEvent of type 'iron-activate'.
+ */
+ _onIronActivate: function(event) {
+ if (this.closeOnActivate) {
+ this.close();
+ }
+ },
+
+ /**
* When the dropdown opens, the `paper-menu-button` fires `paper-open`.
* When the dropdown closes, the `paper-menu-button` fires `paper-close`.
*
@@ -266,8 +322,9 @@
}
});
- PaperMenuButton.ANIMATION_CUBIC_BEZIER = 'cubic-bezier(.3,.95,.5,1)';
- PaperMenuButton.MAX_ANIMATION_TIME_MS = 400;
+ Object.keys(config).forEach(function (key) {
+ PaperMenuButton[key] = config[key];
+ });
Polymer.PaperMenuButton = PaperMenuButton;
})();

Powered by Google App Engine
This is Rietveld 408576698