Title: [113428] trunk/Source/WebCore
Revision
113428
Author
[email protected]
Date
2012-04-06 05:49:55 -0700 (Fri, 06 Apr 2012)

Log Message

Web Inspector: hide popover on mouseout from anchor
https://bugs.webkit.org/show_bug.cgi?id=83362

Reviewed by Pavel Feldman.

- start hide popover timer when mouse moves out of popover anchor, as we won't receive mousemove events any more;
- factored out starting of popover kill timer to a method.

* inspector/front-end/Popover.js:
(WebInspector.PopoverHelper):
(WebInspector.PopoverHelper.prototype._mouseMove): Factored out StartHidePopoverTimer()
(WebInspector.PopoverHelper.prototype._mouseOut): Just call StartHidePopoverTimer() when mouse moves out of anchor.
(WebInspector.PopoverHelper.prototype._startHidePopoverTimer.doHide):
(WebInspector.PopoverHelper.prototype._startHidePopoverTimer):
(WebInspector.PopoverHelper.prototype._hidePopover): Reset hoverElement (aka anchor) when hiding popover.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113427 => 113428)


--- trunk/Source/WebCore/ChangeLog	2012-04-06 12:08:37 UTC (rev 113427)
+++ trunk/Source/WebCore/ChangeLog	2012-04-06 12:49:55 UTC (rev 113428)
@@ -1,5 +1,23 @@
 2012-04-06  Andrey Kosyakov  <[email protected]>
 
+        Web Inspector: hide popover on mouseout from anchor
+        https://bugs.webkit.org/show_bug.cgi?id=83362
+
+        Reviewed by Pavel Feldman.
+
+        - start hide popover timer when mouse moves out of popover anchor, as we won't receive mousemove events any more;
+        - factored out starting of popover kill timer to a method.
+
+        * inspector/front-end/Popover.js:
+        (WebInspector.PopoverHelper):
+        (WebInspector.PopoverHelper.prototype._mouseMove): Factored out StartHidePopoverTimer()
+        (WebInspector.PopoverHelper.prototype._mouseOut): Just call StartHidePopoverTimer() when mouse moves out of anchor.
+        (WebInspector.PopoverHelper.prototype._startHidePopoverTimer.doHide): 
+        (WebInspector.PopoverHelper.prototype._startHidePopoverTimer):
+        (WebInspector.PopoverHelper.prototype._hidePopover): Reset hoverElement (aka anchor) when hiding popover.
+
+2012-04-06  Andrey Kosyakov  <[email protected]>
+
         [Chromium] Web Inspector: getEventListeners(window) crashes on NTP
         https://bugs.webkit.org/show_bug.cgi?id=83353
 

Modified: trunk/Source/WebCore/inspector/front-end/Popover.js (113427 => 113428)


--- trunk/Source/WebCore/inspector/front-end/Popover.js	2012-04-06 12:08:37 UTC (rev 113427)
+++ trunk/Source/WebCore/inspector/front-end/Popover.js	2012-04-06 12:49:55 UTC (rev 113428)
@@ -205,6 +205,7 @@
     this._disableOnClick = !!disableOnClick;
     panelElement.addEventListener("mousedown", this._mouseDown.bind(this), false);
     panelElement.addEventListener("mousemove", this._mouseMove.bind(this), false);
+    panelElement.addEventListener("mouseout", this._mouseOut.bind(this), false);
     this.setTimeout(1000);
 }
 
@@ -230,18 +231,28 @@
         if (event.target.isSelfOrDescendant(this._hoverElement))
             return;
 
+        this._startHidePopoverTimer();
+        this._handleMouseAction(event, false);
+    },
+
+    _mouseOut: function(event)
+    {
+        if (event.target === this._hoverElement)
+            this._startHidePopoverTimer();
+    },
+
+    _startHidePopoverTimer: function()
+    {
         // User has 500ms (this._timeout / 2) to reach the popup.
-        if (this._popover && !this._hidePopoverTimer) {
-            var self = this;
-            function doHide()
-            {
-                self._hidePopover();
-                delete self._hidePopoverTimer;
-            }
-            this._hidePopoverTimer = setTimeout(doHide, this._timeout / 2);
+        if (!this._popover || this._hidePopoverTimer)
+            return;
+
+        function doHide()
+        {
+            this._hidePopover();
+            delete this._hidePopoverTimer;
         }
-
-        this._handleMouseAction(event, false);
+        this._hidePopoverTimer = setTimeout(doHide.bind(this), this._timeout / 2);
     },
 
     _handleMouseAction: function(event, isMouseDown)
@@ -285,6 +296,7 @@
 
         this._popover.dispose();
         delete this._popover;
+        this._hoverElement = null;
     },
 
     _mouseHover: function(element)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to