Skip to content

Commit

Permalink
(part II. infotip) Issue 6995: Display an icon for read only properties
Browse files Browse the repository at this point in the history
  • Loading branch information
janodvarko committed Nov 22, 2013
1 parent e14adf0 commit 379bfe6
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 21 deletions.
96 changes: 84 additions & 12 deletions extension/content/firebug/dom/domBasePanel.js
Expand Up @@ -9,37 +9,39 @@ define([
"firebug/lib/array",
"firebug/lib/events",
"firebug/lib/wrapper",
"firebug/debugger/script/sourceLink",
"firebug/debugger/stack/stackFrame",
"firebug/lib/domplate",
"firebug/lib/dom",
"firebug/lib/css",
"firebug/lib/string",
"firebug/lib/locale",
"firebug/console/closureInspector",
"firebug/dom/toggleBranch",
"firebug/lib/system",
"firebug/chrome/menu",
"firebug/dom/toggleBranch",
"firebug/dom/domEditor",
"firebug/dom/domReps",
"firebug/dom/domModule",
"firebug/chrome/menu",
"firebug/chrome/panel",
"firebug/console/commandLine",
"firebug/chrome/searchBox",
"firebug/chrome/panelActivation",
"firebug/debugger/script/sourceLink",
"firebug/debugger/stack/stackFrame",
"firebug/debugger/debuggerLib",
"firebug/editor/editor",
"firebug/chrome/searchBox",
"firebug/dom/domModule",
"firebug/console/commandLine",
"firebug/console/autoCompleter",
"firebug/console/closureInspector",
],
function(Firebug, FBTrace, Obj, Arr, Events, Wrapper, SourceLink, StackFrame,
Dom, Css, Str, Locale, ClosureInspector, ToggleBranch, System, Menu,
DOMEditor, DOMReps, Panel, CommandLine, PanelActivation, DebuggerLib, Editor,
SearchBox, DOMModule, JSAutoCompleter) {
function(Firebug, FBTrace, Obj, Arr, Events, Wrapper, Domplate, Dom, Css, Str, Locale, System,
ToggleBranch, DOMEditor, DOMReps, DOMModule, Menu, Panel, SearchBox, PanelActivation,
SourceLink, StackFrame, DebuggerLib, Editor, CommandLine, JSAutoCompleter, ClosureInspector) {

"use strict";

// ********************************************************************************************* //
// Constants

var {domplate, DIV, SPAN} = Domplate;

var rxIdentifier = /^[$_A-Za-z][$_A-Za-z0-9]*$/;

var Trace = FBTrace.to("DBG_DOM");
Expand Down Expand Up @@ -67,6 +69,19 @@ Firebug.DOMBasePanel.prototype = Obj.extend(Panel,
tag: DOMReps.DirTablePlate.tableTag,
dirTablePlate: DOMReps.DirTablePlate,

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Domplate

readOnlyInfoTipTag:
DIV({"class": "readOnlyInfoTip"},
DIV({"class": "name"}, "$desc.name"),
DIV({"class": "$desc.configurable"}, "configurable"),
DIV({"class": "$desc.enumerable"}, "enumerable"),
DIV({"class": "$desc.writable"}, "writable"),
DIV({"class": "$desc.set"}, "setter"),
DIV({"class": "$desc.get"}, "getter")
),

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Initialization

Expand Down Expand Up @@ -631,6 +646,63 @@ Firebug.DOMBasePanel.prototype = Obj.extend(Panel,
if (object)
DOMModule.toggleBreakpoint(this.context, object, name);
},

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Info Tips

showInfoTip: function(infoTip, target, x, y, rangeParent, rangeOffset)
{
if (Dom.getAncestorByClass(target, "memberValueIcon"))
return this.populateReadOnlyInfoTip(infoTip, target);

// Do not show anything.
return false;
},

populateReadOnlyInfoTip: function(infoTip, target)
{
var member = Firebug.getRepObject(target);
if (!member.descriptor)
{
// xxxHonza: this happens quite often why?
// FBTrace.sysout("no descriptor? " + member.name, member)
return false;
}

var input = {
name: member.name,
configurable: member.descriptor.configurable ? "yes" : "no",
enumerable: member.descriptor.enumerable ? "yes" : "no",
writable: member.descriptor.writable ? "yes" : "no",
get: member.descriptor.get ? "yes" : "no",
set: member.descriptor.set ? "yes" : "no",
}

this.readOnlyInfoTipTag.replace({desc: input}, infoTip);

return true;
},

populateBreakpointInfoTip: function(infoTip, target)
{
var lineNo = this.scriptView.getLineIndex(target);
var bp = BreakpointStore.findBreakpoint(this.getCurrentURL(), lineNo);
if (!bp)
return false;

var expr = bp.condition;
if (!expr)
return false;

if (expr == this.infoTipExpr)
return true;

BreakpointInfoTip.render(infoTip, expr);

this.infoTipExpr = expr;

return true;
},
});

// ********************************************************************************************* //
Expand Down
1 change: 1 addition & 0 deletions extension/content/firebug/dom/domMemberProvider.js
Expand Up @@ -347,6 +347,7 @@ DOMMemberProvider.prototype =
hasChildren: hasChildren,
tag: tag,
prefix: "",
descriptor: descriptor,
readOnly: (descriptor && !descriptor.writable && !descriptor.set),
// XXX should probably move the tests from getContextMenuItems here
deletable: (!parentIsScope && !(descriptor && !descriptor.configurable))
Expand Down
42 changes: 33 additions & 9 deletions extension/skin/classic/dom.css
Expand Up @@ -15,6 +15,22 @@
overflow: hidden;
}

.memberLabel {
cursor: default;
overflow: hidden;
padding-left: 18px;
white-space: nowrap;
}

.memberLabelPrefix {
color: gray;
margin-right: 3px;
font-weight: normal;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Read Only Properties */

.memberValueCell.readOnly > SPAN {
opacity: 0.5;
}
Expand All @@ -29,17 +45,25 @@
width: 15px;
}

.memberLabel {
cursor: default;
overflow: hidden;
padding-left: 18px;
white-space: nowrap;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Read Only InfoTip */

.readOnlyInfoTip {
margin: 3px;
}

.memberLabelPrefix {
color: gray;
margin-right: 3px;
font-weight: normal;
.readOnlyInfoTip > .name {
font-weight: bold;
margin-bottom: 4px;
font-size: 12px;
}

.readOnlyInfoTip > DIV {
padding: 0 2px 0 2px;
}

.readOnlyInfoTip > DIV.no {
text-decoration: line-through;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Expand Down

0 comments on commit 379bfe6

Please sign in to comment.