diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2016-10-01 21:23:41 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2016-10-06 21:35:41 +0200 |
commit | 22252605af6aa41543fb3c841355f9223f30e5b3 (patch) | |
tree | 35160b0072e227fac1cd9839a1aa6e351babcc5d /components/script/dom/webglrenderingcontext.rs | |
parent | 20bacbf42e73bef560c32372a983097b8073cb22 (diff) | |
download | servo-22252605af6aa41543fb3c841355f9223f30e5b3.tar.gz servo-22252605af6aa41543fb3c841355f9223f30e5b3.zip |
Make WebGLRenderingContext::new take a &GlobalScope
Diffstat (limited to 'components/script/dom/webglrenderingcontext.rs')
-rw-r--r-- | components/script/dom/webglrenderingcontext.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 5b1f20a6218..0f9e6072a30 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -10,12 +10,12 @@ use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderi use dom::bindings::codegen::UnionTypes::ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement; use dom::bindings::conversions::{ToJSValConvertible, array_buffer_view_data, array_buffer_view_data_checked}; use dom::bindings::conversions::{array_buffer_view_to_vec, array_buffer_view_to_vec_checked}; -use dom::bindings::global::GlobalRef; use dom::bindings::inheritance::Castable; use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root}; use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::str::DOMString; use dom::event::{Event, EventBubbles, EventCancelable}; +use dom::globalscope::GlobalScope; use dom::htmlcanvaselement::HTMLCanvasElement; use dom::htmlcanvaselement::utils as canvas_utils; use dom::node::{Node, NodeDamage, window_from_node}; @@ -127,13 +127,13 @@ pub struct WebGLRenderingContext { } impl WebGLRenderingContext { - fn new_inherited(global: GlobalRef, + fn new_inherited(global: &GlobalScope, canvas: &HTMLCanvasElement, size: Size2D<i32>, attrs: GLContextAttributes) -> Result<WebGLRenderingContext, String> { let (sender, receiver) = ipc::channel().unwrap(); - let constellation_chan = global.as_global_scope().constellation_chan(); + let constellation_chan = global.constellation_chan(); constellation_chan.send(ConstellationMsg::CreateWebGLPaintThread(size, attrs, sender)) .unwrap(); let result = receiver.recv().unwrap(); @@ -159,14 +159,13 @@ impl WebGLRenderingContext { } #[allow(unrooted_must_root)] - pub fn new(global: GlobalRef, canvas: &HTMLCanvasElement, size: Size2D<i32>, attrs: GLContextAttributes) + pub fn new(global: &GlobalScope, canvas: &HTMLCanvasElement, size: Size2D<i32>, attrs: GLContextAttributes) -> Option<Root<WebGLRenderingContext>> { match WebGLRenderingContext::new_inherited(global, canvas, size, attrs) { - Ok(ctx) => Some(reflect_dom_object(box ctx, global.as_global_scope(), - WebGLRenderingContextBinding::Wrap)), + Ok(ctx) => Some(reflect_dom_object(box ctx, global, WebGLRenderingContextBinding::Wrap)), Err(msg) => { error!("Couldn't create WebGLRenderingContext: {}", msg); - let event = WebGLContextEvent::new(global.as_global_scope(), + let event = WebGLContextEvent::new(global, atom!("webglcontextcreationerror"), EventBubbles::DoesNotBubble, EventCancelable::Cancelable, |