File: Document.idl

package info (click to toggle)
webkit2gtk 2.18.6-1~deb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 159,080 kB
  • sloc: cpp: 1,636,147; ansic: 45,350; python: 14,988; perl: 13,794; ruby: 9,803; xml: 9,342; asm: 5,312; yacc: 2,167; lex: 1,007; sh: 773; makefile: 61
file content (223 lines) | stat: -rw-r--r-- 12,894 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/*
 * Copyright (C) 2006, 2007, 2011, 2015 Apple Inc. All rights reserved.
 * Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

typedef (
#if defined(ENABLE_WEBGL) && ENABLE_WEBGL
    WebGLRenderingContext or
#endif
#if defined(ENABLE_WEBGL2) && ENABLE_WEBGL2
    WebGL2RenderingContext or
#endif
#if defined(ENABLE_WEBGPU) && ENABLE_WEBGPU
    WebGPURenderingContext or
#endif
    CanvasRenderingContext2D) RenderingContext;

[
    Constructor,
    ConstructorCallWith=Document,
    CustomToJSObject,
    DOMJIT,
    ExportMacro=WEBCORE_EXPORT,
    JSCustomHeader,
    JSCustomMarkFunction,
    JSGenerateToNativeObject,
] interface Document : Node {
    readonly attribute DOMImplementation implementation; // FIXME: Should be [SameObject].
    [ImplementedAs=urlForBindings] readonly attribute USVString URL;
    [ImplementedAs=urlForBindings] readonly attribute USVString documentURI;
    readonly attribute USVString origin;
    readonly attribute DOMString compatMode;
    [ImplementedAs=characterSetWithUTF8Fallback] readonly attribute DOMString characterSet;
    [ImplementedAs=characterSetWithUTF8Fallback] readonly attribute DOMString charset; // Historical alias of .characterSet,
    [ImplementedAs=characterSetWithUTF8Fallback] readonly attribute DOMString inputEncoding; // Historical alias of .characterSet.
    readonly attribute DOMString contentType;

    readonly attribute DocumentType? doctype;
    [DOMJIT=Getter] readonly attribute Element? documentElement;

    HTMLCollection getElementsByTagName(DOMString qualifiedName);
    HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString localName);
    HTMLCollection getElementsByClassName(DOMString classNames);

    [NewObject, MayThrowException, ImplementedAs=createElementForBindings] Element createElement(DOMString localName); // FIXME: missing options parameter.
    [NewObject, MayThrowException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName); // FIXME: missing options parameter.
    [NewObject] DocumentFragment createDocumentFragment();
    [NewObject] Text createTextNode(DOMString data);
    [NewObject, MayThrowException] CDATASection createCDATASection(DOMString data);
    [NewObject] Comment createComment(DOMString data);
    [NewObject, MayThrowException] ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);

    [CEReactions, MayThrowException, NewObject] Node importNode(Node node, optional boolean deep = false);
    [CEReactions, MayThrowException] Node adoptNode(Node node);

    [NewObject, MayThrowException] Attr createAttribute(DOMString localName);
    [NewObject, MayThrowException] Attr createAttributeNS(DOMString? namespaceURI, DOMString qualifiedName);

    [MayThrowException, NewObject] Event createEvent(DOMString type);

    [NewObject] Range createRange();

    // NodeFilter.SHOW_ALL = 0xFFFFFFFF.
    [NewObject] NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
    [NewObject] TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);

    // Extensions from HTML specification (https://html.spec.whatwg.org/#the-document-object).
    [PutForwards=href, Unforgeable] readonly attribute Location? location;
    [SetterMayThrowException] attribute USVString domain;
    readonly attribute USVString referrer;
    [GetterMayThrowException, SetterMayThrowException] attribute USVString cookie;
    readonly attribute DOMString lastModified;
    readonly attribute DocumentReadyState readyState;

    // DOM tree accessors.
    [CEReactions] attribute DOMString title;
    [CEReactions] attribute DOMString dir;
    [CEReactions, DOMJIT=Getter, ImplementedAs=bodyOrFrameset, SetterMayThrowException] attribute HTMLElement? body;
    readonly attribute HTMLHeadElement? head;
    readonly attribute HTMLCollection images; // Should be [SameObject].
    readonly attribute HTMLCollection embeds; // Should be [SameObject].
    readonly attribute HTMLCollection plugins; // Should be [SameObject].
    readonly attribute HTMLCollection links; // Should be [SameObject].
    readonly attribute HTMLCollection forms; // Should be [SameObject].
    readonly attribute HTMLCollection scripts; // Should be [SameObject].
    NodeList getElementsByName([AtomicString] DOMString elementName);
    readonly attribute HTMLScriptElement? currentScript; // FIXME: Should return a HTMLOrSVGScriptElement.

    // dynamic markup insertion
    // FIXME: The HTML spec says this should consult the "responsible document". We should ensure
    // that the caller document matches those semantics. It is possible we should replace it with
    // the existing 'incumbent document' concept.
    [CEReactions, CallWith=ResponsibleDocument, ImplementedAs=openForBindings, MayThrowException] Document open(optional DOMString type = "text/html", optional DOMString replace = "");
    [CallWith=ActiveWindow&FirstWindow, ImplementedAs=openForBindings, MayThrowException] DOMWindow open(USVString url, DOMString name, DOMString features);
    [CEReactions, ImplementedAs=closeForBindings, MayThrowException] void close();
    [CEReactions, CallWith=ResponsibleDocument, MayThrowException] void write(DOMString... text);
    [CEReactions, CallWith=ResponsibleDocument, MayThrowException] void writeln(DOMString... text);

    // User interaction.
    readonly attribute DOMWindow? defaultView;
    boolean hasFocus();
    [CEReactions] attribute DOMString designMode;
    [CEReactions] boolean execCommand(DOMString commandId, optional boolean showUI = false, optional DOMString? value = null); // FIXME: value should not be nullable.
    boolean queryCommandEnabled(DOMString commandId);
    boolean queryCommandIndeterm(DOMString commandId);
    boolean queryCommandState(DOMString commandId);
    boolean queryCommandSupported(DOMString commandId);
    DOMString queryCommandValue(DOMString commandId);

    // Special event handler IDL attributes that only apply to Document objects.
    [LenientThis] attribute EventHandler onreadystatechange;

    // Extensions from the CSSOM specification (https://drafts.csswg.org/cssom/#extensions-to-the-document-interface).
    // FIXME: Should likely be moved to DocumentOrShadowRoot.
    readonly attribute StyleSheetList styleSheets; // FIXME: Should be [SameObject].

    // Extensions from the CSSOM-View specification (https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface).
    readonly attribute Element? scrollingElement;

    // Extensions from Selection API (https://www.w3.org/TR/selection-api/#extensions-to-document-interface).
    // FIXME: Should likely be moved to DocumentOrShadowRoot.
    DOMSelection? getSelection();

    // XPath extensions (https://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathEvaluator).
    [MayThrowException] XPathExpression createExpression(optional DOMString expression = "undefined", optional XPathNSResolver? resolver); // FIXME: Using "undefined" as default parameter value is wrong.
    XPathNSResolver createNSResolver(Node? nodeResolver);
    [MayThrowException] XPathResult evaluate(optional DOMString expression = "undefined", optional Node? contextNode, optional XPathNSResolver? resolver, optional unsigned short type = 0, optional XPathResult? inResult); // FIXME: Using "undefined" as default parameter value is wrong.

    // Extensions from FullScreen API (https://fullscreen.spec.whatwg.org/#api).
    // FIXME: Should probably be unprefixed.
    [Conditional=FULLSCREEN_API] readonly attribute boolean webkitFullscreenEnabled;
    [Conditional=FULLSCREEN_API, ImplementedAs=webkitFullscreenElementForBindings] readonly attribute Element? webkitFullscreenElement;
    [Conditional=FULLSCREEN_API] void webkitExitFullscreen();
    [Conditional=FULLSCREEN_API] readonly attribute boolean webkitIsFullScreen; // Mozilla version.
    [Conditional=FULLSCREEN_API] readonly attribute boolean webkitFullScreenKeyboardInputAllowed; // Mozilla version.
    [Conditional=FULLSCREEN_API, ImplementedAs=webkitCurrentFullScreenElementForBindings] readonly attribute Element webkitCurrentFullScreenElement; // Mozilla version.
    [Conditional=FULLSCREEN_API] void webkitCancelFullScreen(); // Mozilla version.
    [NotEnumerable, Conditional=FULLSCREEN_API] attribute EventHandler onwebkitfullscreenchange;
    [NotEnumerable, Conditional=FULLSCREEN_API] attribute EventHandler onwebkitfullscreenerror;

    // Extensions from Pointer Lock API (https://www.w3.org/TR/pointerlock/#extensions-to-the-document-interface).
    [NotEnumerable, Conditional=POINTER_LOCK] attribute EventHandler onpointerlockchange; // FIXME: Should be enumerable.
    [NotEnumerable, Conditional=POINTER_LOCK] attribute EventHandler onpointerlockerror; // FIXME: Should be enumerable.
    [Conditional=POINTER_LOCK] void exitPointerLock();

    // Extensions from CSS Font Loading API (https://drafts.csswg.org/css-font-loading/#font-face-source).
    // FIXME: Should be in a separate FontFaceSource interface.
    readonly attribute FontFaceSet fonts;

    // Extensions from Page visibility API (https://www.w3.org/TR/page-visibility/#sec-document-interface).
    readonly attribute boolean hidden;
    readonly attribute VisibilityState visibilityState;
    attribute EventHandler onvisibilitychange;

    // FIXME: Those were dropped from the CSSOM specification.
    readonly attribute DOMString? preferredStylesheetSet;
    attribute DOMString? selectedStylesheetSet;

    // FIXME: Those have been dropped from the DOM specification.
    readonly attribute DOMString? xmlEncoding;
    [SetterMayThrowException] attribute DOMString? xmlVersion;
    attribute boolean xmlStandalone;

    // FIXME: Blink has already dropped this (https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/s3ezjTuC8ig).
    CSSStyleDeclaration getOverrideStyle(optional Element? element = null, optional DOMString pseudoElement = "undefined");

    // FIXME: Should be moved to GlobalEventHandlers (http://w3c.github.io/selection-api/#extensions-to-globaleventhandlers).
    [NotEnumerable] attribute EventHandler onselectstart; // FIXME: Should be enumerable.
    [NotEnumerable] attribute EventHandler onselectionchange; // FIXME: Should be enumerable.

    // Non standard: It has been superseeded by caretPositionFromPoint which we do not implement yet.
    Range caretRangeFromPoint(optional long x = 0, optional long y = 0);

    // FIXME: This is not standard and has been dropped from Blink already.
    RenderingContext? getCSSCanvasContext(DOMString contextId, DOMString name, long width, long height);

    // Non standard (https://developer.apple.com/reference/webkitjs/document/1633863-webkitgetnamedflows).
    [Conditional=CSS_REGIONS] DOMNamedFlowCollection webkitGetNamedFlows();


    // Obsolete features from https://html.spec.whatwg.org/multipage/obsolete.html

    [CEReactions] attribute [TreatNullAs=EmptyString] DOMString fgColor;
    [CEReactions, ImplementedAs=linkColorForBindings] attribute [TreatNullAs=EmptyString] DOMString linkColor;
    [CEReactions] attribute [TreatNullAs=EmptyString] DOMString vlinkColor;
    [CEReactions] attribute [TreatNullAs=EmptyString] DOMString alinkColor;
    [CEReactions] attribute [TreatNullAs=EmptyString] DOMString bgColor;

    readonly attribute HTMLCollection anchors; /* [SameObject] */
    readonly attribute HTMLCollection applets; /* [SameObject] */

    void clear();
    void captureEvents();
    void releaseEvents();

    [Replaceable] readonly attribute HTMLAllCollection all; /* [SameObject] */
};

// FIXME: Missing "unloaded" value (https://www.w3.org/TR/page-visibility/#sec-document-interface).
enum VisibilityState { "hidden", "visible", "prerender" };

enum DocumentReadyState { "loading", "interactive", "complete" };

Document implements DocumentAndElementEventHandlers;
Document implements ParentNode;
Document implements NonElementParentNode;
Document implements DocumentOrShadowRoot;
Document implements GlobalEventHandlers;