layout/base/nsStyleSheetService.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 /* implementation of interface for managing user and user-agent style sheets */
michael@0 8
michael@0 9 #ifndef nsStyleSheetService_h_
michael@0 10 #define nsStyleSheetService_h_
michael@0 11
michael@0 12 #include "nsCOMArray.h"
michael@0 13 #include "nsCOMPtr.h"
michael@0 14 #include "nsIMemoryReporter.h"
michael@0 15 #include "nsIStyleSheetService.h"
michael@0 16 #include "mozilla/Attributes.h"
michael@0 17 #include "mozilla/MemoryReporting.h"
michael@0 18
michael@0 19 class nsICategoryManager;
michael@0 20 class nsIMemoryReporter;
michael@0 21 class nsISimpleEnumerator;
michael@0 22 class nsIStyleSheet;
michael@0 23
michael@0 24 #define NS_STYLESHEETSERVICE_CID \
michael@0 25 {0xfcca6f83, 0x9f7d, 0x44e4, {0xa7, 0x4b, 0xb5, 0x94, 0x33, 0xe6, 0xc8, 0xc3}}
michael@0 26
michael@0 27 #define NS_STYLESHEETSERVICE_CONTRACTID \
michael@0 28 "@mozilla.org/content/style-sheet-service;1"
michael@0 29
michael@0 30 class nsStyleSheetService MOZ_FINAL
michael@0 31 : public nsIStyleSheetService
michael@0 32 , public nsIMemoryReporter
michael@0 33 {
michael@0 34 public:
michael@0 35 nsStyleSheetService() NS_HIDDEN;
michael@0 36 ~nsStyleSheetService() NS_HIDDEN;
michael@0 37
michael@0 38 NS_DECL_ISUPPORTS
michael@0 39 NS_DECL_NSISTYLESHEETSERVICE
michael@0 40 NS_DECL_NSIMEMORYREPORTER
michael@0 41
michael@0 42 NS_HIDDEN_(nsresult) Init();
michael@0 43
michael@0 44 nsCOMArray<nsIStyleSheet>* AgentStyleSheets() { return &mSheets[AGENT_SHEET]; }
michael@0 45 nsCOMArray<nsIStyleSheet>* UserStyleSheets() { return &mSheets[USER_SHEET]; }
michael@0 46 nsCOMArray<nsIStyleSheet>* AuthorStyleSheets() { return &mSheets[AUTHOR_SHEET]; }
michael@0 47
michael@0 48 size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
michael@0 49
michael@0 50 static nsStyleSheetService *GetInstance();
michael@0 51 static nsStyleSheetService *gInstance;
michael@0 52
michael@0 53 private:
michael@0 54
michael@0 55 NS_HIDDEN_(void) RegisterFromEnumerator(nsICategoryManager *aManager,
michael@0 56 const char *aCategory,
michael@0 57 nsISimpleEnumerator *aEnumerator,
michael@0 58 uint32_t aSheetType);
michael@0 59
michael@0 60 NS_HIDDEN_(int32_t) FindSheetByURI(const nsCOMArray<nsIStyleSheet> &sheets,
michael@0 61 nsIURI *sheetURI);
michael@0 62
michael@0 63 // Like LoadAndRegisterSheet, but doesn't notify. If successful, the
michael@0 64 // new sheet will be the last sheet in mSheets[aSheetType].
michael@0 65 NS_HIDDEN_(nsresult) LoadAndRegisterSheetInternal(nsIURI *aSheetURI,
michael@0 66 uint32_t aSheetType);
michael@0 67
michael@0 68 nsCOMArray<nsIStyleSheet> mSheets[3];
michael@0 69 };
michael@0 70
michael@0 71 #endif

mercurial