1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/style/nsIStyleSheet.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,87 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +/* 1.10 + * interface representing a collection of style data attached to a 1.11 + * document, which may be or be combined into a style rule processor 1.12 + */ 1.13 + 1.14 +#ifndef nsIStyleSheet_h___ 1.15 +#define nsIStyleSheet_h___ 1.16 + 1.17 +#include "mozilla/MemoryReporting.h" 1.18 +#include <stdio.h> 1.19 +#include "nsISupports.h" 1.20 + 1.21 +class nsString; 1.22 +class nsIURI; 1.23 +class nsIDocument; 1.24 + 1.25 +// IID for the nsIStyleSheet interface 1.26 +// 3eb34a60-04bd-41d9-9f60-882694e61c38 1.27 +#define NS_ISTYLE_SHEET_IID \ 1.28 +{ 0x3eb34a60, 0x04bd, 0x41d9, \ 1.29 + { 0x9f, 0x60, 0x88, 0x26, 0x94, 0xe6, 0x1c, 0x38 } } 1.30 + 1.31 +/** 1.32 + * A style sheet is a thing associated with a document that has style 1.33 + * rules. Those style rules can be reached in one of two ways, depending 1.34 + * on which level of the nsStyleSet it is in: 1.35 + * 1) It can be |QueryInterface|d to nsIStyleRuleProcessor 1.36 + * 2) It can be |QueryInterface|d to nsCSSStyleSheet, with which the 1.37 + * |nsStyleSet| uses an |nsCSSRuleProcessor| to access the rules. 1.38 + */ 1.39 +class nsIStyleSheet : public nsISupports { 1.40 +public: 1.41 + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISTYLE_SHEET_IID) 1.42 + 1.43 + // basic style sheet data 1.44 + virtual nsIURI* GetSheetURI() const = 0; 1.45 + virtual nsIURI* GetBaseURI() const = 0; 1.46 + virtual void GetTitle(nsString& aTitle) const = 0; 1.47 + virtual void GetType(nsString& aType) const = 0; 1.48 + virtual bool HasRules() const = 0; 1.49 + 1.50 + /** 1.51 + * Whether the sheet is applicable. A sheet that is not applicable 1.52 + * should never be inserted into a style set. A sheet may not be 1.53 + * applicable for a variety of reasons including being disabled and 1.54 + * being incomplete. 1.55 + * 1.56 + */ 1.57 + virtual bool IsApplicable() const = 0; 1.58 + 1.59 + /** 1.60 + * Set the stylesheet to be enabled. This may or may not make it 1.61 + * applicable. Note that this WILL inform the sheet's document of 1.62 + * its new applicable state if the state changes but WILL NOT call 1.63 + * BeginUpdate() or EndUpdate() on the document -- calling those is 1.64 + * the caller's responsibility. This allows use of SetEnabled when 1.65 + * batched updates are desired. If you want updates handled for 1.66 + * you, see nsIDOMStyleSheet::SetDisabled(). 1.67 + */ 1.68 + virtual void SetEnabled(bool aEnabled) = 0; 1.69 + 1.70 + /** 1.71 + * Whether the sheet is complete. 1.72 + */ 1.73 + virtual bool IsComplete() const = 0; 1.74 + virtual void SetComplete() = 0; 1.75 + 1.76 + // style sheet owner info 1.77 + virtual nsIStyleSheet* GetParentSheet() const = 0; // may be null 1.78 + virtual nsIDocument* GetOwningDocument() const = 0; // may be null 1.79 + virtual void SetOwningDocument(nsIDocument* aDocument) = 0; 1.80 + 1.81 +#ifdef DEBUG 1.82 + virtual void List(FILE* out = stdout, int32_t aIndent = 0) const = 0; 1.83 +#endif 1.84 + 1.85 + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const = 0; 1.86 +}; 1.87 + 1.88 +NS_DEFINE_STATIC_IID_ACCESSOR(nsIStyleSheet, NS_ISTYLE_SHEET_IID) 1.89 + 1.90 +#endif /* nsIStyleSheet_h___ */