mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Remove HTMLDocument.
This commit is contained in:
parent
7190feb5e3
commit
e2617a6396
12 changed files with 10 additions and 81 deletions
|
@ -224,10 +224,6 @@ DOMInterfaces = {
|
|||
{
|
||||
}],
|
||||
|
||||
'HTMLDocument': {
|
||||
'customTrace': 'trace'
|
||||
},
|
||||
|
||||
'HTMLOptionsCollection': [
|
||||
{
|
||||
'nativeType': 'nsHTMLOptionCollection',
|
||||
|
|
|
@ -3,14 +3,13 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::bindings::codegen::DOMImplementationBinding;
|
||||
use dom::bindings::codegen::InheritTypes::{NodeCast, DocumentCast};
|
||||
use dom::bindings::codegen::InheritTypes::NodeCast;
|
||||
use dom::bindings::js::JS;
|
||||
use dom::bindings::utils::{Reflector, Reflectable, reflect_dom_object};
|
||||
use dom::bindings::utils::{Fallible, InvalidCharacter, NamespaceError};
|
||||
use dom::bindings::utils::{QName, Name, InvalidXMLName, xml_name_type};
|
||||
use dom::document::{Document, HTML, HTMLDocumentTypeId};
|
||||
use dom::documenttype::DocumentType;
|
||||
use dom::htmldocument::HTMLDocument;
|
||||
use dom::htmlbodyelement::HTMLBodyElement;
|
||||
use dom::htmlheadelement::HTMLHeadElement;
|
||||
use dom::htmlhtmlelement::HTMLHtmlElement;
|
||||
|
@ -67,7 +66,7 @@ impl DOMImplementation {
|
|||
// http://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument
|
||||
pub fn CreateHTMLDocument(&self, title: Option<DOMString>) -> JS<Document> {
|
||||
// Step 1-2.
|
||||
let doc: JS<Document> = DocumentCast::from(&HTMLDocument::new(&self.owner, None));
|
||||
let doc = Document::new(&self.owner, None, HTML, None);
|
||||
assert!(doc.get().doctype == HTML);
|
||||
|
||||
let mut doc_node: JS<Node> = NodeCast::from(&doc);
|
||||
|
|
|
@ -4,13 +4,11 @@
|
|||
|
||||
use dom::bindings::codegen::DOMParserBinding;
|
||||
use dom::bindings::codegen::DOMParserBinding::SupportedTypeValues::{Text_html, Text_xml};
|
||||
use dom::bindings::codegen::InheritTypes::DocumentCast;
|
||||
use dom::bindings::js::JS;
|
||||
use dom::bindings::utils::{Reflector, Reflectable, reflect_dom_object};
|
||||
use dom::bindings::utils::Fallible;
|
||||
use dom::bindings::utils::FailureUnknown;
|
||||
use dom::document::Document;
|
||||
use dom::htmldocument::HTMLDocument;
|
||||
use dom::document::{Document, HTML};
|
||||
use dom::window::Window;
|
||||
use servo_util::str::DOMString;
|
||||
|
||||
|
@ -43,7 +41,7 @@ impl DOMParser {
|
|||
-> Fallible<JS<Document>> {
|
||||
match ty {
|
||||
Text_html => {
|
||||
Ok(DocumentCast::from(&HTMLDocument::new(&self.owner, None)))
|
||||
Ok(Document::new(&self.owner, None, HTML, None))
|
||||
}
|
||||
Text_xml => {
|
||||
Document::Constructor(&self.owner)
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::bindings::codegen::HTMLDocumentBinding;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLDocumentDerived;
|
||||
use dom::bindings::js::JS;
|
||||
use dom::bindings::utils::{Reflectable, Reflector};
|
||||
use dom::document::{Document, HTML, HTMLDocumentTypeId};
|
||||
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
|
||||
use dom::node::DocumentNodeTypeId;
|
||||
use dom::window::Window;
|
||||
|
||||
use extra::url::Url;
|
||||
|
||||
#[deriving(Encodable)]
|
||||
pub struct HTMLDocument {
|
||||
parent: Document
|
||||
}
|
||||
|
||||
impl HTMLDocumentDerived for EventTarget {
|
||||
fn is_htmldocument(&self) -> bool {
|
||||
match self.type_id {
|
||||
NodeTargetTypeId(DocumentNodeTypeId(HTMLDocumentTypeId)) => true,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl HTMLDocument {
|
||||
pub fn new_inherited(window: JS<Window>, url: Option<Url>) -> HTMLDocument {
|
||||
HTMLDocument {
|
||||
parent: Document::new_inherited(window, url, HTML, None)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(window: &JS<Window>, url: Option<Url>) -> JS<HTMLDocument> {
|
||||
let document = HTMLDocument::new_inherited(window.clone(), url);
|
||||
Document::reflect_document(~document, window, HTMLDocumentBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
||||
impl Reflectable for HTMLDocument {
|
||||
fn reflector<'a>(&'a self) -> &'a Reflector {
|
||||
self.parent.reflector()
|
||||
}
|
||||
|
||||
fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector {
|
||||
self.parent.mut_reflector()
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
/* http://www.whatwg.org/specs/web-apps/current-work/#the-document-object */
|
||||
interface HTMLDocument : Document {};
|
|
@ -81,7 +81,6 @@ pub mod dom {
|
|||
pub mod htmldirectoryelement;
|
||||
pub mod htmldivelement;
|
||||
pub mod htmldlistelement;
|
||||
pub mod htmldocument;
|
||||
pub mod htmlelement;
|
||||
pub mod htmlembedelement;
|
||||
pub mod htmlfieldsetelement;
|
||||
|
|
|
@ -6,15 +6,14 @@
|
|||
//! and layout tasks.
|
||||
|
||||
use dom::bindings::codegen::RegisterBindings;
|
||||
use dom::bindings::codegen::InheritTypes::{EventTargetCast, NodeCast, DocumentCast, ElementCast};
|
||||
use dom::bindings::codegen::InheritTypes::{EventTargetCast, NodeCast, ElementCast};
|
||||
use dom::bindings::js::JS;
|
||||
use dom::bindings::utils::{Reflectable, GlobalStaticData, with_gc_enabled};
|
||||
use dom::document::Document;
|
||||
use dom::document::{Document, HTML};
|
||||
use dom::element::Element;
|
||||
use dom::event::{Event_, ResizeEvent, ReflowEvent, ClickEvent, MouseDownEvent, MouseMoveEvent, MouseUpEvent};
|
||||
use dom::event::Event;
|
||||
use dom::eventtarget::EventTarget;
|
||||
use dom::htmldocument::HTMLDocument;
|
||||
use dom::node::{Node, NodeHelpers};
|
||||
use dom::window::{TimerData, TimerHandle, Window};
|
||||
use html::hubbub_html_parser::HtmlParserResult;
|
||||
|
@ -718,7 +717,7 @@ impl ScriptTask {
|
|||
// Parse HTML.
|
||||
//
|
||||
// Note: We can parse the next document in parallel with any previous documents.
|
||||
let mut document = DocumentCast::from(&HTMLDocument::new(&window, Some(url.clone())));
|
||||
let mut document = Document::new(&window, Some(url.clone()), HTML, None);
|
||||
let html_parsing_result = hubbub_html_parser::parse_html(cx.ptr,
|
||||
&mut document,
|
||||
url.clone(),
|
||||
|
|
|
@ -6,7 +6,6 @@ is_a(window, Window);
|
|||
is_a(document.documentElement, HTMLHtmlElement);
|
||||
is_a(document.documentElement.firstChild, HTMLHeadElement);
|
||||
is(document.documentElement.nextSibling, null);
|
||||
is_a(document, HTMLDocument);
|
||||
is_a(document, Document);
|
||||
finish();
|
||||
</script>
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
<script>
|
||||
// test1: HTML document
|
||||
{
|
||||
is_a(document, HTMLDocument, "test1-0, HTML document");
|
||||
is_a(document, Document, "test1-0, HTML document");
|
||||
is(document.contentType, "text/html", "test1-1, HTML document");
|
||||
}
|
||||
|
||||
// test2: XML document
|
||||
{
|
||||
var doc = new Document;
|
||||
is_not_a(doc, HTMLDocument, "test2-0, XML document");
|
||||
is_a(doc, Document, "test2-0, XML document");
|
||||
is(doc.contentType, "application/xml", "test2-1, XML document");
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
var htmldoc = document.implementation.createHTMLDocument("example title");
|
||||
isnot(htmldoc, null, "test3-0, createHTMLDocument");
|
||||
is_a(htmldoc, Document, "test3-1, createHTMLDocument");
|
||||
is_a(htmldoc, HTMLDocument, "test3-2, createHTMLDocument");
|
||||
is(htmldoc.childNodes.length, 2, "test3-3, createHTMLDocument");
|
||||
|
||||
is_a(htmldoc.doctype && htmldoc.doctype, DocumentType, "test3-4, createHTMLDocument");
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<body>
|
||||
<div id="div1"></div>
|
||||
<script>
|
||||
is_a(document.documentElement.parentNode, HTMLDocument);
|
||||
is_a(document.documentElement.parentNode, Document);
|
||||
is(document.documentElement.parentElement, null);
|
||||
|
||||
var elem = document.createElement("p");
|
||||
|
|
|
@ -14,7 +14,6 @@ is_a(window.document.documentElement, Element);
|
|||
is_a(window.document.documentElement, HTMLElement);
|
||||
is_a(window.document.documentElement, HTMLHtmlElement);
|
||||
is_a(window.document, Document);
|
||||
is_a(window.document, HTMLDocument);
|
||||
is(window.document.documentElement.tagName, "HTML");
|
||||
is_a(window.document.getElementsByTagName('foo-á')[0], HTMLUnknownElement);
|
||||
is(window.document.getElementsByTagName('foo-á')[0].tagName, "FOO-á");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue