/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * The contents of this file are subject to the Netscape Public * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/NPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is Netscape * Communications Corporation. Portions created by Netscape are * Copyright (C) 1999 Netscape Communications Corporation. All * Rights Reserved. * * Contributor(s): * Boris Zbarsky * * This Original Code has been modified by IBM Corporation. Modifications made by IBM * described herein are Copyright (c) International Business Machines Corporation, 2000. * Modifications to Mozilla code or documentation identified per MPL Section 3.3 * * Date Modified by Description of modification * 04/20/2000 IBM Corp. OS/2 VisualAge build. */ #include "nsICSSLoader.h" #include "nsICSSLoaderObserver.h" #include "nsICSSParser.h" #include "nsICSSStyleSheet.h" #include "nsIParser.h" #include "nsIContent.h" #include "nsIDOMNode.h" #include "nsIStyleSheetLinkingElement.h" #include "nsIDocument.h" #include "nsINameSpaceManager.h" #include "nsIUnicharStreamLoader.h" #include "nsIUnicharInputStream.h" #include "nsIConverterInputStream.h" #include "nsICharsetAlias.h" #include "nsUnicharUtils.h" #include "nsHashtable.h" #include "nsIURL.h" #include "nsIURL.h" #include "nsIServiceManager.h" #include "nsNetUtil.h" #include "nsCRT.h" #include "nsCOMArray.h" #include "nsCOMPtr.h" #include "nsIScriptSecurityManager.h" #include "nsITimelineService.h" #include "nsIHttpChannel.h" #include "nsIConsoleService.h" #include "nsIScriptError.h" #include "nsIStringBundle.h" #include "nsMimeTypes.h" #include "nsIAtom.h" #ifdef INCLUDE_XUL #include "nsIXULPrototypeCache.h" #endif #include "nsIDOMMediaList.h" #include "nsIDOMStyleSheet.h" #include "nsIDOMCSSStyleSheet.h" #include "nsIDOMCSSImportRule.h" #ifdef MOZ_LOGGING // #define FORCE_PR_LOG /* Allow logging in the release build */ #endif /* MOZ_LOGGING */ #include "prlog.h" #ifdef PR_LOGGING static PRLogModuleInfo *gLoaderLog = PR_NewLogModule("nsCSSLoader"); #endif /* PR_LOGGING */ #define LOG_FORCE(args) PR_LOG(gLoaderLog, PR_LOG_ALWAYS, args) #define LOG_ERROR(args) PR_LOG(gLoaderLog, PR_LOG_ERROR, args) #define LOG_WARN(args) PR_LOG(gLoaderLog, PR_LOG_WARNING, args) #define LOG_DEBUG(args) PR_LOG(gLoaderLog, PR_LOG_DEBUG, args) #define LOG(args) LOG_DEBUG(args) #define LOG_FORCE_ENABLED() PR_LOG_TEST(gLoaderLog, PR_LOG_ALWAYS) #define LOG_ERROR_ENABLED() PR_LOG_TEST(gLoaderLog, PR_LOG_ERROR) #define LOG_WARN_ENABLED() PR_LOG_TEST(gLoaderLog, PR_LOG_WARNING) #define LOG_DEBUG_ENABLED() PR_LOG_TEST(gLoaderLog, PR_LOG_DEBUG) #define LOG_ENABLED() LOG_DEBUG_ENABLED() #ifdef PR_LOGGING #define LOG_URI(format, uri) \ PR_BEGIN_MACRO \ NS_ASSERTION(uri, "Logging null uri"); \ if (LOG_ENABLED()) { \ nsCAutoString _logURISpec; \ uri->GetSpec(_logURISpec); \ LOG((format, _logURISpec.get())); \ } \ PR_END_MACRO #else // PR_LOGGING #define LOG_URI(format, uri) #endif // PR_LOGGING static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); class CSSLoaderImpl; /** * OVERALL ARCHITECTURE * * The CSS Loader gets requests to load various sorts of style sheets: * inline style from