Skip to content

Commit

Permalink
Revert c1e97f9 (Issue 5136: use "backdrag" attribute for quickinfobox)
Browse files Browse the repository at this point in the history
Backed out for regressions, see issue 5719.
  • Loading branch information
simonlindholm committed Jan 2, 2013
1 parent 893244b commit 53cccbe
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 24 deletions.
6 changes: 4 additions & 2 deletions extension/content/firebug/firebugOverlay.xul
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
108 changes: 86 additions & 22 deletions extension/content/firebug/html/inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
},
Expand Down Expand Up @@ -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);
}

});

// ********************************************************************************************* //
Expand Down Expand Up @@ -1059,6 +1069,8 @@ var quickInfoBox =
dragging: false,
storedX: null,
storedY: null,
prevX: null,
prevY: null,

show: function(element)
{
Expand All @@ -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);
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 53cccbe

Please sign in to comment.