SupportsKey key(aParentSheet); nsVoidArray*  sheetMap = (nsVoidArray*)mSheetMapTable.Get(&key); if (! sheetMap) { sheetMap = new nsVoidArray(); if (sheetMap) { mSheetMapTable.Put(&key, sheetMap); } }
aSheet->SetEnabled(PR_TRUE);  aParentSheet->AppendStyleSheet(aSheet); aParentRule->SetSheet(aSheet);
CSSLoaderImpl::InsertChildSheet(nsICSSStyleSheet* aSheet, nsICSSStyleSheet* aParentSheet,                                 PRInt32 aIndex){  if ((! aParentSheet) || (! aSheet)) {    return NS_ERROR_NULL_POINTER;  }  SupportsKey key(aParentSheet);  nsVoidArray*  sheetMap = (nsVoidArray*)mSheetMapTable.Get(&key);  if (! sheetMap) {    sheetMap = new nsVoidArray();    if (sheetMap) {      mSheetMapTable.Put(&key, sheetMap);    }  }  if (sheetMap) {    PRInt32 insertIndex = sheetMap->Count();    while (0 <= --insertIndex) {      PRInt32 targetIndex = (PRInt32)sheetMap->ElementAt(insertIndex);      if (targetIndex < aIndex) {        aParentSheet->InsertStyleSheetAt(aSheet, insertIndex + 1);        sheetMap->InsertElementAt((void*)aIndex, insertIndex + 1);        aSheet = nsnull;        break;      }    }    if (nsnull != aSheet) { // didn't insert yet      aParentSheet->InsertStyleSheetAt(aSheet, 0);      sheetMap->InsertElementAt((void*)aIndex, 0);    }    return NS_OK;  }  return NS_ERROR_OUT_OF_MEMORY;}