diff options
Diffstat (limited to 'components/script/dom/xrwebglbinding.rs')
-rw-r--r-- | components/script/dom/xrwebglbinding.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/components/script/dom/xrwebglbinding.rs b/components/script/dom/xrwebglbinding.rs index 27435aa3ddc..4f5efaa3cf7 100644 --- a/components/script/dom/xrwebglbinding.rs +++ b/components/script/dom/xrwebglbinding.rs @@ -16,6 +16,7 @@ use crate::dom::xrlayer::XRLayer; use crate::dom::xrsession::XRSession; use crate::dom::xrview::XRView; use crate::dom::xrwebglsubimage::XRWebGLSubImage; +use canvas_traits::webgl::WebGLContextId; use dom_struct::dom_struct; #[dom_struct] @@ -53,6 +54,19 @@ impl WebGLRenderingContextOrWebGL2RenderingContext { } } +impl RootedWebGLRenderingContextOrWebGL2RenderingContext { + pub(crate) fn context_id(&self) -> WebGLContextId { + match self { + RootedWebGLRenderingContextOrWebGL2RenderingContext::WebGLRenderingContext( + ref context, + ) => context.context_id(), + RootedWebGLRenderingContextOrWebGL2RenderingContext::WebGL2RenderingContext( + ref context, + ) => context.base_context().context_id(), + } + } +} + impl XRWebGLBindingMethods for XRWebGLBinding { /// https://immersive-web.github.io/layers/#dom-xrwebglbinding-getsubimage fn GetSubImage(&self, _layer: &XRLayer, _frame: &XRFrame) -> Option<DomRoot<XRWebGLSubImage>> { |