Bug 237407 - classic theme scrollbars & buttons leak into modern, when starting with the profile manager - r+sr=dbaron a=asa for 1.7

This commit is contained in:
bsmedberg%covad.net 2004-03-22 12:58:01 +00:00
Родитель 79568e80ab
Коммит 4cee40678e
5 изменённых файлов: 51 добавлений и 45 удалений

Просмотреть файл

@ -63,7 +63,6 @@ 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);

Просмотреть файл

@ -54,7 +54,6 @@ nsLayoutStylesheetCache::Observe(nsISupports* aSubject,
const PRUnichar* aData)
{
if (!strcmp(aTopic, "profile-before-change")) {
mScrollbarsSheet = nsnull;
mUserContentSheet = nsnull;
mUserChromeSheet = nsnull;
}
@ -63,7 +62,8 @@ nsLayoutStylesheetCache::Observe(nsISupports* aSubject,
}
else if (strcmp(aTopic, "chrome-flush-skin-caches") == 0 ||
strcmp(aTopic, "chrome-flush-caches") == 0) {
InitFromSkin();
mScrollbarsSheet = nsnull;
mFormsSheet = nsnull;
}
else {
NS_NOTREACHED("Unexpected observer topic.");
@ -78,6 +78,17 @@ 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;
}
@ -88,6 +99,17 @@ 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;
}
@ -130,14 +152,7 @@ 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()
@ -179,18 +194,6 @@ 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)
{

Просмотреть файл

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

Просмотреть файл

@ -54,7 +54,6 @@ nsLayoutStylesheetCache::Observe(nsISupports* aSubject,
const PRUnichar* aData)
{
if (!strcmp(aTopic, "profile-before-change")) {
mScrollbarsSheet = nsnull;
mUserContentSheet = nsnull;
mUserChromeSheet = nsnull;
}
@ -63,7 +62,8 @@ nsLayoutStylesheetCache::Observe(nsISupports* aSubject,
}
else if (strcmp(aTopic, "chrome-flush-skin-caches") == 0 ||
strcmp(aTopic, "chrome-flush-caches") == 0) {
InitFromSkin();
mScrollbarsSheet = nsnull;
mFormsSheet = nsnull;
}
else {
NS_NOTREACHED("Unexpected observer topic.");
@ -78,6 +78,17 @@ 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;
}
@ -88,6 +99,17 @@ 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;
}
@ -130,14 +152,7 @@ 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()
@ -179,18 +194,6 @@ 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)
{

Просмотреть файл

@ -63,7 +63,6 @@ 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);