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

     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 /* implementation of interface for managing user and user-agent style sheets */
     9 #ifndef nsStyleSheetService_h_
    10 #define nsStyleSheetService_h_
    12 #include "nsCOMArray.h"
    13 #include "nsCOMPtr.h"
    14 #include "nsIMemoryReporter.h"
    15 #include "nsIStyleSheetService.h"
    16 #include "mozilla/Attributes.h"
    17 #include "mozilla/MemoryReporting.h"
    19 class nsICategoryManager;
    20 class nsIMemoryReporter;
    21 class nsISimpleEnumerator;
    22 class nsIStyleSheet;
    24 #define NS_STYLESHEETSERVICE_CID \
    25 {0xfcca6f83, 0x9f7d, 0x44e4, {0xa7, 0x4b, 0xb5, 0x94, 0x33, 0xe6, 0xc8, 0xc3}}
    27 #define NS_STYLESHEETSERVICE_CONTRACTID \
    28   "@mozilla.org/content/style-sheet-service;1"
    30 class nsStyleSheetService MOZ_FINAL
    31   : public nsIStyleSheetService
    32   , public nsIMemoryReporter
    33 {
    34  public:
    35   nsStyleSheetService() NS_HIDDEN;
    36   ~nsStyleSheetService() NS_HIDDEN;
    38   NS_DECL_ISUPPORTS
    39   NS_DECL_NSISTYLESHEETSERVICE
    40   NS_DECL_NSIMEMORYREPORTER
    42   NS_HIDDEN_(nsresult) Init();
    44   nsCOMArray<nsIStyleSheet>* AgentStyleSheets() { return &mSheets[AGENT_SHEET]; }
    45   nsCOMArray<nsIStyleSheet>* UserStyleSheets() { return &mSheets[USER_SHEET]; }
    46   nsCOMArray<nsIStyleSheet>* AuthorStyleSheets() { return &mSheets[AUTHOR_SHEET]; }
    48   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
    50   static nsStyleSheetService *GetInstance();
    51   static nsStyleSheetService *gInstance;
    53  private:
    55   NS_HIDDEN_(void) RegisterFromEnumerator(nsICategoryManager  *aManager,
    56                                           const char          *aCategory,
    57                                           nsISimpleEnumerator *aEnumerator,
    58                                           uint32_t             aSheetType);
    60   NS_HIDDEN_(int32_t) FindSheetByURI(const nsCOMArray<nsIStyleSheet> &sheets,
    61                                      nsIURI *sheetURI);
    63   // Like LoadAndRegisterSheet, but doesn't notify.  If successful, the
    64   // new sheet will be the last sheet in mSheets[aSheetType].
    65   NS_HIDDEN_(nsresult) LoadAndRegisterSheetInternal(nsIURI *aSheetURI,
    66                                                     uint32_t aSheetType);
    68   nsCOMArray<nsIStyleSheet> mSheets[3];
    69 };
    71 #endif

mercurial