Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into httpmonitor
  • Loading branch information
janodvarko committed May 31, 2012
2 parents 4f1bbb1 + 33caa2a commit f6f047d
Show file tree
Hide file tree
Showing 13 changed files with 323 additions and 36 deletions.
6 changes: 4 additions & 2 deletions extension/content/firebug/css/computedPanel.js
Expand Up @@ -600,9 +600,11 @@ CSSComputedPanel.prototype = Obj.extend(Firebug.Panel,
return CSSInfoTip.populateColorInfoTip(infoTip, cssValue.value);

case "url":
if (Css.isImageRule(Xml.getElementSimpleType(Firebug.getRepObject(target)), prop))
if (Css.isImageRule(Xml.getElementSimpleType(propInfo), prop))
{
var baseURL = propInfo.href || propInfo.matchedSelectors[0].href;
var baseURL = typeof propInfo.href == "object" ? propInfo.href.href : propInfo.href;
if (!baseURL)
baseURL = propInfo.matchedSelectors[0].href;
var relURL = Firebug.CSSModule.parseURLValue(cssValue.value);
var absURL = Url.isDataURL(relURL) ? relURL : Url.absoluteURL(relURL, baseURL);
var repeat = Firebug.CSSModule.parseRepeatValue(value);
Expand Down
33 changes: 28 additions & 5 deletions extension/content/firebug/html/htmlPanel.js
Expand Up @@ -142,6 +142,7 @@ Firebug.HTMLPanel.prototype = Obj.extend(WalkingPanel,
// replacing the old selected node that doesn't have to exit any more (after
// the editing).
// If nextSelection is not set a default node (e.g. body) will be selected.
// See issue 5506
this.select(this.nextSelection, true);
delete this.nextSelection;
}
Expand Down Expand Up @@ -174,6 +175,12 @@ Firebug.HTMLPanel.prototype = Obj.extend(WalkingPanel,
this.selection = object;
this.updateSelection(object);

// The Edit button (in the toolbar) must be updated every time the selection
// changes. Some elements (such as <html>) can't be edited (see issue 5506).
var edit = Firebug.chrome.$("fbToggleHTMLEditing");
edit.disabled = object ? Css.nonEditableTags.hasOwnProperty(object.localName) : false;

// Distribute selection change further to listeners.
Events.dispatch(Firebug.uiListeners, "onObjectSelected", [object, this]);

// If the 'free text' edit mode is active change the current markup
Expand Down Expand Up @@ -688,8 +695,10 @@ Firebug.HTMLPanel.prototype = Obj.extend(WalkingPanel,
{
// If the editing mode is currently active, remembe the target mutation.
// The mutation is coming from user changes and will be selected as soon
// as the editing mode is finished.
if (this.isEditing())
// as the editing mode is finished. Only HTMLElement can be selected
// (not a simple text node)
// See issue 5506
if (this.isEditing() && (target instanceof window.HTMLElement))
this.nextSelection = target;
}

Expand Down Expand Up @@ -1096,10 +1105,8 @@ Firebug.HTMLPanel.prototype = Obj.extend(WalkingPanel,
this.noScrollIntoView = true;
this.select(node);

Firebug.chrome.$('fbToggleHTMLEditing').disabled =
Css.nonEditableTags.hasOwnProperty(node.localName);

delete this.noScrollIntoView;

if (Css.hasClass(event.target, "twisty"))
this.toggleNode(event);
}
Expand Down Expand Up @@ -1521,6 +1528,10 @@ Firebug.HTMLPanel.prototype = Obj.extend(WalkingPanel,
if (element instanceof window.Document)
continue;

// Ignore elements without parent
if (!element.parentNode)
continue;

path.push(element);
}
return path;
Expand Down Expand Up @@ -2064,6 +2075,7 @@ TextDataEditor.prototype = domplate(Firebug.InlineEditor.prototype,
var node = Firebug.getRepObject(target);
if (!node)
return;

target.data = value;
node.data = value;
}
Expand Down Expand Up @@ -2182,13 +2194,16 @@ AttributeEditor.prototype = domplate(Firebug.InlineEditor.prototype,
{
if (value != previousValue)
element.removeAttribute(previousValue);

if (value)
{
var attrValue = Dom.getNextByClass(target, "nodeValue").textContent;
element.setAttribute(value, attrValue);
}
else
{
element.removeAttribute(value);
}
}
else if (Css.hasClass(target, "nodeValue"))
{
Expand Down Expand Up @@ -2342,6 +2357,14 @@ HTMLEditor.prototype = domplate(Firebug.BaseEditor,
this.editingElements[0].innerHTML = value;
else
this.editingElements = Dom.setOuterHTML(this.editingElements[0], value);

var element = Firebug.getRepObject(target);
if (!element)
return;

// Make sure the object status path (in the toolbar) is updated.
var panel = Firebug.getElementPanel(target);
Events.dispatch(Firebug.uiListeners, "onObjectChanged", [element, panel]);
},

endEditing: function()
Expand Down
78 changes: 73 additions & 5 deletions extension/content/firebug/js/breakpoint.js
Expand Up @@ -13,13 +13,14 @@ define([
"firebug/lib/dom",
"firebug/lib/string",
"firebug/lib/array",
"firebug/lib/persist",
"firebug/chrome/menu",
"firebug/js/fbs",
"firebug/editor/editor",
"firebug/console/autoCompleter"
],
function(Obj, Firebug, Domplate, FirebugReps, Locale, Events, SourceLink,
StackFrame, Css, Dom, Str, Arr, Menu, FBS) {
StackFrame, Css, Dom, Str, Arr, Persist, Menu, FBS) {

// ********************************************************************************************* //
// Breakpoints
Expand Down Expand Up @@ -191,9 +192,11 @@ Firebug.Breakpoint.BreakpointListRep = domplate(Firebug.Rep,
tag:
DIV({role : "list"},
FOR("group", "$groups",
DIV({"class": "breakpointBlock breakpointBlock-$group.name", role: "listitem"},
DIV({"class": "breakpointBlock breakpointBlock-$group.name", role: "list",
$opened: "$group.opened", _repObject: "$group", onclick: "$onClick"},
H1({"class": "breakpointHeader groupHeader"},
"$group.title"
DIV({"class": "twisty", role: "presentation"}),
SPAN({"class": "breakpointsHeaderLabel"}, "$group.title")
),
DIV({"class": "breakpointsGroupListBox", role: "listbox"},
FOR("bp", "$group.breakpoints",
Expand All @@ -208,6 +211,40 @@ Firebug.Breakpoint.BreakpointListRep = domplate(Firebug.Rep,
{
var rep = Firebug.getRep(bp, Firebug.currentContext);
return rep.tag;
},

toggleGroup: function(node)
{
var panel = Firebug.getElementPanel(node);
var groupNode = Dom.getAncestorByClass(node, "breakpointBlock");
var group = Firebug.getRepObject(groupNode);

Css.toggleClass(groupNode, "opened");
var opened = Css.hasClass(groupNode, "opened");
panel.groupOpened[group.name] = opened;

if (opened)
{
var offset = Dom.getClientOffset(node);
var titleAtTop = offset.y < panel.panelNode.scrollTop;
Dom.scrollTo(groupNode, panel.panelNode, null,
groupNode.offsetHeight > panel.panelNode.clientHeight || titleAtTop ? "top" : "bottom");
}
},

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

onClick: function(event)
{
if (!Events.isLeftClick(event))
return;

var header = Dom.getAncestorByClass(event.target, "breakpointHeader");
if (header)
{
this.toggleGroup(event.target);
return;
}
}
});

Expand Down Expand Up @@ -348,6 +385,9 @@ Firebug.Breakpoint.BreakpointsPanel = function() {}

Firebug.Breakpoint.BreakpointsPanel.prototype = Obj.extend(Firebug.Panel,
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// extends Panel

name: "breakpoints",
parentPanel: "script",
order: 2,
Expand All @@ -356,16 +396,32 @@ Firebug.Breakpoint.BreakpointsPanel.prototype = Obj.extend(Firebug.Panel,

initialize: function()
{
this.groupOpened = [];

Firebug.Panel.initialize.apply(this, arguments);
},

destroy: function(state)
{
state.groupOpened = this.groupOpened;

Firebug.Panel.destroy.apply(this, arguments);
},

show: function(state)
{
if (this.context.loaded)
{
var state;
Persist.restoreObjects(this, state);

if (state)
{
if (state.groupOpened)
this.groupOpened = state.groupOpened;
}
}

this.refresh();
},

Expand Down Expand Up @@ -417,16 +473,28 @@ Firebug.Breakpoint.BreakpointsPanel.prototype = Obj.extend(Firebug.Panel,

Firebug.connection.dispatch("getBreakpoints", [this.context, groups]);

if (groups.length)
if (groups.length != 0)
{
for (var i = 0; i < groups.length; ++i)
{
groups[i].opened = typeof this.groupOpened[groups[i].name] != "undefined" ?
this.groupOpened[groups[i].name] : true;
}

Firebug.Breakpoint.BreakpointListRep.tag.replace({groups: groups}, this.panelNode);
}
else
{
FirebugReps.Warning.tag.replace({object: "NoBreakpointsWarning"}, this.panelNode);
}

if (FBTrace.DBG_BP)
{
FBTrace.sysout("breakpoints.refresh "+breakpoints.length+
errorBreakpoints.length+monitors.length, [breakpoints, errorBreakpoints, monitors]);
}

Events.dispatch(this.fbListeners, 'onBreakRowsRefreshed', [this, this.panelNode]);
Events.dispatch(this.fbListeners, "onBreakRowsRefreshed", [this, this.panelNode]);
},

extractBreakpoints: function(context)
Expand Down
28 changes: 16 additions & 12 deletions extension/content/firebug/js/callstack.js
Expand Up @@ -11,7 +11,7 @@ define([
"firebug/lib/css",
"firebug/lib/array",
"firebug/lib/dom",
"firebug/chrome/menu",
"firebug/chrome/menu"
],
function(Obj, Firebug, FirebugReps, JavaScriptTool, Events, Wrapper, StackFrame,
Css, Arr, Dom, Menu) {
Expand Down Expand Up @@ -203,21 +203,25 @@ Firebug.CallstackPanel.prototype = Obj.extend(Firebug.Panel,

Css.setClass(this.panelNode, "objectBox-stackTrace");

if (!trace)
return;

var rep = Firebug.getRep(trace, this.context);
if (trace && trace.frames.length != 0)
{
var rep = Firebug.getRep(trace, this.context);

if (FBTrace.DBG_STACK)
FBTrace.sysout("callstack showStackFrame with "+trace.frames.length+" frames using "
+rep+" into "+this.panelNode, {trace: trace, rep:rep, node:this.panelNode});
if (FBTrace.DBG_STACK)
FBTrace.sysout("callstack showStackFrame with "+trace.frames.length+" frames using "
+rep+" into "+this.panelNode, {trace: trace, rep:rep, node:this.panelNode});

rep.tag.replace({object:trace}, this.panelNode);
rep.tag.replace({object:trace}, this.panelNode);

if (trace.currentFrameIndex)
this.select(trace[trace.currentFrameIndex]);
if (trace.currentFrameIndex)
this.select(trace[trace.currentFrameIndex]);

Events.dispatch(this.fbListeners, "onStackCreated", [this]);
Events.dispatch(this.fbListeners, "onStackCreated", [this]);
}
else
{
FirebugReps.Warning.tag.replace({object: "callstack.Execution_not_stopped"}, this.panelNode);
}
},

selectFrame: function(frameIndex)
Expand Down
4 changes: 4 additions & 0 deletions extension/locale/en-US/firebug.properties
Expand Up @@ -400,6 +400,10 @@ callstack.tip.Expand_All=Expand all stack frame functions
callstack.Collapse_All=Collapse All
callstack.tip.Collapse_All=Collapse all stack frame functions

# LOCALIZATION NOTE (callstack.Execution_not_stopped):
# Message displayed in the Stack side panel if the script execution is not stopped.
callstack.Execution_not_stopped=Stack frames are just shown when the script execution is stopped.

# LOCALIZATION NOTE (ShowUserProps, ShowUserFuncs, ShowDOMProps, ShowDOMFuncs, ShowDOMConstants,
# ShowOwnProperties, ShowOwnPropertiesTooltip, ShowEnumerableProperties, ShowEnumerablePropertiesTooltip,
# ShowInlineEventHandlers):
Expand Down
22 changes: 22 additions & 0 deletions extension/skin/classic/breakpoint.css
@@ -1,5 +1,27 @@
/* See license.txt for terms of usage */

.breakpointHeader {
position: relative;
cursor: pointer;
-moz-user-select: none;
}

.breakpointHeader > .twisty {
background-position: 4px 4px !important;
}

.breakpointsHeaderLabel {
margin-left: 14px;
}

.breakpointBlock > .breakpointsGroupListBox {
display: none;
}

.breakpointBlock.opened > .breakpointsGroupListBox {
display: block;
}

/************************************************************************************************/
/* Breakpoint notifications */

Expand Down
2 changes: 2 additions & 0 deletions extension/skin/classic/win/panel.css
Expand Up @@ -13,6 +13,7 @@
.objectBox-stackFrame.hasTwisty,
.netPageRow > .netCol > .netPageTitle,
.cssComputedHeader > .twisty,
.breakpointHeader > .twisty,
.computedStyle.hasSelectors > .stylePropName {
background-image: url(chrome://firebug/skin/win/twistyClosed.png);
background-repeat: no-repeat;
Expand All @@ -31,6 +32,7 @@
.netPageRow.opened > .netCol > .netPageTitle,
.objectBox-stackFrame.hasTwisty.opened,
.computedStylesGroup.opened > .cssComputedHeader > .twisty,
.breakpointBlock.opened > .breakpointHeader > .twisty,
.computedStyle.hasSelectors.opened > .stylePropName {
background-image: url(chrome://firebug/skin/win/twistyOpen.png);
}
Expand Down

0 comments on commit f6f047d

Please sign in to comment.