layout/style/nsLayoutStylesheetCache.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef nsLayoutStylesheetCache_h__
     8 #define nsLayoutStylesheetCache_h__
    10 #include "nsIMemoryReporter.h"
    11 #include "nsIObserver.h"
    12 #include "nsAutoPtr.h"
    13 #include "mozilla/Attributes.h"
    14 #include "mozilla/MemoryReporting.h"
    16 class nsCSSStyleSheet;
    17 class nsIFile;
    18 class nsIURI;
    20 namespace mozilla {
    21 namespace css {
    22 class Loader;
    23 }
    24 }
    26 class nsLayoutStylesheetCache MOZ_FINAL
    27  : public nsIObserver
    28  , public nsIMemoryReporter
    29 {
    30   NS_DECL_ISUPPORTS
    31   NS_DECL_NSIOBSERVER
    32   NS_DECL_NSIMEMORYREPORTER
    34   static nsCSSStyleSheet* ScrollbarsSheet();
    35   static nsCSSStyleSheet* FormsSheet();
    36   // This function is expected to return nullptr when the dom.forms.number
    37   // pref is disabled.
    38   static nsCSSStyleSheet* NumberControlSheet();
    39   static nsCSSStyleSheet* UserContentSheet();
    40   static nsCSSStyleSheet* UserChromeSheet();
    41   static nsCSSStyleSheet* UASheet();
    42   static nsCSSStyleSheet* QuirkSheet();
    43   static nsCSSStyleSheet* FullScreenOverrideSheet();
    45   static void Shutdown();
    47   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
    49 private:
    50   nsLayoutStylesheetCache();
    51   ~nsLayoutStylesheetCache();
    53   static void EnsureGlobal();
    54   void InitFromProfile();
    55   void InitMemoryReporter();
    56   static void LoadSheetFile(nsIFile* aFile, nsRefPtr<nsCSSStyleSheet> &aSheet);
    57   static void LoadSheet(nsIURI* aURI, nsRefPtr<nsCSSStyleSheet> &aSheet,
    58                         bool aEnableUnsafeRules);
    60   static nsLayoutStylesheetCache* gStyleCache;
    61   static mozilla::css::Loader* gCSSLoader;
    62   nsRefPtr<nsCSSStyleSheet> mScrollbarsSheet;
    63   nsRefPtr<nsCSSStyleSheet> mFormsSheet;
    64   nsRefPtr<nsCSSStyleSheet> mNumberControlSheet;
    65   nsRefPtr<nsCSSStyleSheet> mUserContentSheet;
    66   nsRefPtr<nsCSSStyleSheet> mUserChromeSheet;
    67   nsRefPtr<nsCSSStyleSheet> mUASheet;
    68   nsRefPtr<nsCSSStyleSheet> mQuirkSheet;
    69   nsRefPtr<nsCSSStyleSheet> mFullScreenOverrideSheet;
    70 };
    72 #endif

mercurial