Backing out bug 237407 because of tbox orange that I can't easily diagnose.

This commit is contained in:
bsmedberg%covad.net 2004-03-22 15:03:32 +00:00
parent 4cee40678e
commit ac244f2a9c
5 changed files with 45 additions and 51 deletions

View File

@ -63,6 +63,7 @@ private:
~nsLayoutStylesheetCache();
static void EnsureGlobal();
void InitFromSkin();
void InitFromProfile();
static void LoadSheetFile(nsIFile* aFile, nsCOMPtr<nsICSSStyleSheet> &aSheet);
static void LoadSheet(nsIURI* aURI, nsCOMPtr<nsICSSStyleSheet> &aSheet);

View File

@ -54,6 +54,7 @@ nsLayoutStylesheetCache::Observe(nsISupports* aSubject,
const PRUnichar* aData)
{
if (!strcmp(aTopic, "profile-before-change")) {
mScrollbarsSheet = nsnull;
mUserContentSheet = nsnull;
mUserChromeSheet = nsnull;
}
@ -62,8 +63,7 @@ nsLayoutStylesheetCache::Observe(nsISupports* aSubject,
}
else if (strcmp(aTopic, "chrome-flush-skin-caches") == 0 ||
strcmp(aTopic, "chrome-flush-caches") == 0) {
mScrollbarsSheet = nsnull;
mFormsSheet = nsnull;
InitFromSkin();
}
else {
NS_NOTREACHED("Unexpected observer topic.");
@ -78,17 +78,6 @@ nsLayoutStylesheetCache::ScrollbarsSheet()
if (!gStyleCache)
return nsnull;
if (!gStyleCache->mScrollbarsSheet) {
nsCOMPtr<nsIURI> sheetURI;
NS_NewURI(getter_AddRefs(sheetURI),
NS_LITERAL_CSTRING("chrome://global/skin/scrollbars.css"));
if (sheetURI)
LoadSheet(sheetURI, gStyleCache->mScrollbarsSheet);
NS_ASSERTION(gStyleCache->mScrollbarsSheet, "Could not load scrollbars.css.");
}
return gStyleCache->mScrollbarsSheet;
}
@ -99,17 +88,6 @@ nsLayoutStylesheetCache::FormsSheet()
if (!gStyleCache)
return nsnull;
if (!gStyleCache->mFormsSheet) {
nsCOMPtr<nsIURI> sheetURI;
NS_NewURI(getter_AddRefs(sheetURI),
NS_LITERAL_CSTRING("resource://gre/res/platform-forms.css"));
if (sheetURI)
LoadSheet(sheetURI, gStyleCache->mFormsSheet);
NS_ASSERTION(gStyleCache->mFormsSheet, "Could not load platform-forms.css.");
}
return gStyleCache->mFormsSheet;
}
@ -152,7 +130,14 @@ nsLayoutStylesheetCache::nsLayoutStylesheetCache()
obsSvc->AddObserver(this, "chrome-flush-caches", PR_FALSE);
}
nsCOMPtr<nsIURI> formsSheetURI;
NS_NewURI(getter_AddRefs(formsSheetURI),
NS_LITERAL_CSTRING("resource://gre/res/platform-forms.css"));
LoadSheet(formsSheetURI, mFormsSheet);
NS_ASSERTION(mFormsSheet, "Could not load platform-forms.css stylesheet.");
InitFromProfile();
InitFromSkin();
}
nsLayoutStylesheetCache::~nsLayoutStylesheetCache()
@ -194,6 +179,18 @@ nsLayoutStylesheetCache::InitFromProfile()
LoadSheetFile(chromeFile, mUserChromeSheet);
}
void
nsLayoutStylesheetCache::InitFromSkin()
{
nsCOMPtr<nsIURI> scrollbarsSheetURI;
NS_NewURI(getter_AddRefs(scrollbarsSheetURI),
NS_LITERAL_CSTRING("chrome://global/skin/scrollbars.css"));
if (scrollbarsSheetURI) {
LoadSheet(scrollbarsSheetURI, mScrollbarsSheet);
}
NS_ASSERTION(mScrollbarsSheet, "Could not loade scrollbars.css stylesheet.");
}
void
nsLayoutStylesheetCache::LoadSheetFile(nsIFile* aFile, nsCOMPtr<nsICSSStyleSheet> &aSheet)
{

View File

@ -180,9 +180,7 @@ nsXULPrototypeCache::~nsXULPrototypeCache()
}
NS_IMPL_THREADSAFE_ISUPPORTS2(nsXULPrototypeCache,
nsIXULPrototypeCache,
nsIObserver)
NS_IMPL_THREADSAFE_ISUPPORTS1(nsXULPrototypeCache, nsIXULPrototypeCache)
NS_IMETHODIMP

View File

@ -54,6 +54,7 @@ nsLayoutStylesheetCache::Observe(nsISupports* aSubject,
const PRUnichar* aData)
{
if (!strcmp(aTopic, "profile-before-change")) {
mScrollbarsSheet = nsnull;
mUserContentSheet = nsnull;
mUserChromeSheet = nsnull;
}
@ -62,8 +63,7 @@ nsLayoutStylesheetCache::Observe(nsISupports* aSubject,
}
else if (strcmp(aTopic, "chrome-flush-skin-caches") == 0 ||
strcmp(aTopic, "chrome-flush-caches") == 0) {
mScrollbarsSheet = nsnull;
mFormsSheet = nsnull;
InitFromSkin();
}
else {
NS_NOTREACHED("Unexpected observer topic.");
@ -78,17 +78,6 @@ nsLayoutStylesheetCache::ScrollbarsSheet()
if (!gStyleCache)
return nsnull;
if (!gStyleCache->mScrollbarsSheet) {
nsCOMPtr<nsIURI> sheetURI;
NS_NewURI(getter_AddRefs(sheetURI),
NS_LITERAL_CSTRING("chrome://global/skin/scrollbars.css"));
if (sheetURI)
LoadSheet(sheetURI, gStyleCache->mScrollbarsSheet);
NS_ASSERTION(gStyleCache->mScrollbarsSheet, "Could not load scrollbars.css.");
}
return gStyleCache->mScrollbarsSheet;
}
@ -99,17 +88,6 @@ nsLayoutStylesheetCache::FormsSheet()
if (!gStyleCache)
return nsnull;
if (!gStyleCache->mFormsSheet) {
nsCOMPtr<nsIURI> sheetURI;
NS_NewURI(getter_AddRefs(sheetURI),
NS_LITERAL_CSTRING("resource://gre/res/platform-forms.css"));
if (sheetURI)
LoadSheet(sheetURI, gStyleCache->mFormsSheet);
NS_ASSERTION(gStyleCache->mFormsSheet, "Could not load platform-forms.css.");
}
return gStyleCache->mFormsSheet;
}
@ -152,7 +130,14 @@ nsLayoutStylesheetCache::nsLayoutStylesheetCache()
obsSvc->AddObserver(this, "chrome-flush-caches", PR_FALSE);
}
nsCOMPtr<nsIURI> formsSheetURI;
NS_NewURI(getter_AddRefs(formsSheetURI),
NS_LITERAL_CSTRING("resource://gre/res/platform-forms.css"));
LoadSheet(formsSheetURI, mFormsSheet);
NS_ASSERTION(mFormsSheet, "Could not load platform-forms.css stylesheet.");
InitFromProfile();
InitFromSkin();
}
nsLayoutStylesheetCache::~nsLayoutStylesheetCache()
@ -194,6 +179,18 @@ nsLayoutStylesheetCache::InitFromProfile()
LoadSheetFile(chromeFile, mUserChromeSheet);
}
void
nsLayoutStylesheetCache::InitFromSkin()
{
nsCOMPtr<nsIURI> scrollbarsSheetURI;
NS_NewURI(getter_AddRefs(scrollbarsSheetURI),
NS_LITERAL_CSTRING("chrome://global/skin/scrollbars.css"));
if (scrollbarsSheetURI) {
LoadSheet(scrollbarsSheetURI, mScrollbarsSheet);
}
NS_ASSERTION(mScrollbarsSheet, "Could not loade scrollbars.css stylesheet.");
}
void
nsLayoutStylesheetCache::LoadSheetFile(nsIFile* aFile, nsCOMPtr<nsICSSStyleSheet> &aSheet)
{

View File

@ -63,6 +63,7 @@ private:
~nsLayoutStylesheetCache();
static void EnsureGlobal();
void InitFromSkin();
void InitFromProfile();
static void LoadSheetFile(nsIFile* aFile, nsCOMPtr<nsICSSStyleSheet> &aSheet);
static void LoadSheet(nsIURI* aURI, nsCOMPtr<nsICSSStyleSheet> &aSheet);