B2G/gecko/browser/devtools/styleinspector/CssLogic.jsm
/**
   * Build the array of matched rules for the currently highlighted element.
   * The array will hold rules that match the viewedElement and its parents.
   *
   * @private
   */
Build the array of matched rules for the currently highlighted element.
The array will hold rules that match the viewedElement and its parents.

@private
Build the array of matched rules for the currently highlighted element . The array will hold rules that match the viewedElement and its parents . @private
function CL__buildMatchedRules()
  {
    let domRules;
    let element = this.viewedElement;
    let filter = this.sourceFilter;
    let sheetIndex = 0;
    this._matchId++;
    this._passId++;
    this._matchedRules = [];
    if (!element) {
      return;
    }
    do {
      let status = this.viewedElement === element ?
                   CssLogic.STATUS.MATCHED : CssLogic.STATUS.PARENT_MATCH;
      try {
        domRules = this.domUtils.getCSSStyleRules(element);
      } catch (ex) {
        Services.console.
          logStringMessage("CL__buildMatchedRules error: " + ex);
        continue;
      }
      for (let i = 0, n = domRules.Count(); i < n; i++) {
        let domRule = domRules.GetElementAt(i);
        if (domRule.type !== Ci.nsIDOMCSSRule.STYLE_RULE) {
          continue;
        }
        let sheet = this.getSheet(domRule.parentStyleSheet, -1);
        if (sheet._passId !== this._passId) {
          sheet.index = sheetIndex++;
          sheet._passId = this._passId;
        }
        if (filter === CssLogic.FILTER.ALL && !sheet.contentSheet) {
          continue;
        }
        let rule = sheet.getRule(domRule);
        if (rule._passId === this._passId) {
          continue;
        }
        rule._matchId = this._matchId;
        rule._passId = this._passId;
        this._matchedRules.push([rule, status]);
      }
      if (element.style.length > 0) {
        let rule = new CssRule(null, { style: element.style }, element);
        rule._matchId = this._matchId;
        rule._passId = this._passId;
        this._matchedRules.push([rule, status]);
      }
    } while ((element = element.parentNode) &&
              element.nodeType === Ci.nsIDOMNode.ELEMENT_NODE);
  }
function CL__buildMatchedRules ( ) { let domRules ; let element = this . viewedElement ; let filter = this . sourceFilter ; let sheetIndex = 0 ; this . _matchId ++ ; this . _passId ++ ; this . _matchedRules = [ ] ; if ( ! element ) { return ; } do { let status = this . viewedElement === element ? CssLogic . STATUS . MATCHED : CssLogic . STATUS . PARENT_MATCH ; try { domRules = this . domUtils . getCSSStyleRules ( element ) ; } catch ( ex ) { Services . console . logStringMessage ( "CL__buildMatchedRules error: " + ex ) ; continue ; } for ( let i = 0 , n = domRules . Count ( ) ; i < n ; i ++ ) { let domRule = domRules . GetElementAt ( i ) ; if ( domRule . type !== Ci . nsIDOMCSSRule . STYLE_RULE ) { continue ; } let sheet = this . getSheet ( domRule . parentStyleSheet , - 1 ) ; if ( sheet . _passId !== this . _passId ) { sheet . index = sheetIndex ++ ; sheet . _passId = this . _passId ; } if ( filter === CssLogic . FILTER . ALL && ! sheet . contentSheet ) { continue ; } let rule = sheet . getRule ( domRule ) ; if ( rule . _passId === this . _passId ) { continue ; } rule . _matchId = this . _matchId ; rule . _passId = this . _passId ; this . _matchedRules . push ( [ rule , status ] ) ; } if ( element . style . length > 0 ) { let rule = new CssRule ( null , { style : element . style } , element ) ; rule . _matchId = this . _matchId ; rule . _passId = this . _passId ; this . _matchedRules . push ( [ rule , status ] ) ; } } while ( ( element = element . parentNode ) && element . nodeType === Ci . nsIDOMNode . ELEMENT_NODE ) ; }
Build the array of matched rules for the currently highlighted element.
Build the array of matched rules for the currently highlighted element .
// Add element.style information.