Commit 0aa0c237 authored by commit-queue@webkit.org's avatar commit-queue@webkit.org
Browse files

Web Inspector: enhance Popover.js to rely on hover element coordinates

https://bugs.webkit.org/show_bug.cgi?id=113340

Patch by Andrey Lushnikov <lushnikov@chromium.org> on 2013-03-27
Reviewed by Pavel Feldman.

No new tests: no change in behaviour.

Introduce a coordinates-based method that checks if mouse is inside hover
element and use it in PopoverHelper instead of DOM hierarchy.

* inspector/front-end/Popover.js:
(WebInspector.PopoverHelper.prototype._eventInHoverElement): Added.
(WebInspector.PopoverHelper.prototype._mouseDown):
(WebInspector.PopoverHelper.prototype._mouseMove):
(WebInspector.PopoverHelper.prototype._mouseOut):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@147027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2d127e99
2013-03-27 Andrey Lushnikov <lushnikov@chromium.org>
Web Inspector: enhance Popover.js to rely on hover element coordinates
https://bugs.webkit.org/show_bug.cgi?id=113340
Reviewed by Pavel Feldman.
No new tests: no change in behaviour.
Introduce a coordinates-based method that checks if mouse is inside hover
element and use it in PopoverHelper instead of DOM hierarchy.
* inspector/front-end/Popover.js:
(WebInspector.PopoverHelper.prototype._eventInHoverElement): Added.
(WebInspector.PopoverHelper.prototype._mouseDown):
(WebInspector.PopoverHelper.prototype._mouseMove):
(WebInspector.PopoverHelper.prototype._mouseOut):
2013-03-27 Andrey Lushnikov <lushnikov@chromium.org>
 
Web Inspector: [CodeMirror] fix webinspector-css theme for CodeMirror
......@@ -244,9 +244,22 @@ WebInspector.PopoverHelper.prototype = {
this._timeout = timeout;
},
/**
* @param {MouseEvent} event
* @return {boolean}
*/
_eventInHoverElement: function(event)
{
if (!this._hoverElement)
return false;
var box = this._hoverElement.boxInWindow();
return (box.x <= event.clientX && event.clientX <= box.x + box.width &&
box.y <= event.clientY && event.clientY <= box.y + box.height);
},
_mouseDown: function(event)
{
if (this._disableOnClick || !event.target.isSelfOrDescendant(this._hoverElement))
if (this._disableOnClick || !this._eventInHoverElement(event))
this.hidePopover();
else {
this._killHidePopoverTimer();
......@@ -257,7 +270,7 @@ WebInspector.PopoverHelper.prototype = {
_mouseMove: function(event)
{
// Pretend that nothing has happened.
if (event.target.isSelfOrDescendant(this._hoverElement))
if (this._eventInHoverElement(event))
return;
this._startHidePopoverTimer();
......@@ -276,7 +289,7 @@ WebInspector.PopoverHelper.prototype = {
{
if (!this.isPopoverVisible())
return;
if (event.relatedTarget && !event.relatedTarget.isSelfOrDescendant(this._hoverElement))
if (!this._eventInHoverElement(event))
this._startHidePopoverTimer();
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment