Ejemplo n.º 1
0
NS_IMETHODIMP
inDOMUtils::GetRelativeRuleLine(nsIDOMCSSRule* aRule, uint32_t* _retval)
{
  NS_ENSURE_ARG_POINTER(aRule);

  Rule* rule = aRule->GetCSSRule();
  if (!rule) {
    return NS_ERROR_FAILURE;
  }

  uint32_t lineNumber = rule->GetLineNumber();
  CSSStyleSheet* sheet = rule->GetStyleSheet();
  if (sheet) {
    nsINode* owningNode = sheet->GetOwnerNode();
    if (owningNode) {
      nsCOMPtr<nsIStyleSheetLinkingElement> link =
        do_QueryInterface(owningNode);
      if (link) {
        lineNumber -= link->GetLineNumber() - 1;
      }
    }
  }

  *_retval = lineNumber;
  return NS_OK;
}
Ejemplo n.º 2
0
NS_IMETHODIMP
inDOMUtils::GetRuleLine(nsIDOMCSSRule* aRule, uint32_t* _retval)
{
  NS_ENSURE_ARG_POINTER(aRule);

  Rule* rule = aRule->GetCSSRule();
  if (!rule) {
    return NS_ERROR_FAILURE;
  }

  *_retval = rule->GetLineNumber();
  return NS_OK;
}