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"
|
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"
|
2016-02-24 10:01:12 +03:00
|
|
|
#include "mozilla/StyleBackendType.h"
|
2015-10-14 00:43:16 +03:00
|
|
|
#include "mozilla/css/Loader.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;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace mozilla
|
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
|
|
|
|
2016-02-24 10:01:12 +03:00
|
|
|
/**
|
|
|
|
* Returns the nsLayoutStylesheetCache for the given style backend type.
|
|
|
|
* Callers should pass in a value for aType that matches the style system
|
|
|
|
* backend type for the style set in use. (A process may call For
|
|
|
|
* and obtain nsLayoutStylesheetCache objects for both backend types,
|
|
|
|
* and a particular UA style sheet might be cached in both, one or neither
|
|
|
|
* nsLayoutStylesheetCache.)
|
|
|
|
*/
|
|
|
|
static nsLayoutStylesheetCache* For(mozilla::StyleBackendType aType);
|
|
|
|
|
|
|
|
mozilla::StyleSheetHandle ScrollbarsSheet();
|
|
|
|
mozilla::StyleSheetHandle FormsSheet();
|
2014-02-26 16:26:14 +04:00
|
|
|
// This function is expected to return nullptr when the dom.forms.number
|
|
|
|
// pref is disabled.
|
2016-02-24 10:01:12 +03:00
|
|
|
mozilla::StyleSheetHandle NumberControlSheet();
|
|
|
|
mozilla::StyleSheetHandle UserContentSheet();
|
|
|
|
mozilla::StyleSheetHandle UserChromeSheet();
|
|
|
|
mozilla::StyleSheetHandle UASheet();
|
|
|
|
mozilla::StyleSheetHandle HTMLSheet();
|
|
|
|
mozilla::StyleSheetHandle MinimalXULSheet();
|
|
|
|
mozilla::StyleSheetHandle XULSheet();
|
|
|
|
mozilla::StyleSheetHandle QuirkSheet();
|
|
|
|
mozilla::StyleSheetHandle SVGSheet();
|
|
|
|
mozilla::StyleSheetHandle MathMLSheet();
|
|
|
|
mozilla::StyleSheetHandle CounterStylesSheet();
|
|
|
|
mozilla::StyleSheetHandle NoScriptSheet();
|
|
|
|
mozilla::StyleSheetHandle NoFramesSheet();
|
|
|
|
mozilla::StyleSheetHandle ChromePreferenceSheet(nsPresContext* aPresContext);
|
|
|
|
mozilla::StyleSheetHandle ContentPreferenceSheet(nsPresContext* aPresContext);
|
|
|
|
mozilla::StyleSheetHandle ContentEditableSheet();
|
|
|
|
mozilla::StyleSheetHandle 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:
|
2016-02-24 10:01:12 +03:00
|
|
|
explicit nsLayoutStylesheetCache(mozilla::StyleBackendType aImpl);
|
2012-01-03 06:19:14 +04:00
|
|
|
~nsLayoutStylesheetCache();
|
2004-03-09 22:59:09 +03:00
|
|
|
|
|
|
|
void InitFromProfile();
|
2013-11-07 09:35:30 +04:00
|
|
|
void InitMemoryReporter();
|
2016-02-24 10:01:12 +03:00
|
|
|
void LoadSheetURL(const char* aURL,
|
2016-04-14 02:55:47 +03:00
|
|
|
mozilla::StyleSheetHandle::RefPtr* aSheet,
|
2016-02-24 10:01:12 +03:00
|
|
|
mozilla::css::SheetParsingMode aParsingMode);
|
|
|
|
void LoadSheetFile(nsIFile* aFile,
|
2016-04-14 02:55:47 +03:00
|
|
|
mozilla::StyleSheetHandle::RefPtr* aSheet,
|
2016-02-24 10:01:12 +03:00
|
|
|
mozilla::css::SheetParsingMode aParsingMode);
|
2016-04-14 02:55:47 +03:00
|
|
|
void LoadSheet(nsIURI* aURI, mozilla::StyleSheetHandle::RefPtr* aSheet,
|
2016-02-24 10:01:12 +03:00
|
|
|
mozilla::css::SheetParsingMode aParsingMode);
|
2016-02-24 10:01:12 +03:00
|
|
|
static void InvalidateSheet(mozilla::StyleSheetHandle::RefPtr* aGeckoSheet,
|
|
|
|
mozilla::StyleSheetHandle::RefPtr* aServoSheet);
|
2014-11-14 01:11:19 +03:00
|
|
|
static void DependentPrefChanged(const char* aPref, void* aData);
|
2016-04-14 02:55:47 +03:00
|
|
|
void BuildPreferenceSheet(mozilla::StyleSheetHandle::RefPtr* aSheet,
|
2015-06-16 04:34:48 +03:00
|
|
|
nsPresContext* aPresContext);
|
2004-03-09 22:59:09 +03:00
|
|
|
|
2016-02-24 10:01:12 +03:00
|
|
|
static mozilla::StaticRefPtr<nsLayoutStylesheetCache> gStyleCache_Gecko;
|
|
|
|
static mozilla::StaticRefPtr<nsLayoutStylesheetCache> gStyleCache_Servo;
|
2016-02-24 10:01:12 +03:00
|
|
|
static mozilla::StaticRefPtr<mozilla::css::Loader> gCSSLoader_Gecko;
|
|
|
|
static mozilla::StaticRefPtr<mozilla::css::Loader> gCSSLoader_Servo;
|
2016-02-24 10:01:12 +03:00
|
|
|
mozilla::StyleBackendType mBackendType;
|
|
|
|
mozilla::StyleSheetHandle::RefPtr mChromePreferenceSheet;
|
|
|
|
mozilla::StyleSheetHandle::RefPtr mContentEditableSheet;
|
|
|
|
mozilla::StyleSheetHandle::RefPtr mContentPreferenceSheet;
|
|
|
|
mozilla::StyleSheetHandle::RefPtr mCounterStylesSheet;
|
|
|
|
mozilla::StyleSheetHandle::RefPtr mDesignModeSheet;
|
|
|
|
mozilla::StyleSheetHandle::RefPtr mFormsSheet;
|
|
|
|
mozilla::StyleSheetHandle::RefPtr mHTMLSheet;
|
|
|
|
mozilla::StyleSheetHandle::RefPtr mMathMLSheet;
|
|
|
|
mozilla::StyleSheetHandle::RefPtr mMinimalXULSheet;
|
|
|
|
mozilla::StyleSheetHandle::RefPtr mNoFramesSheet;
|
|
|
|
mozilla::StyleSheetHandle::RefPtr mNoScriptSheet;
|
|
|
|
mozilla::StyleSheetHandle::RefPtr mNumberControlSheet;
|
|
|
|
mozilla::StyleSheetHandle::RefPtr mQuirkSheet;
|
|
|
|
mozilla::StyleSheetHandle::RefPtr mSVGSheet;
|
|
|
|
mozilla::StyleSheetHandle::RefPtr mScrollbarsSheet;
|
|
|
|
mozilla::StyleSheetHandle::RefPtr mUASheet;
|
|
|
|
mozilla::StyleSheetHandle::RefPtr mUserChromeSheet;
|
|
|
|
mozilla::StyleSheetHandle::RefPtr mUserContentSheet;
|
|
|
|
mozilla::StyleSheetHandle::RefPtr mXULSheet;
|
2004-03-09 22:59:09 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|