Bug 1331167 - fix TooltipToggle to hide tooltip when leaving target;r=Honza draft
authorJulian Descottes <jdescottes@mozilla.com>
Thu, 08 Dec 2016 07:41:49 +0100
changeset 670273 d7ac7125d3fe8ee8e10affb34d3323518d357534
parent 670182 e6b3498a39b94616ba36798fe0b71a3090b1b14c
child 733198 e41e298cbb9ff537e05b07a30cb14c8690fe6549
push id81590
push userjdescottes@mozilla.com
push dateTue, 26 Sep 2017 08:27:45 +0000
reviewersHonza
bugs1331167
milestone58.0a1
Bug 1331167 - fix TooltipToggle to hide tooltip when leaving target;r=Honza MozReview-Commit-ID: 3pTi5DfEEPd
devtools/client/netmonitor/test/browser_net_image-tooltip.js
devtools/client/shared/test/browser_html_tooltip_hover.js
devtools/client/shared/widgets/tooltip/TooltipToggle.js
--- a/devtools/client/netmonitor/test/browser_net_image-tooltip.js
+++ b/devtools/client/netmonitor/test/browser_net_image-tooltip.js
@@ -45,17 +45,17 @@ add_task(function* test() {
   yield onEvents;
   yield waitUntil(() => !!document.querySelector(SELECTOR));
 
   info("Checking the image thumbnail after a reload.");
   yield showTooltipAndVerify(document.querySelectorAll(".request-list-item")[1]);
 
   info("Checking if the image thumbnail is hidden when mouse leaves the menu widget");
   let requestsListContents = document.querySelector(".requests-list-contents");
-  EventUtils.synthesizeMouse(requestsListContents, 0, 0, { type: "mouseout" },
+  EventUtils.synthesizeMouse(requestsListContents, 0, 0, { type: "mousemove" },
                              monitor.panelWin);
   yield waitUntil(() => !toolboxDoc.querySelector(".tooltip-container.tooltip-visible"));
 
   yield teardown(monitor);
 
   function performRequests() {
     return ContentTask.spawn(tab.linkedBrowser, {}, function* () {
       content.wrappedJSObject.performRequests();
--- a/devtools/client/shared/test/browser_html_tooltip_hover.js
+++ b/devtools/client/shared/test/browser_html_tooltip_hover.js
@@ -40,14 +40,14 @@ add_task(function* () {
 
   yield showAndCheck("box1", "bottom");
   yield showAndCheck("box2", "bottom");
   yield showAndCheck("box3", "top");
   yield showAndCheck("box4", "top");
 
   info("Move out of the container");
   let hidden = tooltip.once("hidden");
-  EventUtils.synthesizeMouseAtCenter(container, { type: "mouseout" }, doc.defaultView);
+  EventUtils.synthesizeMouseAtCenter(container, { type: "mousemove" }, doc.defaultView);
   yield hidden;
 
   info("Destroy the tooltip and finish");
   tooltip.destroy();
 });
--- a/devtools/client/shared/widgets/tooltip/TooltipToggle.js
+++ b/devtools/client/shared/widgets/tooltip/TooltipToggle.js
@@ -149,17 +149,17 @@ TooltipToggle.prototype = {
       return res.nodeName ? res : target;
     }
 
     return null;
   }),
 
   _onMouseOut: function (event) {
     // Only hide the tooltip if the mouse leaves baseNode.
-    if (event && this._baseNode && !this._baseNode.contains(event.relatedTarget)) {
+    if (event && this._baseNode && this._baseNode.contains(event.relatedTarget)) {
       return;
     }
 
     this._lastHovered = null;
     this.win.clearTimeout(this.toggleTimer);
     this.toggleTimer = this.win.setTimeout(() => {
       this.tooltip.hide();
     }, this._toggleDelay);