Remove no-op implementations from Document and HTMLDocument.

This commit is contained in:
Ms2ger 2013-10-21 19:51:12 +02:00
parent 5c725b31af
commit e418e4d830
4 changed files with 67 additions and 296 deletions

View file

@ -27,11 +27,11 @@ enum VisibilityState { "hidden", "visible" };
interface Document /*: Node*/ { //XXXjdm Requires servo/#623 interface Document /*: Node*/ { //XXXjdm Requires servo/#623
/*[Throws] /*[Throws]
readonly attribute DOMImplementation implementation;*/ readonly attribute DOMImplementation implementation;*/
readonly attribute DOMString URL; // readonly attribute DOMString URL;
readonly attribute DOMString documentURI; // readonly attribute DOMString documentURI;
readonly attribute DOMString compatMode; // readonly attribute DOMString compatMode;
readonly attribute DOMString characterSet; // readonly attribute DOMString characterSet;
readonly attribute DOMString contentType; // readonly attribute DOMString contentType;
//readonly attribute DocumentType? doctype; //readonly attribute DocumentType? doctype;
readonly attribute Element? documentElement; readonly attribute Element? documentElement;
@ -42,8 +42,8 @@ interface Document /*: Node*/ { //XXXjdm Requires servo/#623
[Creator, Throws] [Creator, Throws]
Element createElement(DOMString localName); Element createElement(DOMString localName);
[Creator, Throws] // [Creator, Throws]
Element createElementNS(DOMString? namespace, DOMString qualifiedName); // Element createElementNS(DOMString? namespace, DOMString qualifiedName);
[Creator] [Creator]
DocumentFragment createDocumentFragment(); DocumentFragment createDocumentFragment();
[Creator] [Creator]
@ -58,8 +58,8 @@ interface Document /*: Node*/ { //XXXjdm Requires servo/#623
[Throws] [Throws]
Node adoptNode(Node node);*/ Node adoptNode(Node node);*/
[Creator, Throws] // [Creator, Throws]
Event createEvent(DOMString interface_); // Event createEvent(DOMString interface_);
/*[Creator, Throws] /*[Creator, Throws]
Range createRange();*/ Range createRange();*/
@ -83,23 +83,23 @@ interface Document /*: Node*/ { //XXXjdm Requires servo/#623
Attr createAttribute(DOMString name); Attr createAttribute(DOMString name);
[Creator, Throws] [Creator, Throws]
Attr createAttributeNS(DOMString? namespace, DOMString name);*/ Attr createAttributeNS(DOMString? namespace, DOMString name);*/
readonly attribute DOMString? inputEncoding; // readonly attribute DOMString? inputEncoding;
}; };
// http://www.whatwg.org/specs/web-apps/current-work/#the-document-object // http://www.whatwg.org/specs/web-apps/current-work/#the-document-object
partial interface Document { partial interface Document {
//[PutForwards=href, Unforgeable] readonly attribute Location? location; //[PutForwards=href, Unforgeable] readonly attribute Location? location;
//(HTML only) attribute DOMString domain; //(HTML only) attribute DOMString domain;
readonly attribute DOMString referrer; // readonly attribute DOMString referrer;
//(HTML only) attribute DOMString cookie; //(HTML only) attribute DOMString cookie;
readonly attribute DOMString lastModified; // readonly attribute DOMString lastModified;
readonly attribute DOMString readyState; // readonly attribute DOMString readyState;
// DOM tree accessors // DOM tree accessors
//(Not proxy yet)getter object (DOMString name); //(Not proxy yet)getter object (DOMString name);
[SetterThrows] [SetterThrows]
attribute DOMString title; attribute DOMString title;
attribute DOMString dir; // attribute DOMString dir;
//(HTML only) attribute HTMLElement? body; //(HTML only) attribute HTMLElement? body;
//(HTML only)readonly attribute HTMLHeadElement? head; //(HTML only)readonly attribute HTMLHeadElement? head;
//(HTML only)readonly attribute HTMLCollection images; //(HTML only)readonly attribute HTMLCollection images;
@ -120,10 +120,10 @@ partial interface Document {
//(HTML only)void writeln(DOMString... text); //(HTML only)void writeln(DOMString... text);
// user interaction // user interaction
readonly attribute WindowProxy? defaultView; // readonly attribute WindowProxy? defaultView;
readonly attribute Element? activeElement; // readonly attribute Element? activeElement;
[Throws] // [Throws]
boolean hasFocus(); // boolean hasFocus();
//(HTML only) attribute DOMString designMode; //(HTML only) attribute DOMString designMode;
//(HTML only)boolean execCommand(DOMString commandId); //(HTML only)boolean execCommand(DOMString commandId);
//(HTML only)boolean execCommand(DOMString commandId, boolean showUI); //(HTML only)boolean execCommand(DOMString commandId, boolean showUI);
@ -157,14 +157,14 @@ partial interface Document {
* *
* @see <https://developer.mozilla.org/en/DOM/document.currentScript> * @see <https://developer.mozilla.org/en/DOM/document.currentScript>
*/ */
readonly attribute Element? currentScript; // readonly attribute Element? currentScript;
/** /**
* Release the current mouse capture if it is on an element within this * Release the current mouse capture if it is on an element within this
* document. * document.
* *
* @see <https://developer.mozilla.org/en/DOM/document.releaseCapture> * @see <https://developer.mozilla.org/en/DOM/document.releaseCapture>
*/ */
void releaseCapture(); // void releaseCapture();
/** /**
* Use the given DOM element as the source image of target |-moz-element()|. * Use the given DOM element as the source image of target |-moz-element()|.
* *
@ -206,9 +206,9 @@ partial interface Document {
partial interface Document { partial interface Document {
// Note: Per spec the 'S' in these two is lowercase, but the "Moz" // Note: Per spec the 'S' in these two is lowercase, but the "Moz"
// versions hve it uppercase. // versions hve it uppercase.
readonly attribute boolean mozFullScreenEnabled; // readonly attribute boolean mozFullScreenEnabled;
[Throws] // [Throws]
readonly attribute Element? mozFullScreenElement; // readonly attribute Element? mozFullScreenElement;
//(Renamed?)void exitFullscreen(); //(Renamed?)void exitFullscreen();
@ -219,8 +219,8 @@ partial interface Document {
// http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html#extensions-to-the-document-interface // http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html#extensions-to-the-document-interface
partial interface Document { partial interface Document {
readonly attribute Element? mozPointerLockElement; // readonly attribute Element? mozPointerLockElement;
void mozExitPointerLock (); // void mozExitPointerLock ();
}; };
//http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html#dfn-document-register //http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html#dfn-document-register
@ -231,27 +231,27 @@ partial interface Document {
// http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview.html#sec-document-interface // http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview.html#sec-document-interface
partial interface Document { partial interface Document {
readonly attribute boolean hidden; // readonly attribute boolean hidden;
readonly attribute boolean mozHidden; // readonly attribute boolean mozHidden;
readonly attribute VisibilityState visibilityState; // readonly attribute VisibilityState visibilityState;
readonly attribute VisibilityState mozVisibilityState; // readonly attribute VisibilityState mozVisibilityState;
}; };
// http://dev.w3.org/csswg/cssom/#extensions-to-the-document-interface // http://dev.w3.org/csswg/cssom/#extensions-to-the-document-interface
partial interface Document { partial interface Document {
/*[Constant] /*[Constant]
readonly attribute StyleSheetList styleSheets;*/ readonly attribute StyleSheetList styleSheets;*/
attribute DOMString? selectedStyleSheetSet; // attribute DOMString? selectedStyleSheetSet;
readonly attribute DOMString? lastStyleSheetSet; // readonly attribute DOMString? lastStyleSheetSet;
readonly attribute DOMString? preferredStyleSheetSet; // readonly attribute DOMString? preferredStyleSheetSet;
/*[Constant] /*[Constant]
readonly attribute DOMStringList styleSheetSets;*/ readonly attribute DOMStringList styleSheetSets;*/
void enableStyleSheetsForSet (DOMString? name); // void enableStyleSheetsForSet (DOMString? name);
}; };
// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-document-interface // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-document-interface
partial interface Document { partial interface Document {
Element? elementFromPoint (float x, float y); // Element? elementFromPoint (float x, float y);
//CaretPosition? caretPositionFromPoint (float x, float y); //CaretPosition? caretPositionFromPoint (float x, float y);
}; };
@ -264,8 +264,8 @@ partial interface Document {
// http://dev.w3.org/2006/webapi/selectors-api2/#interface-definitions // http://dev.w3.org/2006/webapi/selectors-api2/#interface-definitions
partial interface Document { partial interface Document {
[Throws] // [Throws]
Element? querySelector(DOMString selectors); // Element? querySelector(DOMString selectors);
/*[Throws] /*[Throws]
NodeList querySelectorAll(DOMString selectors);*/ NodeList querySelectorAll(DOMString selectors);*/

View file

@ -8,13 +8,13 @@ interface Selection;
[OverrideBuiltins] [OverrideBuiltins]
interface HTMLDocument : Document { interface HTMLDocument : Document {
[Throws] // [Throws]
attribute DOMString? domain; // attribute DOMString? domain;
[Throws] // [Throws]
attribute DOMString cookie; // attribute DOMString cookie;
// DOM tree accessors // DOM tree accessors
[Throws] // [Throws]
getter object (DOMString name); // getter object (DOMString name);
/*[SetterThrows] /*[SetterThrows]
attribute HTMLElement? body;*/ attribute HTMLElement? body;*/
readonly attribute HTMLHeadElement? head; readonly attribute HTMLHeadElement? head;
@ -32,41 +32,41 @@ interface HTMLDocument : Document {
Document open(optional DOMString type = "text/html", optional DOMString replace = ""); Document open(optional DOMString type = "text/html", optional DOMString replace = "");
[Throws] [Throws]
WindowProxy open(DOMString url, DOMString name, DOMString features, optional boolean replace = false);*/ WindowProxy open(DOMString url, DOMString name, DOMString features, optional boolean replace = false);*/
[Throws] // [Throws]
void close(); // void close();
/*[Throws] /*[Throws]
void write(DOMString... text); void write(DOMString... text);
[Throws] [Throws]
void writeln(DOMString... text);*/ void writeln(DOMString... text);*/
[SetterThrows] // [SetterThrows]
attribute DOMString designMode; // attribute DOMString designMode;
[Throws] // [Throws]
boolean execCommand(DOMString commandId, optional boolean showUI = false, // boolean execCommand(DOMString commandId, optional boolean showUI = false,
optional DOMString value = ""); // optional DOMString value = "");
[Throws] // [Throws]
boolean queryCommandEnabled(DOMString commandId); // boolean queryCommandEnabled(DOMString commandId);
[Throws] // [Throws]
boolean queryCommandIndeterm(DOMString commandId); // boolean queryCommandIndeterm(DOMString commandId);
[Throws] // [Throws]
boolean queryCommandState(DOMString commandId); // boolean queryCommandState(DOMString commandId);
boolean queryCommandSupported(DOMString commandId); // boolean queryCommandSupported(DOMString commandId);
[Throws] // [Throws]
DOMString queryCommandValue(DOMString commandId); // DOMString queryCommandValue(DOMString commandId);
[TreatNullAs=EmptyString] attribute DOMString fgColor; // [TreatNullAs=EmptyString] attribute DOMString fgColor;
[TreatNullAs=EmptyString] attribute DOMString linkColor; // [TreatNullAs=EmptyString] attribute DOMString linkColor;
[TreatNullAs=EmptyString] attribute DOMString vlinkColor; // [TreatNullAs=EmptyString] attribute DOMString vlinkColor;
[TreatNullAs=EmptyString] attribute DOMString alinkColor; // [TreatNullAs=EmptyString] attribute DOMString alinkColor;
[TreatNullAs=EmptyString] attribute DOMString bgColor; // [TreatNullAs=EmptyString] attribute DOMString bgColor;
readonly attribute HTMLCollection anchors; readonly attribute HTMLCollection anchors;
readonly attribute HTMLCollection applets; readonly attribute HTMLCollection applets;
void clear(); // void clear();
[Throws] // [Throws]
readonly attribute object all; // readonly attribute object all;
// https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#selections // https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#selections
/*[Throws] /*[Throws]

View file

@ -10,7 +10,6 @@ use dom::bindings::utils::{is_valid_element_name, InvalidCharacter, Traceable, n
use dom::documentfragment::DocumentFragment; use dom::documentfragment::DocumentFragment;
use dom::element::{Element}; use dom::element::{Element};
use dom::element::{HTMLHtmlElementTypeId, HTMLHeadElementTypeId, HTMLTitleElementTypeId}; use dom::element::{HTMLHtmlElementTypeId, HTMLHeadElementTypeId, HTMLTitleElementTypeId};
use dom::event::Event;
use dom::htmlcollection::HTMLCollection; use dom::htmlcollection::HTMLCollection;
use dom::htmldocument::HTMLDocument; use dom::htmldocument::HTMLDocument;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
@ -18,7 +17,6 @@ use dom::htmlhtmlelement::HTMLHtmlElement;
use dom::node::{AbstractNode, ScriptView, Node, ElementNodeTypeId}; use dom::node::{AbstractNode, ScriptView, Node, ElementNodeTypeId};
use dom::text::Text; use dom::text::Text;
use dom::window::Window; use dom::window::Window;
use dom::windowproxy::WindowProxy;
use dom::htmltitleelement::HTMLTitleElement; use dom::htmltitleelement::HTMLTitleElement;
use html::hubbub_html_parser::build_element_from_tag; use html::hubbub_html_parser::build_element_from_tag;
use js::jsapi::{JSObject, JSContext, JSVal}; use js::jsapi::{JSObject, JSContext, JSVal};
@ -212,26 +210,6 @@ impl Reflectable for Document {
} }
impl Document { impl Document {
pub fn URL(&self) -> DOMString {
None
}
pub fn DocumentURI(&self) -> DOMString {
None
}
pub fn CompatMode(&self) -> DOMString {
None
}
pub fn CharacterSet(&self) -> DOMString {
None
}
pub fn ContentType(&self) -> DOMString {
None
}
pub fn GetDocumentElement(&self) -> Option<AbstractNode<ScriptView>> { pub fn GetDocumentElement(&self) -> Option<AbstractNode<ScriptView>> {
self.root self.root
} }
@ -276,10 +254,6 @@ impl Document {
Ok(build_element_from_tag(cx, local_name, abstract_self)) Ok(build_element_from_tag(cx, local_name, abstract_self))
} }
pub fn CreateElementNS(&self, _namespace: &DOMString, _qualified_name: &DOMString) -> Fallible<AbstractNode<ScriptView>> {
fail!("stub")
}
pub fn CreateDocumentFragment(&self, abstract_self: AbstractDocument) -> AbstractNode<ScriptView> { pub fn CreateDocumentFragment(&self, abstract_self: AbstractDocument) -> AbstractNode<ScriptView> {
let cx = self.get_cx(); let cx = self.get_cx();
let fragment = @DocumentFragment::new(abstract_self); let fragment = @DocumentFragment::new(abstract_self);
@ -298,26 +272,6 @@ impl Document {
unsafe { Node::as_abstract_node(cx, comment) } unsafe { Node::as_abstract_node(cx, comment) }
} }
pub fn CreateEvent(&self, _interface: &DOMString) -> Fallible<@mut Event> {
fail!("stub")
}
pub fn GetInputEncoding(&self) -> DOMString {
None
}
pub fn Referrer(&self) -> DOMString {
None
}
pub fn LastModified(&self) -> DOMString {
None
}
pub fn ReadyState(&self) -> DOMString {
None
}
pub fn Title(&self, _: AbstractDocument) -> DOMString { pub fn Title(&self, _: AbstractDocument) -> DOMString {
let mut title = ~""; let mut title = ~"";
match self.doctype { match self.doctype {
@ -397,89 +351,6 @@ impl Document {
Ok(()) Ok(())
} }
pub fn Dir(&self) -> DOMString {
None
}
pub fn SetDir(&self, _dir: &DOMString) {
}
pub fn GetDefaultView(&self) -> Option<@mut WindowProxy> {
None
}
pub fn GetActiveElement(&self) -> Option<AbstractNode<ScriptView>> {
None
}
pub fn HasFocus(&self) -> Fallible<bool> {
Ok(false)
}
pub fn GetCurrentScript(&self) -> Option<AbstractNode<ScriptView>> {
None
}
pub fn ReleaseCapture(&self) {
}
pub fn MozFullScreenEnabled(&self) -> bool {
false
}
pub fn GetMozFullScreenElement(&self) -> Fallible<Option<AbstractNode<ScriptView>>> {
Ok(None)
}
pub fn GetMozPointerLockElement(&self) -> Option<AbstractNode<ScriptView>> {
None
}
pub fn MozExitPointerLock(&self) {
}
pub fn Hidden(&self) -> bool {
false
}
pub fn MozHidden(&self) -> bool {
self.Hidden()
}
pub fn VisibilityState(&self) -> DocumentBinding::VisibilityState {
DocumentBinding::VisibilityStateValues::Visible
}
pub fn MozVisibilityState(&self) -> DocumentBinding::VisibilityState {
self.VisibilityState()
}
pub fn GetSelectedStyleSheetSet(&self) -> DOMString {
None
}
pub fn SetSelectedStyleSheetSet(&self, _sheet: &DOMString) {
}
pub fn GetLastStyleSheetSet(&self) -> DOMString {
None
}
pub fn GetPreferredStyleSheetSet(&self) -> DOMString {
None
}
pub fn EnableStyleSheetsForSet(&self, _name: &DOMString) {
}
pub fn ElementFromPoint(&self, _x: f32, _y: f32) -> Option<AbstractNode<ScriptView>> {
None
}
pub fn QuerySelector(&self, _selectors: &DOMString) -> Fallible<Option<AbstractNode<ScriptView>>> {
Ok(None)
}
pub fn GetElementsByName(&self, name: &DOMString) -> @mut HTMLCollection { pub fn GetElementsByName(&self, name: &DOMString) -> @mut HTMLCollection {
self.createHTMLCollection(|elem| self.createHTMLCollection(|elem|
elem.get_attr("name").is_some() && eq_slice(elem.get_attr("name").unwrap(), null_str_as_empty(name))) elem.get_attr("name").is_some() && eq_slice(elem.get_attr("name").unwrap(), null_str_as_empty(name)))

View file

@ -3,8 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::HTMLDocumentBinding; use dom::bindings::codegen::HTMLDocumentBinding;
use dom::bindings::utils::{DOMString, ErrorResult, Fallible, Traceable}; use dom::bindings::utils::{Reflectable, Reflector, Traceable};
use dom::bindings::utils::{Reflectable, Reflector};
use dom::document::{AbstractDocument, Document, ReflectableDocument, HTML}; use dom::document::{AbstractDocument, Document, ReflectableDocument, HTML};
use dom::element::HTMLHeadElementTypeId; use dom::element::HTMLHeadElementTypeId;
use dom::htmlcollection::HTMLCollection; use dom::htmlcollection::HTMLCollection;
@ -15,7 +14,6 @@ use js::jsapi::{JSObject, JSContext, JSTracer};
use servo_util::tree::{TreeNodeRef, ElementLike}; use servo_util::tree::{TreeNodeRef, ElementLike};
use std::libc;
use std::ptr; use std::ptr;
use std::str::eq_slice; use std::str::eq_slice;
@ -40,26 +38,6 @@ impl ReflectableDocument for HTMLDocument {
} }
impl HTMLDocument { impl HTMLDocument {
pub fn NamedGetter(&self, _cx: *JSContext, _name: &DOMString, _found: &mut bool) -> Fallible<*JSObject> {
Ok(ptr::null())
}
pub fn GetDomain(&self) -> Fallible<DOMString> {
Ok(None)
}
pub fn SetDomain(&self, _domain: &DOMString) -> ErrorResult {
Ok(())
}
pub fn GetCookie(&self) -> Fallible<DOMString> {
Ok(None)
}
pub fn SetCookie(&self, _cookie: &DOMString) -> ErrorResult {
Ok(())
}
pub fn GetHead(&self) -> Option<AbstractNode<ScriptView>> { pub fn GetHead(&self) -> Option<AbstractNode<ScriptView>> {
match self.parent.GetDocumentElement() { match self.parent.GetDocumentElement() {
None => None, None => None,
@ -95,77 +73,6 @@ impl HTMLDocument {
self.parent.createHTMLCollection(|elem| eq_slice(elem.tag_name, "script")) self.parent.createHTMLCollection(|elem| eq_slice(elem.tag_name, "script"))
} }
pub fn Close(&self) -> ErrorResult {
Ok(())
}
pub fn DesignMode(&self) -> DOMString {
None
}
pub fn SetDesignMode(&self, _mode: &DOMString) -> ErrorResult {
Ok(())
}
pub fn ExecCommand(&self, _command_id: &DOMString, _show_ui: bool, _value: &DOMString) -> Fallible<bool> {
Ok(false)
}
pub fn QueryCommandEnabled(&self, _command_id: &DOMString) -> Fallible<bool> {
Ok(false)
}
pub fn QueryCommandIndeterm(&self, _command_id: &DOMString) -> Fallible<bool> {
Ok(false)
}
pub fn QueryCommandState(&self, _command_id: &DOMString) -> Fallible<bool> {
Ok(false)
}
pub fn QueryCommandSupported(&self, _command_id: &DOMString) -> bool {
false
}
pub fn QueryCommandValue(&self, _command_id: &DOMString) -> Fallible<DOMString> {
Ok(None)
}
pub fn FgColor(&self) -> DOMString {
None
}
pub fn SetFgColor(&self, _color: &DOMString) {
}
pub fn LinkColor(&self) -> DOMString {
None
}
pub fn SetLinkColor(&self, _color: &DOMString) {
}
pub fn VlinkColor(&self) -> DOMString {
None
}
pub fn SetVlinkColor(&self, _color: &DOMString) {
}
pub fn AlinkColor(&self) -> DOMString {
None
}
pub fn SetAlinkColor(&self, _color: &DOMString) {
}
pub fn BgColor(&self) -> DOMString {
None
}
pub fn SetBgColor(&self, _color: &DOMString) {
}
pub fn Anchors(&self) -> @mut HTMLCollection { pub fn Anchors(&self) -> @mut HTMLCollection {
self.parent.createHTMLCollection(|elem| self.parent.createHTMLCollection(|elem|
eq_slice(elem.tag_name, "a") && elem.get_attr("name").is_some()) eq_slice(elem.tag_name, "a") && elem.get_attr("name").is_some())
@ -175,13 +82,6 @@ impl HTMLDocument {
// FIXME: This should be return OBJECT elements containing applets. // FIXME: This should be return OBJECT elements containing applets.
self.parent.createHTMLCollection(|elem| eq_slice(elem.tag_name, "applet")) self.parent.createHTMLCollection(|elem| eq_slice(elem.tag_name, "applet"))
} }
pub fn Clear(&self) {
}
pub fn GetAll(&self, _cx: *JSContext) -> Fallible<*libc::c_void> {
Ok(ptr::null())
}
} }
impl Reflectable for HTMLDocument { impl Reflectable for HTMLDocument {