From e2617a6396e6f9fd0aac43c418ad786957c475e6 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sat, 22 Feb 2014 14:11:31 +0100 Subject: [PATCH] Remove HTMLDocument. --- .../script/dom/bindings/codegen/Bindings.conf | 4 -- .../script/dom/domimplementation.rs | 5 +- src/components/script/dom/domparser.rs | 6 +-- src/components/script/dom/htmldocument.rs | 51 ------------------- .../script/dom/webidls/HTMLDocument.webidl | 8 --- src/components/script/script.rs | 1 - src/components/script/script_task.rs | 7 ++- .../html/content/test_documentElement.html | 1 - .../content/test_document_contenttype.html | 4 +- .../content/test_document_implementation.html | 1 - src/test/html/content/test_parentnodes.html | 2 +- src/test/html/content/test_prototypes.html | 1 - 12 files changed, 10 insertions(+), 81 deletions(-) delete mode 100644 src/components/script/dom/htmldocument.rs delete mode 100644 src/components/script/dom/webidls/HTMLDocument.webidl diff --git a/src/components/script/dom/bindings/codegen/Bindings.conf b/src/components/script/dom/bindings/codegen/Bindings.conf index cc4a5996865..8485377ed8b 100644 --- a/src/components/script/dom/bindings/codegen/Bindings.conf +++ b/src/components/script/dom/bindings/codegen/Bindings.conf @@ -224,10 +224,6 @@ DOMInterfaces = { { }], -'HTMLDocument': { - 'customTrace': 'trace' -}, - 'HTMLOptionsCollection': [ { 'nativeType': 'nsHTMLOptionCollection', diff --git a/src/components/script/dom/domimplementation.rs b/src/components/script/dom/domimplementation.rs index 48c26ff4871..329bcc74263 100644 --- a/src/components/script/dom/domimplementation.rs +++ b/src/components/script/dom/domimplementation.rs @@ -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) -> JS { // Step 1-2. - let doc: JS = 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 = NodeCast::from(&doc); diff --git a/src/components/script/dom/domparser.rs b/src/components/script/dom/domparser.rs index 3b545e0be62..031cd8b3b4a 100644 --- a/src/components/script/dom/domparser.rs +++ b/src/components/script/dom/domparser.rs @@ -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> { 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) diff --git a/src/components/script/dom/htmldocument.rs b/src/components/script/dom/htmldocument.rs deleted file mode 100644 index 64bed6c211c..00000000000 --- a/src/components/script/dom/htmldocument.rs +++ /dev/null @@ -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, url: Option) -> HTMLDocument { - HTMLDocument { - parent: Document::new_inherited(window, url, HTML, None) - } - } - - pub fn new(window: &JS, url: Option) -> JS { - 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() - } -} diff --git a/src/components/script/dom/webidls/HTMLDocument.webidl b/src/components/script/dom/webidls/HTMLDocument.webidl deleted file mode 100644 index 464d771df62..00000000000 --- a/src/components/script/dom/webidls/HTMLDocument.webidl +++ /dev/null @@ -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 {}; diff --git a/src/components/script/script.rs b/src/components/script/script.rs index d85df63ba08..8cfbc737255 100644 --- a/src/components/script/script.rs +++ b/src/components/script/script.rs @@ -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; diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs index d0c53384231..0f17d4afce0 100644 --- a/src/components/script/script_task.rs +++ b/src/components/script/script_task.rs @@ -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(), diff --git a/src/test/html/content/test_documentElement.html b/src/test/html/content/test_documentElement.html index eea379456b1..efe68e086d0 100644 --- a/src/test/html/content/test_documentElement.html +++ b/src/test/html/content/test_documentElement.html @@ -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(); diff --git a/src/test/html/content/test_document_contenttype.html b/src/test/html/content/test_document_contenttype.html index ede2696f98a..4a63a654547 100644 --- a/src/test/html/content/test_document_contenttype.html +++ b/src/test/html/content/test_document_contenttype.html @@ -5,14 +5,14 @@