michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=8 sts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsLayoutStylesheetCache_h__ michael@0: #define nsLayoutStylesheetCache_h__ michael@0: michael@0: #include "nsIMemoryReporter.h" michael@0: #include "nsIObserver.h" michael@0: #include "nsAutoPtr.h" michael@0: #include "mozilla/Attributes.h" michael@0: #include "mozilla/MemoryReporting.h" michael@0: michael@0: class nsCSSStyleSheet; michael@0: class nsIFile; michael@0: class nsIURI; michael@0: michael@0: namespace mozilla { michael@0: namespace css { michael@0: class Loader; michael@0: } michael@0: } michael@0: michael@0: class nsLayoutStylesheetCache MOZ_FINAL michael@0: : public nsIObserver michael@0: , public nsIMemoryReporter michael@0: { michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIOBSERVER michael@0: NS_DECL_NSIMEMORYREPORTER michael@0: michael@0: static nsCSSStyleSheet* ScrollbarsSheet(); michael@0: static nsCSSStyleSheet* FormsSheet(); michael@0: // This function is expected to return nullptr when the dom.forms.number michael@0: // pref is disabled. michael@0: static nsCSSStyleSheet* NumberControlSheet(); michael@0: static nsCSSStyleSheet* UserContentSheet(); michael@0: static nsCSSStyleSheet* UserChromeSheet(); michael@0: static nsCSSStyleSheet* UASheet(); michael@0: static nsCSSStyleSheet* QuirkSheet(); michael@0: static nsCSSStyleSheet* FullScreenOverrideSheet(); michael@0: michael@0: static void Shutdown(); michael@0: michael@0: size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; michael@0: michael@0: private: michael@0: nsLayoutStylesheetCache(); michael@0: ~nsLayoutStylesheetCache(); michael@0: michael@0: static void EnsureGlobal(); michael@0: void InitFromProfile(); michael@0: void InitMemoryReporter(); michael@0: static void LoadSheetFile(nsIFile* aFile, nsRefPtr &aSheet); michael@0: static void LoadSheet(nsIURI* aURI, nsRefPtr &aSheet, michael@0: bool aEnableUnsafeRules); michael@0: michael@0: static nsLayoutStylesheetCache* gStyleCache; michael@0: static mozilla::css::Loader* gCSSLoader; michael@0: nsRefPtr mScrollbarsSheet; michael@0: nsRefPtr mFormsSheet; michael@0: nsRefPtr mNumberControlSheet; michael@0: nsRefPtr mUserContentSheet; michael@0: nsRefPtr mUserChromeSheet; michael@0: nsRefPtr mUASheet; michael@0: nsRefPtr mQuirkSheet; michael@0: nsRefPtr mFullScreenOverrideSheet; michael@0: }; michael@0: michael@0: #endif