mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Show the root #document node in the Inspector DOM view. Highlight doctype
nodes in a different color. Bug 156072, patch by ajvincent@juno.com (Alex Vincent), r=caillon, sr=bzbarsky
This commit is contained in:
parent
8d87ec2250
commit
41c35baf3c
@ -138,15 +138,19 @@ ViewerRegistry.prototype =
|
||||
// object.
|
||||
//
|
||||
// @param Object aObject - the object being searched against
|
||||
// @param String aPanelId - the id of the panel requesting viewers
|
||||
// @return nsIRDFResource[] - array of entries in the viewer registry
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
findViewersForObject: function(aObject)
|
||||
findViewersForObject: function(aObject, aPanelId)
|
||||
{
|
||||
// check each entry in the registry
|
||||
var len = this.mViewerDS.length;
|
||||
var entry;
|
||||
var urls = [];
|
||||
for (var i = 0; i < len; ++i) {
|
||||
for (var i = 0; i < len; ++i) {
|
||||
if (this.getEntryProperty(i, "panels").indexOf(aPanelId) == -1) {
|
||||
continue;
|
||||
}
|
||||
if (this.objectMatchesEntry(aObject, i)) {
|
||||
if (this.getEntryProperty(i, "important")) {
|
||||
urls.unshift(i);
|
||||
@ -154,7 +158,7 @@ ViewerRegistry.prototype =
|
||||
urls.push(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return urls;
|
||||
},
|
||||
|
@ -567,7 +567,7 @@
|
||||
this.mParams = null;
|
||||
|
||||
// get the list of viewers which match the node
|
||||
var entries = this.registry.findViewersForObject(aObject);
|
||||
var entries = this.registry.findViewersForObject(aObject, this.id);
|
||||
this.rebuildViewerList(entries);
|
||||
|
||||
if (entries.length == 0) {
|
||||
|
@ -3,9 +3,33 @@
|
||||
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:ins="http://www.mozilla.org/inspector#">
|
||||
|
||||
<!-- Inspector-specific RDF attributes
|
||||
xmlns:ins Sets the ins: prefix to an Inspector-specific namespace URI.
|
||||
|
||||
ins:uid Sets the basic viewer filename Inspector uses to find the viewer XUL file.
|
||||
For example, ins:uid="dom" leads to chrome://inspector/content/viewers/dom/dom.xul
|
||||
(ViewerRegistry.js#getEntryURL())
|
||||
|
||||
ins:panels This determines which DOM Inspector panels, by id, the viewer referenced is valid for.
|
||||
For example, ins:panels="bxObjectPanel bxObjPanel" means the panel id must be
|
||||
bxObjectPanel or bxObjPanel.
|
||||
|
||||
ins:description
|
||||
This sets a title for the viewer.
|
||||
|
||||
ins:icon This sets an icon for the viewer. Currently unused.
|
||||
|
||||
ins:filter This determines which nodes (or in the case of JavaScript Object viewer, values), the viewer
|
||||
referenced is valid for.
|
||||
For example, ins:filter="return doesQI(object, 'nsIDOMDocument');" is a JavaScript fragment
|
||||
ViewerRegistry.js uses to define a filter function if the panel's subject node is an instance
|
||||
of nsIDOMDocument.
|
||||
-->
|
||||
|
||||
<rdf:Seq about="inspector:viewers">
|
||||
<rdf:li><rdf:Description
|
||||
ins:uid="dom"
|
||||
ins:panels="bxDocPanel"
|
||||
ins:description="DOM Nodes"
|
||||
ins:icon="chrome://inspector/content/viewers/dom/dom-icon.gif"
|
||||
ins:filter="return doesQI(object, 'nsIDOMDocument');"/>
|
||||
@ -13,42 +37,49 @@
|
||||
|
||||
<rdf:li><rdf:Description
|
||||
ins:uid="stylesheets"
|
||||
ins:panels="bxDocPanel"
|
||||
ins:description="Stylesheets"
|
||||
ins:filter="return doesQI(object, 'nsIDOMDocument');"/>
|
||||
</rdf:li>
|
||||
|
||||
<rdf:li><rdf:Description
|
||||
ins:uid="domNode"
|
||||
ins:panels="bxObjectPanel bxObjPanel"
|
||||
ins:description="DOM Node"
|
||||
ins:filter="return doesQI(object, 'nsIDOMNode') && object.nodeType != Node.DOCUMENT_NODE;"/>
|
||||
ins:filter="return doesQI(object, 'nsIDOMNode')"/>
|
||||
</rdf:li>
|
||||
|
||||
<rdf:li><rdf:Description
|
||||
ins:uid="boxModel"
|
||||
ins:panels="bxObjectPanel bxObjPanel"
|
||||
ins:description="Box Model"
|
||||
ins:filter="return doesQI(object, 'nsIDOMElement');"/>
|
||||
</rdf:li>
|
||||
|
||||
<rdf:li><rdf:Description
|
||||
ins:uid="xblBindings"
|
||||
ins:panels="bxObjectPanel bxObjPanel"
|
||||
ins:description="XBL Bindings"
|
||||
ins:filter="return doesQI(object, 'nsIDOMElement');"/>
|
||||
</rdf:li>
|
||||
|
||||
<rdf:li><rdf:Description
|
||||
ins:uid="styleRules"
|
||||
ins:panels="bxObjectPanel bxObjPanel"
|
||||
ins:description="CSS Style Rules"
|
||||
ins:filter="return doesQI(object, 'nsIDOMElement') || doesQI(object, 'nsIDOMCSSStyleSheet');"/>
|
||||
</rdf:li>
|
||||
|
||||
<rdf:li><rdf:Description
|
||||
ins:uid="computedStyle"
|
||||
ins:panels="bxObjectPanel bxObjPanel"
|
||||
ins:description="Computed Style"
|
||||
ins:filter="return doesQI(object, 'nsIDOMElement');"/>
|
||||
</rdf:li>
|
||||
|
||||
<rdf:li><rdf:Description
|
||||
ins:uid="jsObject"
|
||||
ins:panels="bxDocPanel bxObjectPanel bxObjPanel"
|
||||
ins:description="Javascript Object"
|
||||
ins:filter="return true;"/>
|
||||
</rdf:li>
|
||||
|
@ -82,6 +82,7 @@ InspectorSidebar.prototype =
|
||||
this.installNavObserver();
|
||||
|
||||
this.mPanelSet = document.getElementById("bxPanelSet");
|
||||
this.mPanelSet.addObserver("panelsetready", this, false);
|
||||
this.mPanelSet.initialize();
|
||||
},
|
||||
|
||||
@ -98,6 +99,23 @@ InspectorSidebar.prototype =
|
||||
{
|
||||
return this.mPanelSet.registry.getViewerByUID(aUID);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//// Viewer Panels
|
||||
|
||||
initViewerPanels: function()
|
||||
{
|
||||
this.mDocPanel = this.mPanelSet.getPanel(0);
|
||||
this.mDocPanel.addObserver("subjectChange", this, false);
|
||||
this.mObjectPanel = this.mPanelSet.getPanel(1);
|
||||
},
|
||||
|
||||
onEvent: function(aEvent)
|
||||
{
|
||||
if (aEvent.type == "panelsetready") {
|
||||
this.initViewerPanels();
|
||||
}
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//// Navigation
|
||||
|
@ -112,7 +112,7 @@ DOMViewer.prototype =
|
||||
get subject() { return this.mSubject },
|
||||
set subject(aObject) {
|
||||
this.mSubject = aObject;
|
||||
this.mDOMView.rootNode = aObject.documentElement;
|
||||
this.mDOMView.rootNode = aObject;
|
||||
this.mObsMan.dispatchEvent("subjectChange", { subject: aObject });
|
||||
this.setInitialSelection(aObject);
|
||||
},
|
||||
@ -281,7 +281,7 @@ DOMViewer.prototype =
|
||||
if (this.mPanel.params)
|
||||
this.selectElementInTree(this.mPanel.params);
|
||||
else
|
||||
this.selectElementInTree(aObject.documentElement, true);
|
||||
this.selectElementInTree(aObject, true);
|
||||
|
||||
if (fireSelected)
|
||||
this.onItemSelected();
|
||||
@ -745,7 +745,7 @@ DOMViewer.prototype =
|
||||
|
||||
getAllDocuments: function()
|
||||
{
|
||||
var doc = this.mDOMView.rootNode.ownerDocument;
|
||||
var doc = this.mDOMView.rootNode;
|
||||
var results = [doc];
|
||||
this.findDocuments(doc, results);
|
||||
return results;
|
||||
|
@ -61,6 +61,10 @@ treechildren:-moz-tree-cell-text(DOCUMENT_NODE) {
|
||||
color: #800080;
|
||||
}
|
||||
|
||||
treechildren:-moz-tree-cell-text(DOCUMENT_TYPE_NODE) {
|
||||
color: #606000;
|
||||
}
|
||||
|
||||
treechildren:-moz-tree-cell-text(PROCESSING_INSTRUCTION_NODE) {
|
||||
color: #808080;
|
||||
}
|
||||
|
@ -61,6 +61,10 @@ treechildren:-moz-tree-cell-text(DOCUMENT_NODE) {
|
||||
color: #800080;
|
||||
}
|
||||
|
||||
treechildren:-moz-tree-cell-text(DOCUMENT_TYPE_NODE) {
|
||||
color: #606000;
|
||||
}
|
||||
|
||||
treechildren:-moz-tree-cell-text(PROCESSING_INSTRUCTION_NODE) {
|
||||
color: #808080;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user