- Revision
- 94665
- Author
- [email protected]
- Date
- 2011-09-07 05:31:11 -0700 (Wed, 07 Sep 2011)
Log Message
2011-09-05 Andrey Kosyakov <[email protected]>
Web Inspector: disable popover when a mouse button is pressed
https://bugs.webkit.org/show_bug.cgi?id=67610
Reviewed by Pavel Feldman.
- disable popover when a mouse button is pressed
- disable popover in a SourceFrame when the source is being edited
* inspector/front-end/Popover.js:
(WebInspector.PopoverHelper):
(WebInspector.PopoverHelper.prototype._mouseUp):
(WebInspector.PopoverHelper.prototype._mouseDown):
(WebInspector.PopoverHelper.prototype._handleMouseAction):
* inspector/front-end/SourceFrame.js:
(WebInspector.SourceFrame.prototype._onHidePopover):
(WebInspector.SourceFrame.prototype.doubleClick):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (94664 => 94665)
--- trunk/Source/WebCore/ChangeLog 2011-09-07 12:31:02 UTC (rev 94664)
+++ trunk/Source/WebCore/ChangeLog 2011-09-07 12:31:11 UTC (rev 94665)
@@ -1,3 +1,22 @@
+2011-09-05 Andrey Kosyakov <[email protected]>
+
+ Web Inspector: disable popover when a mouse button is pressed
+ https://bugs.webkit.org/show_bug.cgi?id=67610
+
+ Reviewed by Pavel Feldman.
+
+ - disable popover when a mouse button is pressed
+ - disable popover in a SourceFrame when the source is being edited
+
+ * inspector/front-end/Popover.js:
+ (WebInspector.PopoverHelper):
+ (WebInspector.PopoverHelper.prototype._mouseUp):
+ (WebInspector.PopoverHelper.prototype._mouseDown):
+ (WebInspector.PopoverHelper.prototype._handleMouseAction):
+ * inspector/front-end/SourceFrame.js:
+ (WebInspector.SourceFrame.prototype._onHidePopover):
+ (WebInspector.SourceFrame.prototype.doubleClick):
+
2011-09-07 Antti Koivisto <[email protected]>
https://bugs.webkit.org/show_bug.cgi?id=67634
Modified: trunk/Source/WebCore/inspector/front-end/Popover.js (94664 => 94665)
--- trunk/Source/WebCore/inspector/front-end/Popover.js 2011-09-07 12:31:02 UTC (rev 94664)
+++ trunk/Source/WebCore/inspector/front-end/Popover.js 2011-09-07 12:31:11 UTC (rev 94665)
@@ -181,12 +181,13 @@
/**
* @constructor
*/
-WebInspector.PopoverHelper = function(panelElement, getAnchor, showPopover, onHide)
+WebInspector.PopoverHelper = function(panelElement, getAnchor, showPopover, onHide, disableOnClick)
{
this._panelElement = panelElement;
this._getAnchor = getAnchor;
this._showPopover = showPopover;
this._onHide = onHide;
+ this._disableOnClick = !!disableOnClick;
panelElement.addEventListener("mousedown", this._mouseDown.bind(this), false);
panelElement.addEventListener("mousemove", this._mouseMove.bind(this), false);
this.setTimeout(1000);
@@ -200,8 +201,12 @@
_mouseDown: function(event)
{
- this._killHidePopoverTimer();
- this._handleMouseAction(event, true);
+ if (this._disableOnClick)
+ this.hidePopover();
+ else {
+ this._killHidePopoverTimer();
+ this._handleMouseAction(event, true);
+ }
},
_mouseMove: function(event)
@@ -227,11 +232,11 @@
_handleMouseAction: function(event, isMouseDown)
{
this._resetHoverTimer();
-
+ if (event.which && this._disableOnClick)
+ return;
this._hoverElement = this._getAnchor(event.target);
if (!this._hoverElement)
return;
-
const toolTipDelay = isMouseDown ? 0 : (this._popup ? this._timeout * 0.6 : this._timeout);
this._hoverTimer = setTimeout(this._mouseHover.bind(this, this._hoverElement), toolTipDelay);
},
Modified: trunk/Source/WebCore/inspector/front-end/SourceFrame.js (94664 => 94665)
--- trunk/Source/WebCore/inspector/front-end/SourceFrame.js 2011-09-07 12:31:02 UTC (rev 94664)
+++ trunk/Source/WebCore/inspector/front-end/SourceFrame.js 2011-09-07 12:31:11 UTC (rev 94665)
@@ -282,7 +282,7 @@
var element = this._textViewer.element;
if (this._delegate.debuggingSupported()) {
this._popoverHelper = new WebInspector.PopoverHelper(element,
- this._getPopoverAnchor.bind(this), this._onShowPopover.bind(this), this._onHidePopover.bind(this));
+ this._getPopoverAnchor.bind(this), this._onShowPopover.bind(this), this._onHidePopover.bind(this), true);
element.addEventListener("mousedown", this._mouseDown.bind(this), true);
element.addEventListener("scroll", this._scroll.bind(this), true);
}
@@ -663,6 +663,8 @@
{
// Replace higlight element with its contents inplace.
var highlightElement = this._highlightElement;
+ if (!highlightElement)
+ return;
var parentElement = highlightElement.parentElement;
var child = highlightElement.firstChild;
while (child) {
@@ -671,6 +673,7 @@
child = nextSibling;
}
parentElement.removeChild(highlightElement);
+ delete this._highlightElement;
this._delegate.releaseEvaluationResult();
},
@@ -718,6 +721,10 @@
_onShowPopover: function(element, popover)
{
+ if (!this._textViewer.readOnly) {
+ this._popoverHelper.hidePopover();
+ return;
+ }
this._highlightElement = this._highlightExpression(element);
function showObjectPopover(result, wasThrown)
@@ -876,6 +883,9 @@
_setReadOnly: function(readOnly)
{
+ if (!readOnly && this._popoverHelper)
+ this._popoverHelper.hidePopover();
+
this._textViewer.readOnly = readOnly;
WebInspector.markBeingEdited(this._textViewer.element, !readOnly);
if (readOnly)