Skip to content

Commit 75aef02

Browse files
committed
Markup view customization (bug 1036949)
1 parent 2d32d62 commit 75aef02

File tree

3 files changed

+38
-8
lines changed

3 files changed

+38
-8
lines changed

lib/firequery-actor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ function hasJQueryData(object) {
363363

364364
// Patching NodeActor (add custom info into actor form)
365365
// xxxHonza: Bug 1036949 - New API: MarkupView customization
366-
let originalForm = NodeActor.prototype.form;
366+
/*let originalForm = NodeActor.prototype.form;
367367
NodeActor.prototype.form = function() {
368368
let form = originalForm.apply(this, arguments);
369369
if (!form.setProperty) {
@@ -377,7 +377,7 @@ NodeActor.prototype.form = function() {
377377
DebuggerServer.emit("domnode-form", this, form);
378378
}
379379
return form;
380-
}
380+
}*/
381381

382382
// Exports from this module
383383
exports.FireQueryActor = FireQueryActor;

lib/inspector-overlay.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ const InspectorOverlay = Class(
5050
Trace.sysout("InspectorOverlay.initialize;", options);
5151

5252
// MarkupView events
53-
this.onMarkupViewRender = this.onMarkupViewRender.bind(this);
5453
this.onMarkupViewLoaded = this.onMarkupViewLoaded.bind(this);
5554
this.onMarkupViewUnloaded = this.onMarkupViewUnloaded.bind(this);
5655
this.onMarkupMutation = this.onMarkupMutation.bind(this);
5756
this.onInspectorUpdated = this.onInspectorUpdated.bind(this);
57+
this.onMarkupViewContainerCreated = this.onMarkupViewContainerCreated.bind(this);
5858

5959
// Tooltip events
6060
this.onClickTooltip = this.onClickTooltip.bind(this);
@@ -88,10 +88,10 @@ const InspectorOverlay = Class(
8888
Trace.sysout("InspectorOverlay.onBuild;", options);
8989

9090
// Handle MarkupView events.
91-
this.panel.on("markupview-render", this.onMarkupViewRender);
9291
this.panel.on("markuploaded", this.onMarkupViewLoaded);
9392
this.panel.on("markupmutation", this.onMarkupMutation);
9493
this.panel.on("inspector-updated", this.onInspectorUpdated);
94+
this.panel.on("container-created", this.onMarkupViewContainerCreated)
9595

9696
// Listen to {@FireQueryToolboxOverlay} events related to
9797
// backend actor attach and detach.
@@ -177,17 +177,29 @@ const InspectorOverlay = Class(
177177
},
178178

179179
onInspectorUpdated: function(eventId, name) {
180-
Trace.sysout("+++InspectorOverlay.onInspectorUpdated; " + name, arguments);
180+
Trace.sysout("InspectorOverlay.onInspectorUpdated; " + name, arguments);
181181
},
182182

183183
onMarkupMutation: function(eventId) {
184-
Trace.sysout("+++InspectorOverlay.onMarkupMutation; ", arguments);
184+
Trace.sysout("InspectorOverlay.onMarkupMutation; ", arguments);
185185
},
186186

187-
onMarkupViewRender: function(eventId, node, type, data, options) {
188-
this.renderNode(node, type, data);
187+
onMarkupViewContainerCreated: function(eventId, container) {
188+
Trace.sysout("InspectorOverlay.onMarkupViewContainerCreated; ", arguments);
189+
190+
let nodeFront = container.node;
191+
let hasJQueryData = nodeFront.getProperty ?
192+
nodeFront.getProperty("hasJQueryData") :
193+
nodeFront._form.props.hasJQueryData;
194+
195+
if (!hasJQueryData) {
196+
return;
197+
}
198+
199+
this.createDataIcon(container.elt);
189200
},
190201

202+
// xxxHonza: TODO remove
191203
renderNode: function(node, type, data) {
192204
if (type != "element") {
193205
return;

lib/markup-view-patch.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,24 @@ MarkupView.prototype.template = function(aName, aDest, aOptions) {
2525
return node;
2626
}
2727

28+
let originalImportNode = MarkupView.prototype.importNode;
29+
MarkupView.prototype.importNode = function(aNode, aFlashNode) {
30+
let has = this._containers.has(aNode);
31+
let container = originalImportNode.apply(this, arguments);
32+
33+
if (has) {
34+
return container;
35+
}
36+
37+
if (!container) {
38+
return null;
39+
}
40+
41+
//this._inspector.emit("container-created", container);
42+
43+
return container;
44+
}
45+
2846
function shutdown() {
2947
MarkupView.prototype.template = originalTemplate;
3048

0 commit comments

Comments
 (0)