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

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

Issue 1401633002: Update Polymer from 1.1.4 -> 1.1.5 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dzhioev@ review 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 side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/v1_0/components-chromium/paper-ripple/paper-ripple-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/paper-ripple/paper-ripple-extracted.js b/third_party/polymer/v1_0/components-chromium/paper-ripple/paper-ripple-extracted.js
index 655f301aad988dd956379d6ca47a109c99a75210..669095974664d76256b26d495ef9e77cbe6caca2 100644
--- a/third_party/polymer/v1_0/components-chromium/paper-ripple/paper-ripple-extracted.js
+++ b/third_party/polymer/v1_0/components-chromium/paper-ripple/paper-ripple-extracted.js
@@ -1,5 +1,4 @@
-
- (function() {
+(function() {
var Utility = {
distance: function(x1, y1, x2, y2) {
var xDelta = (x1 - x2);
@@ -377,6 +376,17 @@
observer: '_holdDownChanged'
},
+ /**
+ * If true, the ripple will not generate a ripple effect
+ * via pointer interaction.
+ * Calling ripple's imperative api like `simulatedRipple` will
+ * still generate the ripple effect.
+ */
+ noink: {
+ type: Boolean,
+ value: false
+ },
+
_animating: {
type: Boolean
},
@@ -389,6 +399,10 @@
}
},
+ observers: [
+ '_noinkChanged(noink, isAttached)'
+ ],
+
get target () {
var ownerRoot = Polymer.dom(this).getOwnerRoot();
var target;
@@ -409,12 +423,13 @@
},
attached: function() {
- this.listen(this.target, 'up', 'upAction');
- this.listen(this.target, 'down', 'downAction');
+ this.listen(this.target, 'up', 'uiUpAction');
+ this.listen(this.target, 'down', 'uiDownAction');
+ },
- if (!this.target.hasAttribute('noink')) {
- this.keyEventTarget = this.target;
- }
+ detached: function() {
+ this.unlisten(this.target, 'up', 'uiUpAction');
+ this.unlisten(this.target, 'down', 'uiDownAction');
},
get shouldKeepAnimating () {
@@ -436,7 +451,22 @@
}, 1);
},
- /** @param {Event=} event */
+ /**
+ * Provokes a ripple down effect via a UI event,
+ * respecting the `noink` property.
+ * @param {Event=} event
+ */
+ uiDownAction: function(event) {
+ if (!this.noink) {
+ this.downAction(event);
+ }
+ },
+
+ /**
+ * Provokes a ripple down effect via a UI event,
+ * *not* respecting the `noink` property.
+ * @param {Event=} event
+ */
downAction: function(event) {
if (this.holdDown && this.ripples.length > 0) {
return;
@@ -451,7 +481,22 @@
}
},
- /** @param {Event=} event */
+ /**
+ * Provokes a ripple up effect via a UI event,
+ * respecting the `noink` property.
+ * @param {Event=} event
+ */
+ uiUpAction: function(event) {
+ if (!this.noink) {
+ this.upAction(event);
+ }
+ },
+
+ /**
+ * Provokes a ripple up effect via a UI event,
+ * *not* respecting the `noink` property.
+ * @param {Event=} event
+ */
upAction: function(event) {
if (this.holdDown) {
return;
@@ -524,24 +569,35 @@
},
_onEnterKeydown: function() {
- this.downAction();
- this.async(this.upAction, 1);
+ this.uiDownAction();
+ this.async(this.uiUpAction, 1);
},
_onSpaceKeydown: function() {
- this.downAction();
+ this.uiDownAction();
},
_onSpaceKeyup: function() {
- this.upAction();
+ this.uiUpAction();
},
- _holdDownChanged: function(holdDown) {
- if (holdDown) {
+ // note: holdDown does not respect noink since it can be a focus based
+ // effect.
+ _holdDownChanged: function(newVal, oldVal) {
+ if (oldVal === undefined) {
+ return;
+ }
+ if (newVal) {
this.downAction();
} else {
this.upAction();
}
+ },
+
+ _noinkChanged: function(noink, attached) {
+ if (attached) {
+ this.keyEventTarget = noink ? this : this.target;
+ }
}
});
- })();
+ })();

Powered by Google App Engine
This is Rietveld 408576698