<?xml version="1.0"?>

<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.

                @param object - nsIDOMNode object (or in the case of JavaScript
                  Object viewer, JavaScript object).
                @param linkedViewer - linked viewer object.

                For example, ins:filter=
                "return object instanceof Components.interfaces.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 object instanceof Components.interfaces.nsIDOMDocument;"/>
    </rdf:li>

    <rdf:li><rdf:Description 
      ins:uid="stylesheets"
      ins:panels="bxDocPanel"
      ins:description="Stylesheets"
      ins:filter="return object instanceof Components.interfaces.nsIDOMDocument;"/>
    </rdf:li>

    <rdf:li><rdf:Description 
      ins:uid="domNode"
      ins:panels="bxObjectPanel bxObjPanel"
      ins:description="DOM Node"
      ins:filter="return object instanceof Components.interfaces.nsIDOMNode;"/>
    </rdf:li>

    <rdf:li><rdf:Description 
      ins:uid="boxModel"
      ins:panels="bxObjectPanel bxObjPanel"
      ins:description="Box Model"
      ins:filter="return object instanceof Components.interfaces.nsIDOMElement;"/>
    </rdf:li>

    <rdf:li><rdf:Description 
      ins:uid="xblBindings"
      ins:panels="bxObjectPanel bxObjPanel"
      ins:description="XBL Bindings"
      ins:filter="return object instanceof Components.interfaces.nsIDOMElement;"/>
    </rdf:li>

    <rdf:li><rdf:Description
      ins:uid="styleRules"
      ins:panels="bxObjectPanel bxObjPanel"
      ins:description="CSS Style Rules"
      ins:filter="return object instanceof Components.interfaces.nsIDOMElement || object instanceof Components.interfaces.nsIDOMCSSStyleSheet;"/>
    </rdf:li>

    <rdf:li><rdf:Description 
      ins:uid="computedStyle"
      ins:panels="bxObjectPanel bxObjPanel"
      ins:description="Computed Style"
      ins:filter="return object instanceof Components.interfaces.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>

    <rdf:li>
      <rdf:Description ins:uid="accessibleEvent"
                       ins:panels="bxObjectPanel bxObjPanel"
                       ins:description="Accessible Event">
        <ins:filter><![CDATA[
          if (!linkedViewer ||
              !(object instanceof Components.interfaces.nsIDOMNode))
            return false;

          if (linkedViewer.uid != "accessibleEvents")
            return false;

          return object.getUserData("accessibleEvent");
        ]]></ins:filter>
      </rdf:Description>
    </rdf:li>

    <rdf:li>
      <rdf:Description ins:uid="accessibleObject"
                       ins:panels="bxObjectPanel bxObjPanel"
                       ins:description="Accessible Object">
        <ins:filter><![CDATA[
          if (!linkedViewer ||
              !(object instanceof Components.interfaces.nsIDOMNode))
            return false;

          if (linkedViewer.uid != "accessibleEvents" &&
              linkedViewer.uid != "accessibleTree" &&
              (linkedViewer.uid != "dom" || !linkedViewer.getAccessibleNodes()))
            return false;

          try {
            var accService =
              Components.classes["@mozilla.org/accessibleRetrieval;1"]
                        .getService(Components.interfaces.nsIAccessibleRetrieval);

            return accService.getAttachedAccessibleFor(object);
          } catch(e) {
            return false;
          }
        ]]></ins:filter>
      </rdf:Description>
    </rdf:li>

    <rdf:li>
      <rdf:Description ins:uid="accessibleProps"
                       ins:panels="bxObjectPanel bxObjPanel"
                       ins:description="Accessible Properties">
        <ins:filter><![CDATA[
          if (!linkedViewer ||
              !(object instanceof Components.interfaces.nsIDOMNode))
            return false;

          if (linkedViewer.uid != "accessibleEvents" &&
              linkedViewer.uid != "accessibleTree" &&
              (linkedViewer.uid != "dom" || !linkedViewer.getAccessibleNodes()))
            return false;

          try {
            var accService =
              Components.classes["@mozilla.org/accessibleRetrieval;1"]
                        .getService(Components.interfaces.nsIAccessibleRetrieval);

            return accService.getAttachedAccessibleFor(object);
          } catch(e) {
            return false;
          }
        ]]></ins:filter>
      </rdf:Description>
    </rdf:li>

    <rdf:li>
      <rdf:Description ins:uid="accessibleRelations"
                       ins:panels="bxObjectPanel bxObjPanel"
                       ins:description="Accessible Relations">
        <ins:filter><![CDATA[
          if (!linkedViewer ||
              !(object instanceof Components.interfaces.nsIDOMNode))
            return false;

          if (linkedViewer.uid != "accessibleEvents" &&
              linkedViewer.uid != "accessibleTree" &&
              (linkedViewer.uid != "dom" || !linkedViewer.getAccessibleNodes()))
            return false;

          try {
            var accService =
              Components.classes["@mozilla.org/accessibleRetrieval;1"]
                        .getService(Components.interfaces.nsIAccessibleRetrieval);

            return accService.getAttachedAccessibleFor(object);
          } catch(e) {
            return false;
          }
        ]]></ins:filter>
      </rdf:Description>
    </rdf:li>

    <rdf:li>
      <rdf:Description ins:uid="accessibleEvents"
                       ins:panels="bxDocPanel"
                       ins:description="Accessible Events">
        <ins:filter><![CDATA[
          return object instanceof Components.interfaces.nsIDOMDocument &&
            "@mozilla.org/accessibleRetrieval;1" in Components.classes;
        ]]></ins:filter>
      </rdf:Description>
    </rdf:li>

    <rdf:li>
      <rdf:Description ins:uid="accessibleTree"
                       ins:panels="bxDocPanel"
                       ins:description="Accessible Tree">
        <ins:filter><![CDATA[
          return object instanceof Components.interfaces.nsIDOMDocument &&
            "@mozilla.org/accessibleRetrieval;1" in Components.classes;
        ]]></ins:filter>
      </rdf:Description>
    </rdf:li>
  </rdf:Seq>

</rdf:RDF>
