layout/base/nsStyleSheetService.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/base/nsStyleSheetService.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,71 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim: set ts=8 sts=2 et sw=2 tw=80: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +/* implementation of interface for managing user and user-agent style sheets */
    1.11 +
    1.12 +#ifndef nsStyleSheetService_h_
    1.13 +#define nsStyleSheetService_h_
    1.14 +
    1.15 +#include "nsCOMArray.h"
    1.16 +#include "nsCOMPtr.h"
    1.17 +#include "nsIMemoryReporter.h"
    1.18 +#include "nsIStyleSheetService.h"
    1.19 +#include "mozilla/Attributes.h"
    1.20 +#include "mozilla/MemoryReporting.h"
    1.21 +
    1.22 +class nsICategoryManager;
    1.23 +class nsIMemoryReporter;
    1.24 +class nsISimpleEnumerator;
    1.25 +class nsIStyleSheet;
    1.26 +
    1.27 +#define NS_STYLESHEETSERVICE_CID \
    1.28 +{0xfcca6f83, 0x9f7d, 0x44e4, {0xa7, 0x4b, 0xb5, 0x94, 0x33, 0xe6, 0xc8, 0xc3}}
    1.29 +
    1.30 +#define NS_STYLESHEETSERVICE_CONTRACTID \
    1.31 +  "@mozilla.org/content/style-sheet-service;1"
    1.32 +
    1.33 +class nsStyleSheetService MOZ_FINAL
    1.34 +  : public nsIStyleSheetService
    1.35 +  , public nsIMemoryReporter
    1.36 +{
    1.37 + public:
    1.38 +  nsStyleSheetService() NS_HIDDEN;
    1.39 +  ~nsStyleSheetService() NS_HIDDEN;
    1.40 +
    1.41 +  NS_DECL_ISUPPORTS
    1.42 +  NS_DECL_NSISTYLESHEETSERVICE
    1.43 +  NS_DECL_NSIMEMORYREPORTER
    1.44 +
    1.45 +  NS_HIDDEN_(nsresult) Init();
    1.46 +
    1.47 +  nsCOMArray<nsIStyleSheet>* AgentStyleSheets() { return &mSheets[AGENT_SHEET]; }
    1.48 +  nsCOMArray<nsIStyleSheet>* UserStyleSheets() { return &mSheets[USER_SHEET]; }
    1.49 +  nsCOMArray<nsIStyleSheet>* AuthorStyleSheets() { return &mSheets[AUTHOR_SHEET]; }
    1.50 +
    1.51 +  size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
    1.52 +
    1.53 +  static nsStyleSheetService *GetInstance();
    1.54 +  static nsStyleSheetService *gInstance;
    1.55 +
    1.56 + private:
    1.57 +
    1.58 +  NS_HIDDEN_(void) RegisterFromEnumerator(nsICategoryManager  *aManager,
    1.59 +                                          const char          *aCategory,
    1.60 +                                          nsISimpleEnumerator *aEnumerator,
    1.61 +                                          uint32_t             aSheetType);
    1.62 +
    1.63 +  NS_HIDDEN_(int32_t) FindSheetByURI(const nsCOMArray<nsIStyleSheet> &sheets,
    1.64 +                                     nsIURI *sheetURI);
    1.65 +
    1.66 +  // Like LoadAndRegisterSheet, but doesn't notify.  If successful, the
    1.67 +  // new sheet will be the last sheet in mSheets[aSheetType].
    1.68 +  NS_HIDDEN_(nsresult) LoadAndRegisterSheetInternal(nsIURI *aSheetURI,
    1.69 +                                                    uint32_t aSheetType);
    1.70 +
    1.71 +  nsCOMArray<nsIStyleSheet> mSheets[3];
    1.72 +};
    1.73 +
    1.74 +#endif

mercurial