PRINTF("PrefStyleSheet disabled\n");
PresShell::SetPreferenceStyleRules(PRBool aForceReflow){  NS_PRECONDITION(mPresContext, "presContext cannot be null");  if (mPresContext) {    nsresult result = NS_OK;    // zeroth, make sure this feature is enabled    // XXX: may get more granularity later     //      (i.e. each pref may be controlled independently)    if (!mEnablePrefStyleSheet) {#ifdef NS_DEBUG      printf("PrefStyleSheet disabled\n");#endif      return PR_TRUE;    }    // first, make sure this is not a chrome shell     nsCOMPtr<nsISupports> container;    result = mPresContext->GetContainer(getter_AddRefs(container));    if (NS_SUCCEEDED(result) && container) {      nsCOMPtr<nsIDocShellTreeItem> docShell(do_QueryInterface(container, &result));      if (NS_SUCCEEDED(result) && docShell){        PRInt32 docShellType;        result = docShell->GetItemType(&docShellType);        if (NS_SUCCEEDED(result)){          if (nsIDocShellTreeItem::typeChrome == docShellType){            return NS_OK;          }        }            }    }    if (NS_SUCCEEDED(result)) {    #ifdef NS_DEBUG      printf("Setting Preference Style Rules:\n");#endif      // if here, we need to create rules for the prefs      // - this includes the background-color, the text-color,      //   the link color, the visited link color and the link-underlining          // first clear any exising rules      result = ClearPreferenceStyleRules();            // now do the color rules      if (NS_SUCCEEDED(result)) {        result = SetPrefColorRules();      }      // now the link rules (must come after the color rules, or links will not be correct color!)      // XXX - when there is both an override and backstop pref stylesheet this won't matter,      //       as the color rules will be overrides and the links rules will be backstop      if (NS_SUCCEEDED(result)) {        result = SetPrefLinkRules();      }      // update the styleset now that we are done inserting our rules      if (NS_SUCCEEDED(result)) {        if (mStyleSet) {          mStyleSet->NotifyStyleSheetStateChanged(PR_FALSE);        }      }    }#ifdef NS_DEBUG    printf( "Preference Style Rules set: error=%ld\n", (long)result);#endif        if (aForceReflow){#ifdef NS_DEBUG      printf( "*** Forcing reframe! ***\n");#endif      // this is harsh, but without it the new colors don't appear on the current page      // Fortunately, it only happens when the prefs change, a rare event.      // XXX - determine why the normal PresContext::RemapStyleAndReflow doesn't cut it      ReconstructFrames();    }    return result;  } else {    return NS_ERROR_NULL_POINTER;  }}