layout/inspector/inIDOMUtils.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/inspector/inIDOMUtils.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,110 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "nsISupports.idl"
     1.9 +
    1.10 +interface nsIArray;
    1.11 +interface nsISupportsArray;
    1.12 +interface nsIDOMCharacterData;
    1.13 +interface nsIDOMElement;
    1.14 +interface nsIDOMDocument;
    1.15 +interface nsIDOMCSSStyleRule;
    1.16 +interface nsIDOMNode;
    1.17 +interface nsIDOMNodeList;
    1.18 +interface nsIDOMFontFaceList;
    1.19 +interface nsIDOMRange;
    1.20 +interface nsIDOMCSSStyleSheet;
    1.21 +
    1.22 +[scriptable, uuid(ceae6c68-f5d4-4597-a3d9-ca5646c25f1a)]
    1.23 +interface inIDOMUtils : nsISupports
    1.24 +{
    1.25 +  // CSS utilities
    1.26 +  void getAllStyleSheets (in nsIDOMDocument aDoc,
    1.27 +                          [optional] out unsigned long aLength,
    1.28 +                          [array, size_is (aLength), retval] out nsISupports aSheets);
    1.29 +  nsISupportsArray getCSSStyleRules(in nsIDOMElement aElement, [optional] in DOMString aPseudo);
    1.30 +  unsigned long getRuleLine(in nsIDOMCSSStyleRule aRule);
    1.31 +  unsigned long getRuleColumn(in nsIDOMCSSStyleRule aRule);
    1.32 +
    1.33 +  // Utilities for working with selectors.  We don't have a JS OM representation
    1.34 +  // of a single selector or a selector list yet, but given a rule we can index
    1.35 +  // into the selector list.
    1.36 +  //
    1.37 +  // This is a somewhat backwards API; once we move StyleRule to WebIDL we
    1.38 +  // should consider using [ChromeOnly] APIs on that.
    1.39 +  unsigned long getSelectorCount(in nsIDOMCSSStyleRule aRule);
    1.40 +  // For all three functions below, aSelectorIndex is 0-based
    1.41 +  AString getSelectorText(in nsIDOMCSSStyleRule aRule,
    1.42 +                          in unsigned long aSelectorIndex);
    1.43 +  unsigned long long getSpecificity(in nsIDOMCSSStyleRule aRule,
    1.44 +                                    in unsigned long aSelectorIndex);
    1.45 +  // Note: This does not handle scoped selectors correctly, because it has no
    1.46 +  // idea what the right scope is.
    1.47 +  bool selectorMatchesElement(in nsIDOMElement aElement,
    1.48 +                              in nsIDOMCSSStyleRule aRule,
    1.49 +                              in unsigned long aSelectorIndex);
    1.50 +
    1.51 +  // Utilities for working with CSS properties
    1.52 +  //
    1.53 +  // Returns true if the string names a property that is inherited by default.
    1.54 +  bool isInheritedProperty(in AString aPropertyName);
    1.55 +
    1.56 +  // Get a list of all our supported property names.  Optionally
    1.57 +  // shorthands can be excluded or property aliases included.
    1.58 +  const unsigned long EXCLUDE_SHORTHANDS = (1<<0);
    1.59 +  const unsigned long INCLUDE_ALIASES = (1<<1);
    1.60 +  void getCSSPropertyNames([optional] in unsigned long aFlags,
    1.61 +			   [optional] out unsigned long aCount,
    1.62 +			   [retval, array, size_is(aCount)] out wstring aProps);
    1.63 +
    1.64 +  // Get a list of all valid keywords and colors for aProperty.
    1.65 +  void getCSSValuesForProperty(in AString aProperty,
    1.66 +                               [optional] out unsigned long aLength,
    1.67 +                               [array, size_is(aLength), retval] out wstring aValues);
    1.68 +
    1.69 +  // Utilities for working with CSS colors
    1.70 +  [implicit_jscontext]
    1.71 +  jsval colorNameToRGB(in DOMString aColorName);
    1.72 +  AString rgbToColorName(in octet aR, in octet aG, in octet aB);
    1.73 +
    1.74 +  // DOM Node utilities
    1.75 +  boolean isIgnorableWhitespace(in nsIDOMCharacterData aDataNode);
    1.76 +  // Returns the "parent" of a node.  The parent of a document node is the
    1.77 +  // frame/iframe containing that document.  aShowingAnonymousContent says
    1.78 +  // whether we are showing anonymous content.
    1.79 +  nsIDOMNode getParentForNode(in nsIDOMNode aNode,
    1.80 +                              in boolean aShowingAnonymousContent);
    1.81 +  nsIDOMNodeList getChildrenForNode(in nsIDOMNode aNode,
    1.82 +                                    in boolean aShowingAnonymousContent);
    1.83 +  
    1.84 +  // XBL utilities
    1.85 +  nsIArray getBindingURLs(in nsIDOMElement aElement);
    1.86 +
    1.87 +  // content state utilities
    1.88 +  unsigned long long getContentState(in nsIDOMElement aElement);
    1.89 +  void setContentState(in nsIDOMElement aElement, in unsigned long long aState);
    1.90 +
    1.91 +  nsIDOMFontFaceList getUsedFontFaces(in nsIDOMRange aRange);
    1.92 +
    1.93 +  // pseudo-class style locking methods. aPseudoClass must be a valid pseudo-class
    1.94 +  // selector string, e.g. ":hover". ":-moz-any-link" and non-event-state
    1.95 +  // pseudo-classes are ignored.
    1.96 +  void addPseudoClassLock(in nsIDOMElement aElement, in DOMString aPseudoClass);
    1.97 +  void removePseudoClassLock(in nsIDOMElement aElement, in DOMString aPseudoClass);
    1.98 +  bool hasPseudoClassLock(in nsIDOMElement aElement, in DOMString aPseudoClass);
    1.99 +  void clearPseudoClassLocks(in nsIDOMElement aElement);
   1.100 +
   1.101 +  /**
   1.102 +   * Parse CSS and update the style sheet in place.
   1.103 +   *
   1.104 +   * @param DOMCSSStyleSheet aSheet
   1.105 +   * @param DOMString aInput
   1.106 +   *        The new source string for the style sheet.
   1.107 +   */
   1.108 +  void parseStyleSheet(in nsIDOMCSSStyleSheet aSheet, in DOMString aInput);
   1.109 +};
   1.110 +
   1.111 +%{ C++
   1.112 +#define IN_DOMUTILS_CONTRACTID "@mozilla.org/inspector/dom-utils;1"
   1.113 +%}

mercurial