2004-03-09 22:59:09 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2013-01-18 04:45:12 +04:00
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2004-03-09 22:59:09 +03:00
|
|
|
|
|
|
|
#ifndef nsLayoutStylesheetCache_h__
|
|
|
|
#define nsLayoutStylesheetCache_h__
|
|
|
|
|
2013-11-07 09:35:30 +04:00
|
|
|
#include "nsIMemoryReporter.h"
|
2004-03-09 22:59:09 +03:00
|
|
|
#include "nsIObserver.h"
|
2010-05-12 00:41:47 +04:00
|
|
|
#include "nsAutoPtr.h"
|
2012-06-19 07:26:34 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-06-23 16:03:39 +04:00
|
|
|
#include "mozilla/MemoryReporting.h"
|
2014-06-26 20:29:05 +04:00
|
|
|
#include "mozilla/StaticPtr.h"
|
2004-03-09 22:59:09 +03:00
|
|
|
|
2013-01-18 04:45:12 +04:00
|
|
|
class nsIFile;
|
2010-05-12 00:41:47 +04:00
|
|
|
class nsIURI;
|
2010-03-03 00:00:53 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
2014-06-20 14:32:49 +04:00
|
|
|
class CSSStyleSheet;
|
2010-03-03 00:00:53 +03:00
|
|
|
namespace css {
|
|
|
|
class Loader;
|
|
|
|
}
|
|
|
|
}
|
2004-03-09 22:59:09 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsLayoutStylesheetCache final
|
2013-12-08 10:09:10 +04:00
|
|
|
: public nsIObserver
|
|
|
|
, public nsIMemoryReporter
|
2004-03-09 22:59:09 +03:00
|
|
|
{
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIOBSERVER
|
2013-12-08 10:09:10 +04:00
|
|
|
NS_DECL_NSIMEMORYREPORTER
|
2004-03-09 22:59:09 +03:00
|
|
|
|
2014-06-20 14:32:49 +04:00
|
|
|
static mozilla::CSSStyleSheet* ScrollbarsSheet();
|
|
|
|
static mozilla::CSSStyleSheet* FormsSheet();
|
2014-02-26 16:26:14 +04:00
|
|
|
// This function is expected to return nullptr when the dom.forms.number
|
|
|
|
// pref is disabled.
|
2014-06-20 14:32:49 +04:00
|
|
|
static mozilla::CSSStyleSheet* NumberControlSheet();
|
|
|
|
static mozilla::CSSStyleSheet* UserContentSheet();
|
|
|
|
static mozilla::CSSStyleSheet* UserChromeSheet();
|
|
|
|
static mozilla::CSSStyleSheet* UASheet();
|
|
|
|
static mozilla::CSSStyleSheet* HTMLSheet();
|
|
|
|
static mozilla::CSSStyleSheet* MinimalXULSheet();
|
|
|
|
static mozilla::CSSStyleSheet* XULSheet();
|
|
|
|
static mozilla::CSSStyleSheet* QuirkSheet();
|
|
|
|
static mozilla::CSSStyleSheet* FullScreenOverrideSheet();
|
|
|
|
static mozilla::CSSStyleSheet* SVGSheet();
|
|
|
|
static mozilla::CSSStyleSheet* MathMLSheet();
|
|
|
|
static mozilla::CSSStyleSheet* CounterStylesSheet();
|
2015-06-16 04:34:47 +03:00
|
|
|
static mozilla::CSSStyleSheet* NoScriptSheet();
|
2015-06-16 04:34:47 +03:00
|
|
|
static mozilla::CSSStyleSheet* NoFramesSheet();
|
2015-06-16 04:34:48 +03:00
|
|
|
static mozilla::CSSStyleSheet* ChromePreferenceSheet(nsPresContext* aPresContext);
|
|
|
|
static mozilla::CSSStyleSheet* ContentPreferenceSheet(nsPresContext* aPresContext);
|
2015-06-16 04:34:48 +03:00
|
|
|
static mozilla::CSSStyleSheet* ContentEditableSheet();
|
|
|
|
static mozilla::CSSStyleSheet* DesignModeSheet();
|
2015-06-16 04:34:48 +03:00
|
|
|
|
|
|
|
static void InvalidatePreferenceSheets();
|
2004-03-09 22:59:09 +03:00
|
|
|
|
|
|
|
static void Shutdown();
|
|
|
|
|
2013-11-07 09:35:30 +04:00
|
|
|
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
2012-01-03 06:19:14 +04:00
|
|
|
|
2004-03-09 22:59:09 +03:00
|
|
|
private:
|
|
|
|
nsLayoutStylesheetCache();
|
2012-01-03 06:19:14 +04:00
|
|
|
~nsLayoutStylesheetCache();
|
2004-03-09 22:59:09 +03:00
|
|
|
|
|
|
|
static void EnsureGlobal();
|
|
|
|
void InitFromProfile();
|
2013-11-07 09:35:30 +04:00
|
|
|
void InitMemoryReporter();
|
2014-09-12 01:41:35 +04:00
|
|
|
static void LoadSheetURL(const char* aURL,
|
|
|
|
nsRefPtr<mozilla::CSSStyleSheet>& aSheet,
|
|
|
|
bool aEnableUnsafeRules);
|
2014-06-20 14:32:49 +04:00
|
|
|
static void LoadSheetFile(nsIFile* aFile,
|
|
|
|
nsRefPtr<mozilla::CSSStyleSheet>& aSheet);
|
|
|
|
static void LoadSheet(nsIURI* aURI, nsRefPtr<mozilla::CSSStyleSheet>& aSheet,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aEnableUnsafeRules);
|
2014-11-14 01:11:19 +03:00
|
|
|
static void InvalidateSheet(nsRefPtr<mozilla::CSSStyleSheet>& aSheet);
|
|
|
|
static void DependentPrefChanged(const char* aPref, void* aData);
|
2015-06-16 04:34:48 +03:00
|
|
|
void BuildPreferenceSheet(nsRefPtr<mozilla::CSSStyleSheet>& aSheet,
|
|
|
|
nsPresContext* aPresContext);
|
|
|
|
static void AppendPreferenceRule(mozilla::CSSStyleSheet* aSheet,
|
|
|
|
const nsAString& aRule);
|
|
|
|
static void AppendPreferenceColorRule(mozilla::CSSStyleSheet* aSheet,
|
|
|
|
const char* aString, nscolor aColor);
|
2004-03-09 22:59:09 +03:00
|
|
|
|
2014-06-26 20:29:05 +04:00
|
|
|
static mozilla::StaticRefPtr<nsLayoutStylesheetCache> gStyleCache;
|
2010-03-03 00:00:53 +03:00
|
|
|
static mozilla::css::Loader* gCSSLoader;
|
2015-06-16 04:34:48 +03:00
|
|
|
nsRefPtr<mozilla::CSSStyleSheet> mChromePreferenceSheet;
|
2015-06-16 04:34:48 +03:00
|
|
|
nsRefPtr<mozilla::CSSStyleSheet> mContentEditableSheet;
|
2015-06-16 04:34:48 +03:00
|
|
|
nsRefPtr<mozilla::CSSStyleSheet> mContentPreferenceSheet;
|
2014-09-12 01:41:35 +04:00
|
|
|
nsRefPtr<mozilla::CSSStyleSheet> mCounterStylesSheet;
|
2015-06-16 04:34:48 +03:00
|
|
|
nsRefPtr<mozilla::CSSStyleSheet> mDesignModeSheet;
|
2014-06-20 14:32:49 +04:00
|
|
|
nsRefPtr<mozilla::CSSStyleSheet> mFormsSheet;
|
2014-09-12 01:41:35 +04:00
|
|
|
nsRefPtr<mozilla::CSSStyleSheet> mFullScreenOverrideSheet;
|
2014-06-20 14:32:49 +04:00
|
|
|
nsRefPtr<mozilla::CSSStyleSheet> mHTMLSheet;
|
2014-09-12 01:41:35 +04:00
|
|
|
nsRefPtr<mozilla::CSSStyleSheet> mMathMLSheet;
|
2014-06-20 14:32:49 +04:00
|
|
|
nsRefPtr<mozilla::CSSStyleSheet> mMinimalXULSheet;
|
2015-06-16 04:34:47 +03:00
|
|
|
nsRefPtr<mozilla::CSSStyleSheet> mNoFramesSheet;
|
2015-06-16 04:34:47 +03:00
|
|
|
nsRefPtr<mozilla::CSSStyleSheet> mNoScriptSheet;
|
2014-09-12 01:41:35 +04:00
|
|
|
nsRefPtr<mozilla::CSSStyleSheet> mNumberControlSheet;
|
2014-06-20 14:32:49 +04:00
|
|
|
nsRefPtr<mozilla::CSSStyleSheet> mQuirkSheet;
|
|
|
|
nsRefPtr<mozilla::CSSStyleSheet> mSVGSheet;
|
2014-09-12 01:41:35 +04:00
|
|
|
nsRefPtr<mozilla::CSSStyleSheet> mScrollbarsSheet;
|
|
|
|
nsRefPtr<mozilla::CSSStyleSheet> mUASheet;
|
|
|
|
nsRefPtr<mozilla::CSSStyleSheet> mUserChromeSheet;
|
|
|
|
nsRefPtr<mozilla::CSSStyleSheet> mUserContentSheet;
|
|
|
|
nsRefPtr<mozilla::CSSStyleSheet> mXULSheet;
|
2004-03-09 22:59:09 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|