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

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

Issue 2321883004: Roll paper-tooltip to pick up some changes I made to it (Closed)
Patch Set: Created 4 years, 3 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 ed84ac2f51a755320f4281e4f0868f7fa50f525c..536a2b8d35693ab1b3fadb28c022de1a2929e3f1 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
@@ -17,7 +17,7 @@ Polymer({
*/
for: {
type: String,
- observer: '_forChanged'
+ observer: '_findTarget'
},
/**
@@ -26,7 +26,8 @@ Polymer({
*/
manualMode: {
type: Boolean,
- value: false
+ value: false,
+ observer: '_manualModeChanged'
},
/**
@@ -104,7 +105,6 @@ Polymer({
listeners: {
'neon-animation-finish': '_onAnimationFinish',
- 'mouseenter': 'hide'
},
/**
@@ -129,26 +129,12 @@ Polymer({
},
attached: function() {
- this._target = this.target;
-
- if (this.manualMode)
- return;
-
- this.listen(this._target, 'mouseenter', 'show');
- this.listen(this._target, 'focus', 'show');
- this.listen(this._target, 'mouseleave', 'hide');
- this.listen(this._target, 'blur', 'hide');
- this.listen(this._target, 'tap', 'hide');
+ this._findTarget();
},
detached: function() {
- if (this._target && !this.manualMode) {
- this.unlisten(this._target, 'mouseenter', 'show');
- this.unlisten(this._target, 'focus', 'show');
- this.unlisten(this._target, 'mouseleave', 'hide');
- this.unlisten(this._target, 'blur', 'hide');
- this.unlisten(this._target, 'tap', 'hide');
- }
+ if (!this.manualMode)
+ this._removeListeners();
},
show: function() {
@@ -165,6 +151,7 @@ Polymer({
this.toggleClass('hidden', false, this.$.tooltip);
this.updatePosition();
+ this.animationConfig.entry[0].timing = this.animationConfig.entry[0].timing || {};
this.animationConfig.entry[0].timing.delay = this.animationDelay;
this._animationPlaying = true;
this.playAnimation('entry');
@@ -190,10 +177,6 @@ Polymer({
this.playAnimation('exit');
},
- _forChanged: function() {
- this._target = this.target;
- },
-
updatePosition: function() {
if (!this._target || !this.offsetParent)
return;
@@ -260,10 +243,49 @@ Polymer({
},
+ _addListeners: function() {
+ if (this._target) {
+ this.listen(this._target, 'mouseenter', 'show');
+ this.listen(this._target, 'focus', 'show');
+ this.listen(this._target, 'mouseleave', 'hide');
+ this.listen(this._target, 'blur', 'hide');
+ this.listen(this._target, 'tap', 'hide');
+ }
+ this.listen(this, 'mouseenter', 'hide');
+ },
+
+ _findTarget: function() {
+ if (!this.manualMode)
+ this._removeListeners();
+
+ this._target = this.target;
+
+ if (!this.manualMode)
+ this._addListeners();
+ },
+
+ _manualModeChanged: function() {
+ if (this.manualMode)
+ this._removeListeners();
+ else
+ this._addListeners();
+ },
+
_onAnimationFinish: function() {
this._animationPlaying = false;
if (!this._showing) {
this.toggleClass('hidden', true, this.$.tooltip);
}
},
+
+ _removeListeners: function() {
+ if (this._target) {
+ this.unlisten(this._target, 'mouseenter', 'show');
+ this.unlisten(this._target, 'focus', 'show');
+ this.unlisten(this._target, 'mouseleave', 'hide');
+ this.unlisten(this._target, 'blur', 'hide');
+ this.unlisten(this._target, 'tap', 'hide');
+ }
+ this.unlisten(this, 'mouseenter', 'hide');
+ }
});

Powered by Google App Engine
This is Rietveld 408576698