Index: core/dom/Document.idl |
diff --git a/core/dom/Document.idl b/core/dom/Document.idl |
index 09e583726573fe87e25d09586fabfcb490ad6f8c..5b4d664ef087c0b66ec9732b1ae8e55c8f6f363c 100644 |
--- a/core/dom/Document.idl |
+++ b/core/dom/Document.idl |
@@ -20,150 +20,192 @@ |
callback CustomElementConstructor = Element (); |
-typedef (CanvasRenderingContext2D or WebGLRenderingContext) RenderingContext; |
- |
-[ |
- SpecialWrapFor=(HTMLDocument,XMLDocument) |
-] interface Document : Node { |
- |
- // DOM Level 1 Core |
- readonly attribute DocumentType doctype; |
- readonly attribute DOMImplementation implementation; |
- readonly attribute Element documentElement; |
- |
- [CustomElementCallbacks, PerWorldBindings, RaisesException] Element createElement(DOMString tagName); |
- DocumentFragment createDocumentFragment(); |
- Text createTextNode(DOMString data); |
- Comment createComment(DOMString data); |
- [RaisesException, MeasureAs=DocumentCreateCDATASection] CDATASection createCDATASection([Default=Undefined] optional DOMString data); // Removed from DOM4. |
- [RaisesException] ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data); |
- [RaisesException, MeasureAs=DocumentCreateAttribute] Attr createAttribute([Default=Undefined] optional DOMString name); // Removed from DOM4. |
- [DartNoAutoScope] HTMLCollection getElementsByTagName(DOMString localName); |
- |
- // Introduced in DOM Level 2: |
- |
- [CustomElementCallbacks, RaisesException, TypeChecking=Interface] Node importNode(Node node, optional boolean deep = false); |
- [CustomElementCallbacks, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName); |
- [RaisesException, DeprecateAs=DocumentCreateAttributeNS] Attr createAttributeNS([Default=Undefined] optional DOMString? namespaceURI, |
- [Default=Undefined] optional DOMString? qualifiedName); // Removed from DOM4. |
- HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString localName); |
- [PerWorldBindings, DartNoAutoScope] Element getElementById(DOMString elementId); |
- |
- // DOM Level 3 Core |
+// https://html.spec.whatwg.org/#the-document-object |
+enum DocumentReadyState { "loading", "interactive", "complete" }; |
- [MeasureAs=DocumentInputEncoding] readonly attribute DOMString? inputEncoding; // Removed from DOM4. |
+// http://www.w3.org/TR/page-visibility/#VisibilityState |
+enum VisibilityState { "hidden", "visible", "prerender", "unloaded" }; |
- [MeasureAs=DocumentXMLEncoding] readonly attribute DOMString? xmlEncoding; // Removed from DOM4. |
- [RaisesException=Setter, MeasureAs=DocumentXMLVersion] attribute DOMString? xmlVersion; // Removed from DOM4. |
- [RaisesException=Setter, MeasureAs=DocumentXMLStandalone] attribute boolean xmlStandalone; // Removed from DOM4. |
- |
- [RaisesException, CustomElementCallbacks, TypeChecking=Interface] Node adoptNode(Node node); |
+// https://dom.spec.whatwg.org/#interface-document |
+// FIXME: Document should have a constructor. crbug.com/238234 |
+interface Document : Node { |
+ [SameObject] readonly attribute DOMImplementation implementation; |
+ readonly attribute DOMString URL; |
+ // FIXME: documentURI should not be nullable. |
[ImplementedAs=url] readonly attribute DOMString? documentURI; |
+ readonly attribute DOMString origin; |
+ readonly attribute DOMString compatMode; |
- // DOM Level 2 Events (DocumentEvents interface) |
- |
- [RaisesException] Event createEvent(DOMString eventType); |
- |
- // DOM Level 2 Traversal and Range (DocumentRange interface) |
+ readonly attribute DOMString characterSet; |
+ [MeasureAs=DocumentInputEncoding, ImplementedAs=characterSet] readonly attribute DOMString inputEncoding; // legacy alias of .characterSet |
+ readonly attribute DOMString contentType; |
- Range createRange(); |
+ readonly attribute DocumentType? doctype; |
+ readonly attribute Element? documentElement; |
+ HTMLCollection getElementsByTagName(DOMString localName); |
+ HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString localName); |
+ HTMLCollection getElementsByClassName(DOMString classNames); |
- // DOM Level 2 Traversal and Range (DocumentTraversal interface) |
+ [NewObject, CustomElementCallbacks, PerWorldBindings, RaisesException] Element createElement(DOMString localName); |
+ [NewObject, CustomElementCallbacks, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName); |
+ [NewObject] DocumentFragment createDocumentFragment(); |
+ [NewObject] Text createTextNode(DOMString data); |
+ [NewObject] Comment createComment(DOMString data); |
+ [NewObject, RaisesException] ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data); |
- [RaisesException, TypeChecking=Interface] NodeIterator createNodeIterator(Node root, |
- optional unsigned long whatToShow = 0xFFFFFFFF, |
- optional NodeFilter? filter = null); |
- [RaisesException, TypeChecking=Interface] TreeWalker createTreeWalker(Node root, |
- optional unsigned long whatToShow = 0xFFFFFFFF, |
- optional NodeFilter? filter = null); |
+ [NewObject, CustomElementCallbacks, RaisesException, TypeChecking=Interface] Node importNode(Node node, optional boolean deep = false); |
+ [RaisesException, CustomElementCallbacks, TypeChecking=Interface] Node adoptNode(Node node); |
- // DOM Level 2 Abstract Views (DocumentView interface) |
+ [NewObject, RaisesException, MeasureAs=DocumentCreateAttribute] Attr createAttribute(DOMString localName); |
+ [NewObject, RaisesException, MeasureAs=DocumentCreateAttributeNS] Attr createAttributeNS(DOMString? namespaceURI, DOMString qualifiedName); |
- [ImplementedAs=domWindow] readonly attribute Window defaultView; |
+ [NewObject, RaisesException] Event createEvent(DOMString eventType); |
- // DOM Level 2 Style (DocumentStyle interface) |
+ [NewObject] Range createRange(); |
- readonly attribute StyleSheetList styleSheets; |
+ // NodeFilter.SHOW_ALL = 0xFFFFFFFF |
+ [NewObject, RaisesException, TypeChecking=Interface] NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null); |
+ [NewObject, RaisesException, TypeChecking=Interface] TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null); |
- // DOM Level 2 Style (DocumentCSS interface) |
+ // FIXME: CDATASection has been removed from the spec. crbug.com/437205 |
+ [RaisesException, MeasureAs=DocumentCreateCDATASection] CDATASection createCDATASection(DOMString data); |
- CSSStyleDeclaration getOverrideStyle([Default=Undefined] optional Element element, |
- [Default=Undefined] optional DOMString pseudoElement); |
+ // FIXME: xmlEncoding/xmlVersion/xmlStandalone have been removed from the spec. |
+ [MeasureAs=DocumentXMLEncoding] readonly attribute DOMString? xmlEncoding; |
+ [RaisesException=Setter, MeasureAs=DocumentXMLVersion] attribute DOMString? xmlVersion; |
+ [RaisesException=Setter, MeasureAs=DocumentXMLStandalone] attribute boolean xmlStandalone; |
- // DOM 4 |
- readonly attribute DOMString contentType; |
+ // HTML |
+ // https://html.spec.whatwg.org/#the-document-object |
- // Common extensions |
- [CustomElementCallbacks] |
- boolean execCommand([Default=Undefined] optional DOMString command, |
- [Default=Undefined] optional boolean userInterface, |
- [TreatUndefinedAs=NullString, Default=Undefined] optional DOMString? value); |
- |
- boolean queryCommandEnabled([Default=Undefined] optional DOMString command); |
- boolean queryCommandIndeterm([Default=Undefined] optional DOMString command); |
- boolean queryCommandState([Default=Undefined] optional DOMString command); |
- boolean queryCommandSupported([Default=Undefined] optional DOMString command); |
- DOMString queryCommandValue([Default=Undefined] optional DOMString command); |
- |
- // Moved down from HTMLDocument |
- [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString dir; |
- [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString designMode; |
- [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString title; |
+ // resource metadata management |
+ [PutForwards=href, Unforgeable] readonly attribute Location? location; |
+ [RaisesException=Setter] attribute DOMString domain; |
readonly attribute DOMString referrer; |
- [TreatNullAs=NullString, RaisesException=Setter] attribute DOMString domain; |
- readonly attribute DOMString URL; |
+ // FIXME: cookie should not have [TreatNullAs=NullString]. |
+ [TreatNullAs=NullString, RaisesException] attribute DOMString cookie; |
+ readonly attribute DOMString lastModified; |
+ readonly attribute DocumentReadyState readyState; |
+ |
+ // DOM tree accessors |
+ // FIXME: title and dir should not have [TreatNullAs=NullString]. |
+ [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString title; |
+ [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString dir; |
+ [RaisesException=Setter, CustomElementCallbacks, PerWorldBindings, TypeChecking=Interface] attribute HTMLElement? body; |
+ readonly attribute HTMLHeadElement? head; |
+ [SameObject] readonly attribute HTMLCollection images; |
+ [SameObject] readonly attribute HTMLCollection embeds; |
+ [SameObject, ImplementedAs=embeds] readonly attribute HTMLCollection plugins; |
+ [SameObject] readonly attribute HTMLCollection links; |
+ [SameObject] readonly attribute HTMLCollection forms; |
+ [SameObject] readonly attribute HTMLCollection scripts; |
+ [PerWorldBindings] NodeList getElementsByName(DOMString elementName); |
+ readonly attribute HTMLScriptElement? currentScript; |
+ |
+ // dynamic markup insertion |
+ // FIXME: There are two open() methods in the spec. |
+ [Custom, CustomElementCallbacks, RaisesException] void open(); |
+ [RaisesException] void close(); |
+ [CallWith=ActiveWindow, CustomElementCallbacks, RaisesException] void write(DOMString... text); |
+ [CallWith=ActiveWindow, CustomElementCallbacks, RaisesException] void writeln(DOMString... text); |
+ |
+ // user interaction |
+ [ImplementedAs=domWindow] readonly attribute Window? defaultView; |
+ readonly attribute Element? activeElement; |
+ boolean hasFocus(); |
+ // FIXME: designMode should not have [TreatNullAs=NullString]. |
+ [TreatNullAs=NullString, CustomElementCallbacks, MeasureAs=DocumentDesignMode] attribute DOMString designMode; |
+ [CustomElementCallbacks, RaisesException] boolean execCommand(DOMString commandId, optional boolean showUI = false, optional DOMString value = ""); |
+ [RaisesException] boolean queryCommandEnabled(DOMString commandId); |
+ [RaisesException] boolean queryCommandIndeterm(DOMString commandId); |
+ [RaisesException] boolean queryCommandState(DOMString commandId); |
+ [RaisesException] boolean queryCommandSupported(DOMString commandId); |
+ [RaisesException] DOMString queryCommandValue(DOMString commandId); |
- [TreatNullAs=NullString, RaisesException] attribute DOMString cookie; |
+ [LenientThis] attribute EventHandler onreadystatechange; |
- [RaisesException=Setter, CustomElementCallbacks, PerWorldBindings, TypeChecking=Interface, DartNoAutoScope] attribute HTMLElement? body; |
+ // HTML obsolete features |
+ // https://html.spec.whatwg.org/#Document-partial |
- readonly attribute HTMLHeadElement head; |
- readonly attribute HTMLCollection images; |
- readonly attribute HTMLCollection applets; |
- readonly attribute HTMLCollection embeds; |
- [ImplementedAs=embeds] readonly attribute HTMLCollection plugins; |
- readonly attribute HTMLCollection links; |
- readonly attribute HTMLCollection forms; |
- readonly attribute HTMLCollection scripts; |
- readonly attribute HTMLCollection anchors; |
- readonly attribute DOMString lastModified; |
+ // FIXME: *Color are on HTMLDocument. |
- [PerWorldBindings, DartNoAutoScope] NodeList getElementsByName([Default=Undefined] optional DOMString elementName); |
+ readonly attribute HTMLCollection anchors; |
+ readonly attribute HTMLCollection applets; |
- [PutForwards=href] readonly attribute Location location; |
+ // FIXME: clear(), captureEvents(), releaseEvents() and all are on HTMLDocument. |
- // IE extensions |
- [MeasureAs=DocumentCharset, TreatReturnedNullStringAs=Undefined, TreatNullAs=NullString] attribute DOMString charset; |
- [MeasureAs=DocumentDefaultCharset, TreatReturnedNullStringAs=Undefined] readonly attribute DOMString defaultCharset; |
- [TreatReturnedNullStringAs=Undefined] readonly attribute DOMString readyState; |
+ // CSS Object Model (CSSOM) |
+ // http://dev.w3.org/csswg/cssom/#extensions-to-the-document-interface |
+ [SameObject] readonly attribute StyleSheetList styleSheets; |
+ attribute DOMString? selectedStylesheetSet; |
+ readonly attribute DOMString? preferredStylesheetSet; |
- Element elementFromPoint([Default=Undefined] optional long x, |
- [Default=Undefined] optional long y); |
- [MeasureAs=DocumentCaretRangeFromPoint] |
- Range caretRangeFromPoint([Default=Undefined] optional long x, |
- [Default=Undefined] optional long y); |
+ // CSSOM View Module |
+ // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-document-interface |
+ // FIXME: The x and y arguments should be of type double. |
+ Element? elementFromPoint(long x, long y); |
+ sequence<Element> elementsFromPoint(long x, long y); |
+ readonly attribute Element? scrollingElement; |
- // Mozilla extensions |
- Selection getSelection(); |
- readonly attribute DOMString? characterSet; |
+ // Selection API |
+ // http://w3c.github.io/selection-api/#extensions-to-document-interface |
+ Selection? getSelection(); |
- // WebKit extensions |
+ // Pointer Lock |
+ // https://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html#extensions-to-the-document-interface |
+ attribute EventHandler onpointerlockchange; |
+ attribute EventHandler onpointerlockerror; |
+ [MeasureAs=DocumentPointerLockElement] readonly attribute Element? pointerLockElement; |
+ [MeasureAs=DocumentExitPointerLock] void exitPointerLock(); |
- readonly attribute DOMString? preferredStylesheetSet; |
- attribute DOMString? selectedStylesheetSet; |
+ // Touch Events |
+ // http://rawgit.com/w3c/touch-events/v1-errata/touchevents.html#extensions-to-the-document-interface |
+ // FIXME: The arguments should not be optional. |
+ [RuntimeEnabled=Touch, Measure] Touch createTouch([Default=Undefined] optional Window window, |
+ [Default=Undefined] optional EventTarget target, |
+ [Default=Undefined] optional long identifier, |
+ [Default=Undefined] optional unrestricted double pageX, |
+ [Default=Undefined] optional unrestricted double pageY, |
+ [Default=Undefined] optional unrestricted double screenX, |
+ [Default=Undefined] optional unrestricted double screenY, |
+ [Default=Undefined] optional unrestricted double radiusX, |
+ [Default=Undefined] optional unrestricted double radiusY, |
+ [Default=Undefined] optional unrestricted float rotationAngle, |
+ [Default=Undefined] optional unrestricted float force); |
+ [RuntimeEnabled=Touch] TouchList createTouchList(Touch... touches); |
- [MeasureAs=DocumentGetCSSCanvasContext] RenderingContext getCSSCanvasContext(DOMString contextId, DOMString name, long width, long height); |
+ // FIXME: The spec doesn't define these event handler attributes. |
+ [RuntimeEnabled=Touch] attribute EventHandler ontouchstart; |
+ [RuntimeEnabled=Touch] attribute EventHandler ontouchend; |
+ [RuntimeEnabled=Touch] attribute EventHandler ontouchmove; |
+ [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel; |
- // HTML 5 |
- HTMLCollection getElementsByClassName(DOMString classNames); |
- readonly attribute Element activeElement; |
- boolean hasFocus(); |
+ // Custom Elements |
+ // http://w3c.github.io/webcomponents/spec/custom/#extensions-to-document-interface-to-register |
+ // FIXME: The registerElement return type should be Function. |
+ [CallWith=ScriptState, CustomElementCallbacks, RaisesException, MeasureAs=DocumentRegisterElement] CustomElementConstructor registerElement(DOMString type, optional ElementRegistrationOptions options); |
+ // http://w3c.github.io/webcomponents/spec/custom/#extensions-to-document-interface-to-instantiate |
+ // FIXME: The typeExtension arguments should not be nullable. |
+ [CustomElementCallbacks, PerWorldBindings, RaisesException] Element createElement(DOMString localName, DOMString? typeExtension); |
+ [CustomElementCallbacks, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName, DOMString? typeExtension); |
+ |
+ // Page Visibility |
+ // http://www.w3.org/TR/page-visibility/#sec-document-interface |
+ readonly attribute boolean hidden; |
+ readonly attribute VisibilityState visibilityState; |
- readonly attribute DOMString compatMode; |
+ // Non-standard APIs |
+ [MeasureAs=DocumentCharset] readonly attribute DOMString charset; |
+ [MeasureAs=DocumentDefaultCharset, TreatReturnedNullStringAs=Undefined] readonly attribute DOMString defaultCharset; |
+ [MeasureAs=DocumentCaretRangeFromPoint] Range caretRangeFromPoint([Default=Undefined] optional long x, [Default=Undefined] optional long y); |
+ [CallWith=ScriptState, DeprecateAs=DocumentGetCSSCanvasContext] any getCSSCanvasContext(DOMString contextId, DOMString name, long width, long height); |
- [MeasureAs=DocumentExitPointerLock] void exitPointerLock(); |
- [MeasureAs=DocumentPointerLockElement] readonly attribute Element pointerLockElement; |
+ // Deprecated prefixed page visibility API. |
+ // TODO(davidben): This is a property so attaching a deprecation warning results in false positives when outputting |
+ // document in the console. It's possible http://crbug.com/43394 will resolve this. |
+ [MeasureAs=PrefixedPageVisibility, ImplementedAs=visibilityState] readonly attribute DOMString webkitVisibilityState; |
+ [MeasureAs=PrefixedPageVisibility, ImplementedAs=hidden] readonly attribute boolean webkitHidden; |
// Event handler attributes |
attribute EventHandler onbeforecopy; |
@@ -172,48 +214,13 @@ typedef (CanvasRenderingContext2D or WebGLRenderingContext) RenderingContext; |
attribute EventHandler oncopy; |
attribute EventHandler oncut; |
attribute EventHandler onpaste; |
- attribute EventHandler onpointerlockchange; |
- attribute EventHandler onpointerlockerror; |
- attribute EventHandler onreadystatechange; |
attribute EventHandler onsearch; |
[RuntimeEnabled=ExperimentalContentSecurityPolicyFeatures] attribute EventHandler onsecuritypolicyviolation; |
attribute EventHandler onselectionchange; |
attribute EventHandler onselectstart; |
- [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel; |
- [RuntimeEnabled=Touch] attribute EventHandler ontouchend; |
- [RuntimeEnabled=Touch] attribute EventHandler ontouchmove; |
- [RuntimeEnabled=Touch] attribute EventHandler ontouchstart; |
attribute EventHandler onwheel; |
- |
- [RuntimeEnabled=Touch] Touch createTouch([Default=Undefined] optional Window window, |
- [Default=Undefined] optional EventTarget target, |
- [Default=Undefined] optional long identifier, |
- [Default=Undefined] optional double pageX, |
- [Default=Undefined] optional double pageY, |
- [Default=Undefined] optional double screenX, |
- [Default=Undefined] optional double screenY, |
- [Default=Undefined] optional double webkitRadiusX, |
- [Default=Undefined] optional double webkitRadiusY, |
- [Default=Undefined] optional float webkitRotationAngle, |
- [Default=Undefined] optional float webkitForce); |
- [RuntimeEnabled=Touch] TouchList createTouchList(Touch... touches); |
- |
- [CallWith=ScriptState, CustomElementCallbacks, RaisesException, MeasureAs=DocumentRegisterElement] CustomElementConstructor registerElement(DOMString name, optional Dictionary options); |
- [CustomElementCallbacks, PerWorldBindings, RaisesException, DartCustom] Element createElement(DOMString localName, DOMString? typeExtension); |
- [CustomElementCallbacks, RaisesException, DartCustom] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName, DOMString? typeExtension); |
- |
- // Page visibility API. |
- readonly attribute DOMString visibilityState; |
- readonly attribute boolean hidden; |
- |
- // Deprecated prefixed page visibility API. |
- // TODO(davidben): This is a property so attaching a deprecation warning results in false positives when outputting |
- // document in the console. It's possible http://crbug.com/43394 will resolve this. |
- [MeasureAs=PrefixedPageVisibility, ImplementedAs=visibilityState] readonly attribute DOMString webkitVisibilityState; |
- [MeasureAs=PrefixedPageVisibility, ImplementedAs=hidden] readonly attribute boolean webkitHidden; |
- |
- readonly attribute HTMLScriptElement currentScript; |
}; |
Document implements GlobalEventHandlers; |
Document implements ParentNode; |
+Document implements NonElementParentNode; |