Adding support for other backstop style sheets.

This commit is contained in:
hyatt%netscape.com 2000-04-28 23:32:51 +00:00
parent 472d0be6f4
commit 86ac1e20c6
3 changed files with 51 additions and 0 deletions

View File

@ -37,6 +37,7 @@
#include "nsIPresShell.h"
#include "nsIStyleSet.h"
#include "nsIStyleSheet.h"
#include "nsICSSStyleSheet.h"
#include "nsIStyleContext.h"
#include "nsIFrame.h"
@ -73,6 +74,7 @@
#include "nsIDocShell.h"
#include "nsIFrameDebug.h"
#include "nsIChromeRegistry.h"
#include "nsIServiceManager.h"
#include "nsIEventQueueService.h"
@ -950,6 +952,21 @@ DocumentViewerImpl::CreateStyleSet(nsIDocument* aDocument,
if (mUAStyleSheet) {
(*aStyleSet)->AppendBackstopStyleSheet(mUAStyleSheet);
}
NS_WITH_SERVICE(nsIChromeRegistry, chromeRegistry, "component://netscape/chrome/chrome-registry", &rv);
if (NS_SUCCEEDED(rv) && chromeRegistry) {
nsCOMPtr<nsISupportsArray> sheets;
chromeRegistry->GetBackstopSheets(getter_AddRefs(sheets));
if(sheets){
nsCOMPtr<nsICSSStyleSheet> sheet;
PRUint32 count;
sheets->Count(&count);
for(PRUint32 i=0; i<count; i++) {
sheets->GetElementAt(i, getter_AddRefs(sheet));
(*aStyleSet)->AppendBackstopStyleSheet(sheet);
}
}
}
}
return rv;
}

View File

@ -37,6 +37,7 @@
#include "nsIPresShell.h"
#include "nsIStyleSet.h"
#include "nsIStyleSheet.h"
#include "nsICSSStyleSheet.h"
#include "nsIStyleContext.h"
#include "nsIFrame.h"
@ -73,6 +74,7 @@
#include "nsIDocShell.h"
#include "nsIFrameDebug.h"
#include "nsIChromeRegistry.h"
#include "nsIServiceManager.h"
#include "nsIEventQueueService.h"
@ -950,6 +952,21 @@ DocumentViewerImpl::CreateStyleSet(nsIDocument* aDocument,
if (mUAStyleSheet) {
(*aStyleSet)->AppendBackstopStyleSheet(mUAStyleSheet);
}
NS_WITH_SERVICE(nsIChromeRegistry, chromeRegistry, "component://netscape/chrome/chrome-registry", &rv);
if (NS_SUCCEEDED(rv) && chromeRegistry) {
nsCOMPtr<nsISupportsArray> sheets;
chromeRegistry->GetBackstopSheets(getter_AddRefs(sheets));
if(sheets){
nsCOMPtr<nsICSSStyleSheet> sheet;
PRUint32 count;
sheets->Count(&count);
for(PRUint32 i=0; i<count; i++) {
sheets->GetElementAt(i, getter_AddRefs(sheet));
(*aStyleSet)->AppendBackstopStyleSheet(sheet);
}
}
}
}
return rv;
}

View File

@ -37,6 +37,7 @@
#include "nsIPresShell.h"
#include "nsIStyleSet.h"
#include "nsIStyleSheet.h"
#include "nsICSSStyleSheet.h"
#include "nsIStyleContext.h"
#include "nsIFrame.h"
@ -73,6 +74,7 @@
#include "nsIDocShell.h"
#include "nsIFrameDebug.h"
#include "nsIChromeRegistry.h"
#include "nsIServiceManager.h"
#include "nsIEventQueueService.h"
@ -950,6 +952,21 @@ DocumentViewerImpl::CreateStyleSet(nsIDocument* aDocument,
if (mUAStyleSheet) {
(*aStyleSet)->AppendBackstopStyleSheet(mUAStyleSheet);
}
NS_WITH_SERVICE(nsIChromeRegistry, chromeRegistry, "component://netscape/chrome/chrome-registry", &rv);
if (NS_SUCCEEDED(rv) && chromeRegistry) {
nsCOMPtr<nsISupportsArray> sheets;
chromeRegistry->GetBackstopSheets(getter_AddRefs(sheets));
if(sheets){
nsCOMPtr<nsICSSStyleSheet> sheet;
PRUint32 count;
sheets->Count(&count);
for(PRUint32 i=0; i<count; i++) {
sheets->GetElementAt(i, getter_AddRefs(sheet));
(*aStyleSet)->AppendBackstopStyleSheet(sheet);
}
}
}
}
return rv;
}