diff options
author | Ms2ger <ms2ger@gmail.com> | 2013-11-02 23:36:49 +0100 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2013-11-05 20:45:50 +0100 |
commit | 8a7448bc67da0714eb6328b8fc49686b24627984 (patch) | |
tree | 02bd95b01abaed150720ecc599595329c2f454c7 /src/components/script/dom/htmldocument.rs | |
parent | c2a99933c949e4a6b1cfb4370f56d1958b16a334 (diff) | |
download | servo-8a7448bc67da0714eb6328b8fc49686b24627984.tar.gz servo-8a7448bc67da0714eb6328b8fc49686b24627984.zip |
Rewrite Document creation and reflection.
Diffstat (limited to 'src/components/script/dom/htmldocument.rs')
-rw-r--r-- | src/components/script/dom/htmldocument.rs | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/components/script/dom/htmldocument.rs b/src/components/script/dom/htmldocument.rs index 1e9c4e11706..1fcd6ae3718 100644 --- a/src/components/script/dom/htmldocument.rs +++ b/src/components/script/dom/htmldocument.rs @@ -4,7 +4,7 @@ use dom::bindings::codegen::HTMLDocumentBinding; use dom::bindings::utils::{Reflectable, Reflector, Traceable}; -use dom::document::{AbstractDocument, Document, ReflectableDocument, HTML}; +use dom::document::{AbstractDocument, Document, HTML}; use dom::element::HTMLHeadElementTypeId; use dom::htmlcollection::HTMLCollection; use dom::node::{AbstractNode, ScriptView, ElementNodeTypeId}; @@ -14,7 +14,6 @@ use js::jsapi::{JSObject, JSContext, JSTracer}; use servo_util::tree::{TreeNodeRef, ElementLike}; -use std::ptr; use std::str::eq_slice; pub struct HTMLDocument { @@ -22,22 +21,15 @@ pub struct HTMLDocument { } impl HTMLDocument { - pub fn new(window: @mut Window) -> AbstractDocument { - let doc = @mut HTMLDocument { - parent: Document::new(window, HTML) - }; - - AbstractDocument::as_abstract(window.get_cx(), doc) - } -} - -impl ReflectableDocument for HTMLDocument { - fn init_reflector(@mut self, cx: *JSContext) { - self.wrap_object_shared(cx, ptr::null()); //XXXjdm a proper scope would be nice + pub fn new_inherited(window: @mut Window) -> HTMLDocument { + HTMLDocument { + parent: Document::new_inherited(window, HTML) + } } - fn init_node(@mut self, doc: AbstractDocument) { - self.parent.node.set_owner_doc(doc); + pub fn new(window: @mut Window) -> AbstractDocument { + let document = HTMLDocument::new_inherited(window); + Document::reflect_document(@mut document, window, HTMLDocumentBinding::Wrap) } } @@ -97,8 +89,8 @@ impl Reflectable for HTMLDocument { self.parent.mut_reflector() } - fn wrap_object_shared(@mut self, cx: *JSContext, scope: *JSObject) -> *JSObject { - HTMLDocumentBinding::Wrap(cx, scope, self) + fn wrap_object_shared(@mut self, _cx: *JSContext, _scope: *JSObject) -> *JSObject { + unreachable!() } fn GetParentObject(&self, cx: *JSContext) -> Option<@mut Reflectable> { |