NS_PRECONDITION(nsnull != aSheet, "null arg");  if (NS_SUCCEEDED(WillDirty())) { NS_ADDREF(aSheet); CSSStyleSheetImpl* sheet = (CSSStyleSheetImpl*)aSheet;  if (! mFirstChild) { mFirstChild = sheet; } else { CSSStyleSheetImpl* child = mFirstChild; while (child->mNext) { child = child->mNext; } child->mNext = sheet; }    sheet->mParent = this; DidDirty();
nsresult result = NS_OK; if (! mSheets) { result = NS_NewISupportsArray(&mSheets);
CSSStyleSheetImpl::AppendStyleSheet(nsICSSStyleSheet* aSheet){  NS_PRECONDITION(nsnull != aSheet, "null arg");  if (NS_SUCCEEDED(WillDirty())) {    NS_ADDREF(aSheet);    CSSStyleSheetImpl* sheet = (CSSStyleSheetImpl*)aSheet;    if (! mFirstChild) {      mFirstChild = sheet;    }    else {      CSSStyleSheetImpl* child = mFirstChild;      while (child->mNext) {        child = child->mNext;      }      child->mNext = sheet;    }      // This is not reference counted. Our parent tells us when    // it's going away.    sheet->mParent = this;    DidDirty();  }  return NS_OK;}