Changeset 113428 in webkit


Ignore:
Timestamp:
Apr 6, 2012, 5:49:55 AM (13 years ago)
Author:
caseq@chromium.org
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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r113426 r113428  
     12012-04-06  Andrey Kosyakov  <caseq@chromium.org>
     2
     3        Web Inspector: hide popover on mouseout from anchor
     4        https://bugs.webkit.org/show_bug.cgi?id=83362
     5
     6        Reviewed by Pavel Feldman.
     7
     8        - start hide popover timer when mouse moves out of popover anchor, as we won't receive mousemove events any more;
     9        - factored out starting of popover kill timer to a method.
     10
     11        * inspector/front-end/Popover.js:
     12        (WebInspector.PopoverHelper):
     13        (WebInspector.PopoverHelper.prototype._mouseMove): Factored out StartHidePopoverTimer()
     14        (WebInspector.PopoverHelper.prototype._mouseOut): Just call StartHidePopoverTimer() when mouse moves out of anchor.
     15        (WebInspector.PopoverHelper.prototype._startHidePopoverTimer.doHide):
     16        (WebInspector.PopoverHelper.prototype._startHidePopoverTimer):
     17        (WebInspector.PopoverHelper.prototype._hidePopover): Reset hoverElement (aka anchor) when hiding popover.
     18
    1192012-04-06  Andrey Kosyakov  <caseq@chromium.org>
    220
  • trunk/Source/WebCore/inspector/front-end/Popover.js

    r111676 r113428  
    206206    panelElement.addEventListener("mousedown", this._mouseDown.bind(this), false);
    207207    panelElement.addEventListener("mousemove", this._mouseMove.bind(this), false);
     208    panelElement.addEventListener("mouseout", this._mouseOut.bind(this), false);
    208209    this.setTimeout(1000);
    209210}
     
    231232            return;
    232233
     234        this._startHidePopoverTimer();
     235        this._handleMouseAction(event, false);
     236    },
     237
     238    _mouseOut: function(event)
     239    {
     240        if (event.target === this._hoverElement)
     241            this._startHidePopoverTimer();
     242    },
     243
     244    _startHidePopoverTimer: function()
     245    {
    233246        // User has 500ms (this._timeout / 2) to reach the popup.
    234         if (this._popover && !this._hidePopoverTimer) {
    235             var self = this;
    236             function doHide()
    237             {
    238                 self._hidePopover();
    239                 delete self._hidePopoverTimer;
    240             }
    241             this._hidePopoverTimer = setTimeout(doHide, this._timeout / 2);
    242         }
    243 
    244         this._handleMouseAction(event, false);
     247        if (!this._popover || this._hidePopoverTimer)
     248            return;
     249
     250        function doHide()
     251        {
     252            this._hidePopover();
     253            delete this._hidePopoverTimer;
     254        }
     255        this._hidePopoverTimer = setTimeout(doHide.bind(this), this._timeout / 2);
    245256    },
    246257
     
    286297        this._popover.dispose();
    287298        delete this._popover;
     299        this._hoverElement = null;
    288300    },
    289301
Note: See TracChangeset for help on using the changeset viewer.