diff options
Diffstat (limited to 'src/components/script/dom/document.rs')
-rw-r--r-- | src/components/script/dom/document.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/components/script/dom/document.rs b/src/components/script/dom/document.rs index 7bb394d3755..bee7494ed73 100644 --- a/src/components/script/dom/document.rs +++ b/src/components/script/dom/document.rs @@ -2,18 +2,19 @@ * 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::Bindings::DocumentBinding; use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; use dom::bindings::codegen::InheritTypes::{DocumentDerived, EventCast, HTMLElementCast}; use dom::bindings::codegen::InheritTypes::{HTMLHeadElementCast, TextCast, ElementCast}; use dom::bindings::codegen::InheritTypes::{DocumentTypeCast, HTMLHtmlElementCast, NodeCast}; use dom::bindings::codegen::InheritTypes::EventTargetCast; -use dom::bindings::codegen::Bindings::DocumentBinding; +use dom::bindings::error::{ErrorResult, Fallible, NotSupported, InvalidCharacter}; +use dom::bindings::error::{HierarchyRequest, NamespaceError}; +use dom::bindings::global::{GlobalRef, Window}; use dom::bindings::js::{JS, JSRef, Temporary, OptionalSettable, TemporaryPushable}; use dom::bindings::js::OptionalRootable; use dom::bindings::trace::{Traceable, Untraceable}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; -use dom::bindings::error::{ErrorResult, Fallible, NotSupported, InvalidCharacter}; -use dom::bindings::error::{HierarchyRequest, NamespaceError}; use dom::bindings::utils::{xml_name_type, InvalidXMLName, Name, QName}; use dom::comment::Comment; use dom::customevent::CustomEvent; @@ -222,13 +223,13 @@ impl Document { } // http://dom.spec.whatwg.org/#dom-document - pub fn Constructor(owner: &JSRef<Window>) -> Fallible<Temporary<Document>> { - Ok(Document::new(owner, None, NonHTMLDocument, None)) + pub fn Constructor(global: &GlobalRef) -> Fallible<Temporary<Document>> { + Ok(Document::new(global.as_window(), None, NonHTMLDocument, None)) } pub fn new(window: &JSRef<Window>, url: Option<Url>, doctype: IsHTMLDocument, content_type: Option<DOMString>) -> Temporary<Document> { let document = Document::new_inherited(window, url, doctype, content_type); - let document = reflect_dom_object(box document, window, + let document = reflect_dom_object(box document, &Window(*window), DocumentBinding::Wrap).root(); let node: &JSRef<Node> = NodeCast::from_ref(&*document); @@ -540,8 +541,8 @@ impl<'a> DocumentMethods for JSRef<'a, Document> { // FIXME: Implement CustomEvent (http://dom.spec.whatwg.org/#customevent) "uievents" | "uievent" => Ok(EventCast::from_temporary(UIEvent::new_uninitialized(&*window))), "mouseevents" | "mouseevent" => Ok(EventCast::from_temporary(MouseEvent::new_uninitialized(&*window))), - "customevent" => Ok(EventCast::from_temporary(CustomEvent::new_uninitialized(&*window))), - "htmlevents" | "events" | "event" => Ok(Event::new_uninitialized(&*window)), + "customevent" => Ok(EventCast::from_temporary(CustomEvent::new_uninitialized(&Window(*window)))), + "htmlevents" | "events" | "event" => Ok(Event::new_uninitialized(&Window(*window))), _ => Err(NotSupported) } } |