aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webglobject.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2018-07-24 13:27:33 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2018-07-24 13:27:33 +0200
commit661e258b28fd7dcc92ab233f66bf49c061542865 (patch)
tree602fefb45a030dabfafc4d648cf7b214be657eac /components/script/dom/webglobject.rs
parent8933a06eb8cf0815927c7491dd572c5c776f6d14 (diff)
downloadservo-661e258b28fd7dcc92ab233f66bf49c061542865.tar.gz
servo-661e258b28fd7dcc92ab233f66bf49c061542865.zip
Store a reference to the WebGLRenderingContext in WebGLObject
Diffstat (limited to 'components/script/dom/webglobject.rs')
-rw-r--r--components/script/dom/webglobject.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/components/script/dom/webglobject.rs b/components/script/dom/webglobject.rs
index 123420b7cb0..7d4dbabc998 100644
--- a/components/script/dom/webglobject.rs
+++ b/components/script/dom/webglobject.rs
@@ -4,17 +4,25 @@
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use dom::bindings::reflector::Reflector;
+use dom::bindings::root::Dom;
+use dom::webglrenderingcontext::WebGLRenderingContext;
use dom_struct::dom_struct;
#[dom_struct]
pub struct WebGLObject {
reflector_: Reflector,
+ context: Dom<WebGLRenderingContext>,
}
impl WebGLObject {
- pub fn new_inherited() -> WebGLObject {
+ pub fn new_inherited(context: &WebGLRenderingContext) -> WebGLObject {
WebGLObject {
reflector_: Reflector::new(),
+ context: Dom::from_ref(context),
}
}
+
+ pub fn context(&self) -> &WebGLRenderingContext {
+ &self.context
+ }
}