diff --git a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.cpp b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.cpp index da0d132571..aaf6ffe8cf 100644 --- a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.cpp +++ b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.cpp @@ -77,6 +77,11 @@ HTML::HTMLCanvasElement const& WebGLRenderingContextBase::canvas_element() const return ref_count_target(); } +NonnullRefPtr WebGLRenderingContextBase::canvas_for_binding() const +{ + return canvas_element(); +} + void WebGLRenderingContextBase::needs_to_present() { m_should_present = true; diff --git a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.h b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.h index 5a5914b7cc..927d7af669 100644 --- a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.h +++ b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.h @@ -23,6 +23,8 @@ public: void present(); + NonnullRefPtr canvas_for_binding() const; + bool is_context_lost() const; Optional> get_supported_extensions() const; diff --git a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.idl b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.idl index 7d49fac82f..4682342c5a 100644 --- a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.idl +++ b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.idl @@ -1,3 +1,4 @@ +#import #import dictionary WebGLContextAttributes { @@ -18,6 +19,9 @@ interface mixin WebGLRenderingContextBase { // IDL code generator. This also allows us to handle the return type ourselves instead of adding the complexity of the // code generator working out the return type and returning the appropriate value to return on context loss. + // FIXME: The type should be (HTMLCanvasElement or OffscreenCanvas). + [ImplementedAs=canvas_for_binding] readonly attribute HTMLCanvasElement canvas; + boolean isContextLost(); sequence? getSupportedExtensions();