mInner->AddSheet(this);  if (aCopy.mRuleCollection && aCopy.mRuleCollection->mRulesAccessed) { EnsureUniqueInner(); }  if (aCopy.mMedia) { NS_NewISupportsArray(&mMedia); if (mMedia) { mMedia->AppendElements(aCopy.mMedia); } }  if (aCopy.mFirstChild) { CSSStyleSheetImpl*  otherChild = aCopy.mFirstChild; CSSStyleSheetImpl** ourSlot = &mFirstChild; do { CSSStyleSheetImpl* child = new CSSStyleSheetImpl(*otherChild); if (child) { NS_ADDREF(child); (*ourSlot) = child; ourSlot = &(child->mNext); } otherChild = otherChild->mNext; } while (otherChild && ourSlot); }
mInner = new CSSStyleSheetInner(this);
CSSStyleSheetImpl::CSSStyleSheetImpl(const CSSStyleSheetImpl& aCopy)  : nsICSSStyleSheet(),    mTitle(aCopy.mTitle),     mMedia(nsnull),    mFirstChild(nsnull),     mNext(nsnull),    mParent(aCopy.mParent),    mImportsCollection(nsnull), // re-created lazily    mRuleCollection(nsnull), // re-created lazily    mDocument(aCopy.mDocument),    mOwningNode(aCopy.mOwningNode),    mDisabled(aCopy.mDisabled),    mDirty(PR_FALSE),    mScriptObject(nsnull),    mInner(aCopy.mInner){  NS_INIT_REFCNT();  nsCSSAtoms::AddRefAtoms();  mInner->AddSheet(this);  if (aCopy.mRuleCollection &&       aCopy.mRuleCollection->mRulesAccessed) {  // CSSOM's been there, force full copy now    EnsureUniqueInner();  }  if (aCopy.mMedia) {    NS_NewISupportsArray(&mMedia);    if (mMedia) {      mMedia->AppendElements(aCopy.mMedia);    }  }  if (aCopy.mFirstChild) {    CSSStyleSheetImpl*  otherChild = aCopy.mFirstChild;    CSSStyleSheetImpl** ourSlot = &mFirstChild;    do {      CSSStyleSheetImpl* child = new CSSStyleSheetImpl(*otherChild);      if (child) {        NS_ADDREF(child);        (*ourSlot) = child;        ourSlot = &(child->mNext);      }      otherChild = otherChild->mNext;    }    while (otherChild && ourSlot);  }#ifdef DEBUG_REFS  ++gInstanceCount;  fprintf(stdout, "%d + CSSStyleSheet size: %d\n", gInstanceCount, sizeof(*this));#endif}