Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Unified Diff: Source/core/dom/Document.idl

Issue 961693004: Rearrange the Document interfaces to match the many specs (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/dom/XMLDocument.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.idl
diff --git a/Source/core/dom/Document.idl b/Source/core/dom/Document.idl
index 7288e0bd61c12890a841c848651351678ecc1ba3..b81949fe4de23bd94ef3a6146dd5685f926202d0 100644
--- a/Source/core/dom/Document.idl
+++ b/Source/core/dom/Document.idl
@@ -25,55 +25,44 @@ typedef (CanvasRenderingContext2D or WebGLRenderingContext) RenderingContext;
// http://www.w3.org/TR/page-visibility/#VisibilityState
enum VisibilityState { "hidden", "visible", "prerender", "unloaded" };
+// https://dom.spec.whatwg.org/#interface-document
+
[
TypeChecking=Unrestricted,
] interface Document : Node {
+ readonly attribute DOMImplementation implementation;
+ readonly attribute DOMString URL;
+ [ImplementedAs=url] readonly attribute DOMString? documentURI;
+ readonly attribute DOMString origin;
+ readonly attribute DOMString compatMode;
+ readonly attribute DOMString? characterSet;
+ [MeasureAs=DocumentInputEncoding, ImplementedAs=characterSet] readonly attribute DOMString? inputEncoding;
+ readonly attribute DOMString contentType;
- // DOM Level 1 Core
readonly attribute DocumentType doctype;
- readonly attribute DOMImplementation implementation;
readonly attribute Element documentElement;
+ HTMLCollection getElementsByTagName(DOMString localName);
+ HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString localName);
+ HTMLCollection getElementsByClassName(DOMString classNames);
[CustomElementCallbacks, PerWorldBindings, RaisesException] Element createElement(DOMString tagName);
+ [CustomElementCallbacks, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName);
DocumentFragment createDocumentFragment();
Text createTextNode(DOMString data);
Comment createComment(DOMString data);
- [RaisesException, MeasureAs=DocumentCreateCDATASection] CDATASection createCDATASection(DOMString data); // Removed from DOM4.
[RaisesException] ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
- [RaisesException, MeasureAs=DocumentCreateAttribute] Attr createAttribute(DOMString name);
- 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, MeasureAs=DocumentCreateAttributeNS] Attr createAttributeNS(DOMString? namespaceURI, DOMString? qualifiedName);
- HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString localName);
- [PerWorldBindings] Element getElementById(DOMString elementId);
-
- // DOM Level 3 Core
-
- [MeasureAs=DocumentInputEncoding, ImplementedAs=characterSet] readonly attribute DOMString? inputEncoding;
-
- [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);
- [ImplementedAs=url] readonly attribute DOMString? documentURI;
- readonly attribute DOMString origin;
-
- // DOM Level 2 Events (DocumentEvents interface)
+ [RaisesException, MeasureAs=DocumentCreateAttribute] Attr createAttribute(DOMString name);
+ [RaisesException, MeasureAs=DocumentCreateAttributeNS] Attr createAttributeNS(DOMString? namespaceURI, DOMString? qualifiedName);
[RaisesException] Event createEvent(DOMString eventType);
- // DOM Level 2 Traversal and Range (DocumentRange interface)
-
Range createRange();
- // DOM Level 2 Traversal and Range (DocumentTraversal interface)
-
+ // NodeFilter.SHOW_ALL = 0xFFFFFFFF
[RaisesException, TypeChecking=Interface] NodeIterator createNodeIterator(Node root,
optional unsigned long whatToShow = 0xFFFFFFFF,
optional NodeFilter? filter = null);
@@ -81,109 +70,82 @@ enum VisibilityState { "hidden", "visible", "prerender", "unloaded" };
optional unsigned long whatToShow = 0xFFFFFFFF,
optional NodeFilter? filter = null);
- // DOM Level 2 Abstract Views (DocumentView interface)
-
- [ImplementedAs=domWindow] readonly attribute Window defaultView;
-
- // DOM Level 2 Style (DocumentStyle interface)
-
- readonly attribute StyleSheetList styleSheets;
+ // FIXME: CDATASection has been removed from the spec. crbug.com/437205
+ [RaisesException, MeasureAs=DocumentCreateCDATASection] CDATASection createCDATASection(DOMString data); // Removed from DOM4.
- // DOM Level 2 Style (DocumentCSS interface)
+ // FIXME: xmlEncoding/xmlVersion/xmlStandalone have been removed from the spec.
+ [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.
- [MeasureAs=DocumentGetOverrideStyle] CSSStyleDeclaration getOverrideStyle();
+ // https://dom.spec.whatwg.org/#interface-nonelementparentnode
- // DOM 4
- readonly attribute DOMString contentType;
+ [PerWorldBindings] Element getElementById(DOMString elementId);
- // Common extensions
- [CustomElementCallbacks]
- boolean execCommand(DOMString command, optional boolean showUI = false, optional DOMString value = "");
- boolean queryCommandEnabled(DOMString command);
- boolean queryCommandIndeterm(DOMString command);
- boolean queryCommandState(DOMString command);
- boolean queryCommandSupported(DOMString command);
- DOMString queryCommandValue(DOMString command);
+ // https://html.spec.whatwg.org/#the-document-object
- // Moved down from HTMLDocument
- [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString dir;
- [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString designMode;
- [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString title;
- readonly attribute DOMString referrer;
+ // resource metadata management
+ [PutForwards=href, Unforgeable] readonly attribute Location location;
[TreatNullAs=NullString, RaisesException=Setter] attribute DOMString domain;
- readonly attribute DOMString URL;
-
+ readonly attribute DOMString referrer;
[TreatNullAs=NullString, RaisesException] attribute DOMString cookie;
+ readonly attribute DOMString lastModified;
+ [TreatReturnedNullStringAs=Undefined] readonly attribute DOMString readyState;
+ // DOM tree accessors
+ [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString title;
+ [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString dir;
[RaisesException=Setter, CustomElementCallbacks, PerWorldBindings, TypeChecking=Interface, ExposeJSAccessors] attribute HTMLElement? body;
-
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;
-
[PerWorldBindings] NodeList getElementsByName(DOMString elementName);
+ readonly attribute HTMLScriptElement currentScript;
- [PutForwards=href, Unforgeable] readonly attribute Location location;
-
- // 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;
+ // user interaction
+ [ImplementedAs=domWindow] readonly attribute Window defaultView;
+ readonly attribute Element activeElement;
+ boolean hasFocus();
+ [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString designMode;
+ [CustomElementCallbacks]
+ boolean execCommand(DOMString command, optional boolean showUI = false, optional DOMString value = "");
+ boolean queryCommandEnabled(DOMString command);
+ boolean queryCommandIndeterm(DOMString command);
+ boolean queryCommandState(DOMString command);
+ boolean queryCommandSupported(DOMString command);
+ DOMString queryCommandValue(DOMString command);
- Element elementFromPoint(long x, long y);
- Element[] elementsFromPoint(long x, long y);
- [MeasureAs=DocumentCaretRangeFromPoint]
- Range caretRangeFromPoint([Default=Undefined] optional long x,
- [Default=Undefined] optional long y);
+ // special event handler IDL attributes that only apply to Document objects
+ attribute EventHandler onreadystatechange;
- // Mozilla extensions
- Selection getSelection();
- readonly attribute DOMString? characterSet;
+ // https://html.spec.whatwg.org/#Document-partial
- // WebKit extensions
+ readonly attribute HTMLCollection anchors;
+ readonly attribute HTMLCollection applets;
- readonly attribute DOMString? preferredStylesheetSet;
+ // http://dev.w3.org/csswg/cssom/#extensions-to-the-document-interface
+ readonly attribute StyleSheetList styleSheets;
attribute DOMString? selectedStylesheetSet;
+ readonly attribute DOMString? preferredStylesheetSet;
- [MeasureAs=DocumentGetCSSCanvasContext] RenderingContext getCSSCanvasContext(DOMString contextId, DOMString name, long width, long height);
-
- // HTML 5
- HTMLCollection getElementsByClassName(DOMString classNames);
- readonly attribute Element activeElement;
- boolean hasFocus();
-
- readonly attribute DOMString compatMode;
+ // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-document-interface
+ Element elementFromPoint(long x, long y);
+ Element[] elementsFromPoint(long x, long y);
- [MeasureAs=DocumentExitPointerLock] void exitPointerLock();
- [MeasureAs=DocumentPointerLockElement] readonly attribute Element pointerLockElement;
+ // http://w3c.github.io/selection-api/#extensions-to-document-interface
+ Selection getSelection();
- // Event handler attributes
- attribute EventHandler onbeforecopy;
- attribute EventHandler onbeforecut;
- attribute EventHandler onbeforepaste;
- attribute EventHandler oncopy;
- attribute EventHandler oncut;
- attribute EventHandler onpaste;
+ // https://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html#extensions-to-the-document-interface
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;
+ [MeasureAs=DocumentPointerLockElement] readonly attribute Element pointerLockElement;
+ [MeasureAs=DocumentExitPointerLock] void exitPointerLock();
+ // http://www.w3.org/TR/touch-events/#extensions-to-the-document-interface
[RuntimeEnabled=Touch] Touch createTouch([Default=Undefined] optional Window window,
[Default=Undefined] optional EventTarget target,
[Default=Undefined] optional long identifier,
@@ -197,13 +159,30 @@ enum VisibilityState { "hidden", "visible", "prerender", "unloaded" };
[Default=Undefined] optional unrestricted float webkitForce);
[RuntimeEnabled=Touch] TouchList createTouchList(Touch... touches);
+ [RuntimeEnabled=Touch] attribute EventHandler ontouchstart;
+ [RuntimeEnabled=Touch] attribute EventHandler ontouchend;
+ [RuntimeEnabled=Touch] attribute EventHandler ontouchmove;
+ [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel;
+
+ // http://w3c.github.io/webcomponents/spec/custom/#extensions-to-document-interface-to-register
[CallWith=ScriptState, CustomElementCallbacks, RaisesException, MeasureAs=DocumentRegisterElement] CustomElementConstructor registerElement(DOMString name, optional ElementRegistrationOptions options);
+
+ // http://w3c.github.io/webcomponents/spec/custom/#extensions-to-document-interface-to-instantiate
[CustomElementCallbacks, PerWorldBindings, RaisesException] Element createElement(DOMString localName, DOMString? typeExtension);
[CustomElementCallbacks, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName, DOMString? typeExtension);
- // Page visibility API.
- readonly attribute VisibilityState visibilityState;
+ // http://www.w3.org/TR/page-visibility/#sec-document-interface
readonly attribute boolean hidden;
+ readonly attribute VisibilityState visibilityState;
+
+ // Non-standard APIs
+ [MeasureAs=DocumentGetOverrideStyle] CSSStyleDeclaration getOverrideStyle();
+ [MeasureAs=DocumentCharset, TreatReturnedNullStringAs=Undefined, TreatNullAs=NullString] 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);
+ [MeasureAs=DocumentGetCSSCanvasContext] RenderingContext getCSSCanvasContext(DOMString contextId, DOMString name, long width, long height);
// Deprecated prefixed page visibility API.
// TODO(davidben): This is a property so attaching a deprecation warning results in false positives when outputting
@@ -211,7 +190,18 @@ enum VisibilityState { "hidden", "visible", "prerender", "unloaded" };
[MeasureAs=PrefixedPageVisibility, ImplementedAs=visibilityState] readonly attribute DOMString webkitVisibilityState;
[MeasureAs=PrefixedPageVisibility, ImplementedAs=hidden] readonly attribute boolean webkitHidden;
- readonly attribute HTMLScriptElement currentScript;
+ // Event handler attributes
+ attribute EventHandler onbeforecopy;
+ attribute EventHandler onbeforecut;
+ attribute EventHandler onbeforepaste;
+ attribute EventHandler oncopy;
+ attribute EventHandler oncut;
+ attribute EventHandler onpaste;
+ attribute EventHandler onsearch;
+ [RuntimeEnabled=ExperimentalContentSecurityPolicyFeatures] attribute EventHandler onsecuritypolicyviolation;
+ attribute EventHandler onselectionchange;
+ attribute EventHandler onselectstart;
+ attribute EventHandler onwheel;
};
Document implements GlobalEventHandlers;
« no previous file with comments | « no previous file | Source/core/dom/XMLDocument.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698