1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is nsIDOMNSDocumentStyle interface definition.
16 *
17 * The Initial Developer of the Original Code is
18 * Boris Zbarsky <bzbarsky@mit.edu>
19 * Portions created by the Initial Developer are Copyright (C) 2003
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38 #include "domstubs.idl"
39 #include "nsIDOMDocumentStyle.idl"
40
41 /**
42 * The nsIDOMNSDocumentStyle interface is an extension to the
43 * nsIDOMDocumentStyle interface. This interface exposes more ways to interact
44 * with style sheets in the Document Object Model. This interface is currently
45 * very much experimental.
46 *
47 * NOTE: This interface represents the additions to nsIDOMDocumentStyle defined
48 * by <http://whatwg.org/specs/web-apps/current-work/#alternate-style-sheets>.
49 * The comments here describe our implementation; if those comments don't match
50 * that spec, file bugs.
51 */
52
53 [scriptable, uuid(26311d10-7e24-4c7b-bb3d-17aad86f4d88)]
54 interface nsIDOMNSDocumentStyle : nsIDOMDocumentStyle
55 {
56 /**
57 * This attribute must return the preferred style sheet set as set by the
58 * author. It is determined from the order of style sheet declarations and
59 * the Default-Style HTTP headers, as eventually defined elsewhere in the Web
60 * Apps 1.0 specification. If there is no preferred style sheet set, this
61 * attribute must return the empty string. The case of this attribute must
62 * exactly match the case given by the author where the preferred style sheet
63 * is specified or implied. This attribute must never return null.
64 */
65 readonly attribute DOMString preferredStyleSheetSet;
66
67 /**
68 * This attribute indicates which style sheet set is in use. This attribute
69 * is live; changing the disabled attribute on style sheets directly will
70 * change the value of this attribute.
71 *
72 * If all the sheets that are enabled and have a title have the same title
73 * (by case-sensitive comparisons) then the value of this attribute must be
74 * exactly equal to the title of the first enabled style sheet with a title
75 * in the styleSheets list. Otherwise, if style sheets from different sets
76 * are enabled, then the return value must be null (there is no way to
77 * determine what the currently selected style sheet set is in those
78 * conditions). Otherwise, either all style sheets that have a title are
79 * disabled, or there are no alternate style sheets, and
80 * selectedStyleSheetSet must return the empty string.
81 *
82 * Setting this attribute to the null value must have no effect.
83 *
84 * Setting this attribute to a non-null value must call
85 * enableStyleSheetsForSet() with that value as the function's argument, and
86 * set lastStyleSheetSet to that value.
87 *
88 * From the DOM's perspective, all views have the same
89 * selectedStyleSheetSet. If a UA supports multiple views with different
90 * selected alternate style sheets, then this attribute (and the StyleSheet
91 * interface's disabled attribute) must return and set the value for the
92 * default view.
93 */
94 attribute DOMString selectedStyleSheetSet;
95
96 /*
97 * This property must initially have the value null. Its value changes when
98 * the selectedStyleSheetSet attribute is set.
99 */
100 readonly attribute DOMString lastStyleSheetSet;
101
102 /**
103 * This must return the live list of the currently available style sheet
104 * sets. This list is constructed by enumerating all the style sheets for
105 * this document available to the implementation, in the order they are
106 * listed in the styleSheets attribute, adding the title of each style sheet
107 * with a title to the list, avoiding duplicates by dropping titles that
108 * match (case-sensitively) titles that have already been added to the
109 * list.
110 */
111 readonly attribute nsIDOMDOMStringList styleSheetSets;
112
113 /**
114 * Calling this method must change the disabled attribute on each StyleSheet
115 * object with a title attribute with a length greater than 0 in the
116 * styleSheets attribute, so that all those whose title matches the name
117 * argument are enabled, and all others are disabled. Title matches must be
118 * case-sensitive. Calling this method with the empty string disables all
119 * alternate and preferred style sheets (but does not change the state of
120 * persistent style sheets, that is those with no title attribute).
121 *
122 * Calling this method with a null value must have no effect.
123 *
124 * Style sheets that do not have a title are never affected by this
125 * method. This method does not change the values of the lastStyleSheetSet or
126 * preferredStyleSheetSet attributes.
127 */
128 void enableStyleSheetsForSet(in DOMString name);
129 };