Permalink
Browse files

Revert c1e97f9 (Issue 5136: use "backdrag" attribute for quickinfobox)

Backed out for regressions, see issue 5719.
  • Loading branch information...
simonlindholm committed Dec 22, 2012
1 parent 893244b commit 53cccbeb166873a584134d54d55da5fe73d13b67
Showing with 90 additions and 24 deletions.
  1. +4 −2 extension/content/firebug/firebugOverlay.xul
  2. +86 −22 extension/content/firebug/html/inspector.js
@@ -21,8 +21,10 @@
<tooltip id="fbTooltip" class="fbURLMenuItem"
onpopupshowing="return Firebug.chrome.onTooltipShowing(event);"/>
- <panel id="fbQuickInfoPanel" width="210" noautofocus="true"
- ignorekeys="true" backdrag="true">
+ <panel id="fbQuickInfoPanel" width="210" noautohide="true" noautofocus="true"
+ onmousedown="Firebug.Inspector.quickInfoBoxHandler(event);"
+ onmouseover="Firebug.Inspector.quickInfoBoxHandler(event);"
+ onmouseout="Firebug.Inspector.quickInfoBoxHandler(event);">
<vbox></vbox>
</panel>
@@ -788,11 +788,8 @@ Firebug.Inspector = Obj.extend(Firebug.Module,
this.highlightObject(null);
this.defaultHighlighter = value ? getHighlighter("boxModel") : getHighlighter("frame");
}
- else if (name == "showQuickInfoBox")
+ else if(name == "showQuickInfoBox")
{
- if (quickInfoBox.boxEnabled && !value)
- quickInfoBox.hide();
-
quickInfoBox.boxEnabled = value;
}
},
@@ -829,10 +826,23 @@ Firebug.Inspector = Obj.extend(Firebug.Module,
*/
hideQuickInfoBox: function()
{
- quickInfoBox.hide();
+ var qiBox = Firebug.chrome.$("fbQuickInfoPanel");
+
+ if (qiBox.state==="open")
+ quickInfoBox.hide();
this.inspectNode(null);
+ },
+
+ /**
+ * Pass all quick info box events to quickInfoBox.handleEvent() for handling.
+ * @param {Event} event Event to handle
+ */
+ quickInfoBoxHandler: function(event)
+ {
+ quickInfoBox.handleEvent(event);
}
+
});
// ********************************************************************************************* //
@@ -1059,6 +1069,8 @@ var quickInfoBox =
dragging: false,
storedX: null,
storedY: null,
+ prevX: null,
+ prevY: null,
show: function(element)
{
@@ -1077,19 +1089,11 @@ var quickInfoBox =
if (qiBox.state==="closed")
{
+ qiBox.hidePopup();
+
this.storedX = this.storedX || Firefox.getElementById("content").tabContainer.boxObject.screenX + 5;
this.storedY = this.storedY || Firefox.getElementById("content").tabContainer.boxObject.screenY + 35;
- // Dynamically set noautohide to avoid mozilla bug 545265.
- if (!this.noautohideAdded)
- {
- this.noautohideAdded = true;
- qiBox.addEventListener("popupshowing", function runOnce()
- {
- qiBox.removeEventListener("popupshowing", runOnce, false);
- qiBox.setAttribute("noautohide", true);
- }, false);
- }
qiBox.openPopupAtScreen(this.storedX, this.storedY, false);
}
@@ -1120,18 +1124,78 @@ var quickInfoBox =
hide: function()
{
// if mouse is over panel defer hiding to mouseout to not cause flickering
- var qiBox = Firebug.chrome.$("fbQuickInfoPanel");
- if (qiBox.state==="closed")
+ if (this.mouseover || this.dragging)
+ {
+ this.needsToHide = true;
return;
+ }
- if (qiBox.mozMatchesSelector(":hover"))
- return;
+ var qiBox = Firebug.chrome.$("fbQuickInfoPanel");
- this.storedX = qiBox.boxObject.screenX;
- this.storedY = qiBox.boxObject.screenY;
+ this.prevX = null;
+ this.prevY = null;
+ this.needsToHide = false;
qiBox.hidePopup();
},
+ handleEvent: function(event)
+ {
+ switch (event.type)
+ {
+ case "mousemove":
+ if(!this.dragging)
+ return;
+
+ var diffX, diffY,
+ boxX = this.qiBox.screenX,
+ boxY = this.qiBox.screenY,
+ x = event.screenX,
+ y = event.screenY;
+
+ diffX = x - this.prevX;
+ diffY = y - this.prevY;
+
+ this.qiBox.moveTo(boxX + diffX, boxY + diffY);
+
+ this.prevX = x;
+ this.prevY = y;
+ this.storedX = boxX;
+ this.storedY = boxY;
+ break;
+ case "mousedown":
+ this.qiPanel = Firebug.chrome.$("fbQuickInfoPanel");
+ this.qiBox = this.qiPanel.boxObject;
+ Events.addEventListener(this.qiPanel, "mousemove", this, true);
+ Events.addEventListener(this.qiPanel, "mouseup", this, true);
+ this.dragging = true;
+ this.prevX = event.screenX;
+ this.prevY = event.screenY;
+ break;
+ case "mouseup":
+ Events.removeEventListener(this.qiPanel, "mousemove", this, true);
+ Events.removeEventListener(this.qiPanel, "mouseup", this, true);
+ this.qiPanel = this.qiBox = null;
+ this.prevX = this.prevY = null;
+ this.dragging = false;
+ break;
+ // this is a hack to find when mouse enters and leaves panel
+ // it requires that #fbQuickInfoPanel have border
+ case "mouseover":
+ if(this.dragging)
+ return;
+ this.mouseover = true;
+ break;
+ case "mouseout":
+ if(this.dragging)
+ return;
+ this.mouseover = false;
+ // if hiding was defered because mouse was over panel hide it
+ if (this.needsToHide && event.target.nodeName == "panel")
+ this.hide();
+ break;
+ }
+ },
+
addRows: function(domBase, vbox, attribs, computedStyle)
{
if (!domBase)
@@ -1162,7 +1226,7 @@ var quickInfoBox =
lab.setAttribute("class", "fbQuickInfoName");
lab.setAttribute("value", attribs[i]);
hbox.appendChild(lab);
- var desc = document.createElement("label");
+ var desc = document.createElement("description");
desc.setAttribute("class", "fbQuickInfoValue");
desc.appendChild(document.createTextNode(": " + value));
hbox.appendChild(desc);

0 comments on commit 53cccbe

Please sign in to comment.