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

Unified Diff: third_party/polymer/v1_0/components-chromium/paper-tooltip/paper-tooltip-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-tooltip/paper-tooltip-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/paper-tooltip/paper-tooltip-extracted.js b/third_party/polymer/v1_0/components-chromium/paper-tooltip/paper-tooltip-extracted.js
index 06535a32d5f194f8683d72dbf94ec5b03a4446a4..7946ae48b46d315f1c8bd0df467fc86ef37d3901 100644
--- a/third_party/polymer/v1_0/components-chromium/paper-tooltip/paper-tooltip-extracted.js
+++ b/third_party/polymer/v1_0/components-chromium/paper-tooltip/paper-tooltip-extracted.js
@@ -1,5 +1,4 @@
-
- Polymer({
+Polymer({
is: 'paper-tooltip',
hostAttributes: {
@@ -57,6 +56,20 @@
value: 14
},
+ /**
+ * The delay that will be applied before the `entry` animation is
+ * played when showing the tooltip.
+ */
+ animationDelay: {
+ type: Number,
+ value: 500
+ },
+
+ /**
+ * The entry and exit animations that will be played when showing and
+ * hiding the tooltip. If you want to override this, you must ensure
+ * that your animationConfig has the exact format below.
+ */
animationConfig: {
type: Object,
value: function() {
@@ -64,7 +77,7 @@
'entry': [{
name: 'fade-in-animation',
node: this,
- timing: {delay: 500}
+ timing: {delay: 0}
}],
'exit': [{
name: 'fade-out-animation',
@@ -81,7 +94,8 @@
},
listeners: {
- 'neon-animation-finish': '_onAnimationFinish'
+ 'neon-animation-finish': '_onAnimationFinish',
+ 'mouseenter': 'hide'
},
/**
@@ -112,6 +126,7 @@
this.listen(this._target, 'focus', 'show');
this.listen(this._target, 'mouseleave', 'hide');
this.listen(this._target, 'blur', 'hide');
+ this.listen(this._target, 'tap', 'hide');
},
detached: function() {
@@ -120,30 +135,46 @@
this.unlisten(this._target, 'focus', 'show');
this.unlisten(this._target, 'mouseleave', 'hide');
this.unlisten(this._target, 'blur', 'hide');
+ this.unlisten(this._target, 'tap', 'hide');
}
},
show: function() {
+ // If the tooltip is already showing, there's nothing to do.
if (this._showing)
return;
if (Polymer.dom(this).textContent.trim() === '')
return;
- this.cancelAnimation();
+ this.cancelAnimation();
+ this._showing = true;
this.toggleClass('hidden', false, this.$.tooltip);
this.updatePosition();
- this._showing = true;
+ this.animationConfig.entry[0].timing.delay = this.animationDelay;
+ this._animationPlaying = true;
this.playAnimation('entry');
},
hide: function() {
- if (!this._showing)
+ // If the tooltip is already hidden, there's nothing to do.
+ if (!this._showing) {
return;
+ }
+
+ // If the entry animation is still playing, don't try to play the exit
+ // animation since this will reset the opacity to 1. Just end the animation.
+ if (this._animationPlaying) {
+ this.cancelAnimation();
+ this._showing = false;
+ this._onAnimationFinish();
+ return;
+ }
this._showing = false;
+ this._animationPlaying = true;
this.playAnimation('exit');
},
@@ -218,9 +249,9 @@
},
_onAnimationFinish: function() {
+ this._animationPlaying = false;
if (!this._showing) {
this.toggleClass('hidden', true, this.$.tooltip);
}
},
- });
-
+ });

Powered by Google App Engine
This is Rietveld 408576698