diff options
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/webglrenderingcontext.rs | 73 | ||||
-rw-r--r-- | components/script/dom/webgltexture.rs | 15 | ||||
-rw-r--r-- | components/script/dom/webidls/WebGLRenderingContext.webidl | 7 |
3 files changed, 6 insertions, 89 deletions
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index de5d01909a9..2a9c3584a89 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -24,7 +24,6 @@ use crate::dom::element::cors_setting_for_element; use crate::dom::event::{Event, EventBubbles, EventCancelable}; use crate::dom::htmlcanvaselement::utils as canvas_utils; use crate::dom::htmlcanvaselement::{HTMLCanvasElement, LayoutCanvasRenderingContextHelpers}; -use crate::dom::htmliframeelement::HTMLIFrameElement; use crate::dom::node::{document_from_node, window_from_node, Node, NodeDamage}; use crate::dom::promise::Promise; use crate::dom::vertexarrayobject::VertexAttribData; @@ -57,11 +56,11 @@ use crate::script_runtime::JSContext as SafeJSContext; use backtrace::Backtrace; use canvas_traits::webgl::WebGLError::*; use canvas_traits::webgl::{ - webgl_channel, AlphaTreatment, DOMToTextureCommand, GLContextAttributes, GLLimits, GlType, - Parameter, SizedDataType, TexDataType, TexFormat, TexParameter, WebGLChan, WebGLCommand, - WebGLCommandBacktrace, WebGLContextId, WebGLError, WebGLFramebufferBindingRequest, WebGLMsg, - WebGLMsgSender, WebGLProgramId, WebGLResult, WebGLSLVersion, WebGLSendResult, WebGLSender, - WebGLVersion, YAxisTreatment, + webgl_channel, AlphaTreatment, GLContextAttributes, GLLimits, GlType, Parameter, SizedDataType, + TexDataType, TexFormat, TexParameter, WebGLChan, WebGLCommand, WebGLCommandBacktrace, + WebGLContextId, WebGLError, WebGLFramebufferBindingRequest, WebGLMsg, WebGLMsgSender, + WebGLProgramId, WebGLResult, WebGLSLVersion, WebGLSendResult, WebGLSender, WebGLVersion, + YAxisTreatment, }; use dom_struct::dom_struct; use embedder_traits::EventLoopWaker; @@ -379,10 +378,6 @@ impl WebGLRenderingContext { } } - pub(crate) fn webgl_sender(&self) -> WebGLMessageSender { - self.webgl_sender.clone() - } - pub fn context_id(&self) -> WebGLContextId { self.webgl_sender.context_id() } @@ -4435,60 +4430,6 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8 - fn TexImageDOM( - &self, - target: u32, - level: i32, - internal_format: u32, - width: i32, - height: i32, - format: u32, - data_type: u32, - source: &HTMLIFrameElement, - ) -> ErrorResult { - // Currently DOMToTexture only supports TEXTURE_2D, RGBA, UNSIGNED_BYTE and no levels. - if target != constants::TEXTURE_2D || - level != 0 || - internal_format != constants::RGBA || - format != constants::RGBA || - data_type != constants::UNSIGNED_BYTE - { - return Ok(self.webgl_error(InvalidValue)); - } - - // Get bound texture - let texture = handle_potential_webgl_error!( - self, - self.textures - .active_texture_slot(constants::TEXTURE_2D, self.webgl_version()) - .unwrap() - .get() - .ok_or(InvalidOperation), - return Ok(()) - ); - - let pipeline_id = source.pipeline_id().ok_or(Error::InvalidState)?; - let document_id = self - .global() - .downcast::<Window>() - .ok_or(Error::InvalidState)? - .webrender_document(); - - texture.set_attached_to_dom(); - - let command = DOMToTextureCommand::Attach( - self.webgl_sender.context_id(), - texture.id(), - document_id, - pipeline_id.to_webrender(), - Size2D::new(width, height), - ); - self.webgl_sender.send_dom_to_texture(command).unwrap(); - - Ok(()) - } - - // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8 #[allow(unsafe_code)] fn TexSubImage2D( &self, @@ -5013,10 +4954,6 @@ impl WebGLMessageSender { pub fn send_remove(&self) -> WebGLSendResult { self.wake_after_send(|| self.sender.send_remove()) } - - pub fn send_dom_to_texture(&self, command: DOMToTextureCommand) -> WebGLSendResult { - self.wake_after_send(|| self.sender.send_dom_to_texture(command)) - } } pub trait Size2DExt { diff --git a/components/script/dom/webgltexture.rs b/components/script/dom/webgltexture.rs index 7456f772dec..ccb005cc393 100644 --- a/components/script/dom/webgltexture.rs +++ b/components/script/dom/webgltexture.rs @@ -20,7 +20,7 @@ use canvas_traits::webgl::{ webgl_channel, TexDataType, TexFormat, TexParameter, TexParameterBool, TexParameterInt, WebGLResult, WebGLTextureId, }; -use canvas_traits::webgl::{DOMToTextureCommand, WebGLCommand, WebGLError}; +use canvas_traits::webgl::{WebGLCommand, WebGLError}; use dom_struct::dom_struct; use std::cell::Cell; use std::cmp; @@ -62,8 +62,6 @@ pub struct WebGLTexture { // Store information for min and mag filters min_filter: Cell<u32>, mag_filter: Cell<u32>, - /// True if this texture is used for the DOMToTexture feature. - attached_to_dom: Cell<bool>, /// Framebuffer that this texture is attached to. attached_framebuffer: MutNullableDom<WebGLFramebuffer>, /// Number of immutable levels. @@ -90,7 +88,6 @@ impl WebGLTexture { min_filter: Cell::new(constants::NEAREST_MIPMAP_LINEAR), mag_filter: Cell::new(constants::LINEAR), image_info_array: DomRefCell::new([None; MAX_LEVEL_COUNT * MAX_FACE_COUNT]), - attached_to_dom: Cell::new(false), attached_framebuffer: Default::default(), } } @@ -224,12 +221,6 @@ impl WebGLTexture { if !self.is_deleted.get() { self.is_deleted.set(true); let context = self.upcast::<WebGLObject>().context(); - // Notify WR to release the frame output when using DOMToTexture feature - if self.attached_to_dom.get() { - let _ = context - .webgl_sender() - .send_dom_to_texture(DOMToTextureCommand::Detach(self.id)); - } /* If a texture object is deleted while its image is attached to one or more attachment @@ -469,10 +460,6 @@ impl WebGLTexture { self.image_info_at_face(0, self.base_mipmap_level) } - pub fn set_attached_to_dom(&self) { - self.attached_to_dom.set(true); - } - pub fn attach_to_framebuffer(&self, fb: &WebGLFramebuffer) { self.attached_framebuffer.set(Some(fb)); } diff --git a/components/script/dom/webidls/WebGLRenderingContext.webidl b/components/script/dom/webidls/WebGLRenderingContext.webidl index f54dfd67507..fcd3f9752ae 100644 --- a/components/script/dom/webidls/WebGLRenderingContext.webidl +++ b/components/script/dom/webidls/WebGLRenderingContext.webidl @@ -680,16 +680,9 @@ interface mixin WebGLRenderingContextOverloads undefined uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value); }; -interface mixin WebGLRenderingContextExtensions { - [Throws, Pref="dom.webgl.dom_to_texture.enabled"] - undefined texImageDOM(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, - GLenum format, GLenum type, HTMLIFrameElement source); // May throw DOMException -}; - [Exposed=(Window)] interface WebGLRenderingContext { }; WebGLRenderingContext includes WebGLRenderingContextBase; WebGLRenderingContext includes WebGLRenderingContextOverloads; -WebGLRenderingContext includes WebGLRenderingContextExtensions; |