Make WebIDL constructors take a more specific global if possible (fixes #14071)

This commit is contained in:
Rohan Prinja 2016-11-10 02:24:01 -05:00 committed by Anthony Ramine
parent 8af2327e95
commit 973f77c006
17 changed files with 50 additions and 49 deletions

View file

@ -16,11 +16,11 @@ use dom::bindings::str::DOMString;
use dom::document::Document;
use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers};
use dom::eventtarget::EventTarget;
use dom::globalscope::GlobalScope;
use dom::htmlelement::HTMLElement;
use dom::node::{Node, NodeDamage, document_from_node, window_from_node};
use dom::values::UNSIGNED_LONG_MAX;
use dom::virtualmethods::VirtualMethods;
use dom::window::Window;
use html5ever_atoms::LocalName;
use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
@ -220,10 +220,10 @@ impl HTMLImageElement {
HTMLImageElementBinding::Wrap)
}
pub fn Image(global: &GlobalScope,
pub fn Image(window: &Window,
width: Option<u32>,
height: Option<u32>) -> Fallible<Root<HTMLImageElement>> {
let document = global.as_window().Document();
let document = window.Document();
let image = HTMLImageElement::new(local_name!("img"), None, &document);
if let Some(w) = width {
image.SetWidth(w);