mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Convert CGTraitInterface to use safe JSContext instead of raw JSContext
This commit is contained in:
parent
808fa65aef
commit
2c5d0a6ebc
43 changed files with 443 additions and 528 deletions
|
@ -330,9 +330,9 @@ impl HTMLCanvasElementMethods for HTMLCanvasElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-canvas-getcontext
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn GetContext(
|
||||
fn GetContext(
|
||||
&self,
|
||||
cx: *mut JSContext,
|
||||
cx: SafeJSContext,
|
||||
id: DOMString,
|
||||
options: HandleValue,
|
||||
) -> Option<RenderingContext> {
|
||||
|
@ -340,21 +340,22 @@ impl HTMLCanvasElementMethods for HTMLCanvasElement {
|
|||
"2d" => self
|
||||
.get_or_init_2d_context()
|
||||
.map(RenderingContext::CanvasRenderingContext2D),
|
||||
"webgl" | "experimental-webgl" => self
|
||||
.get_or_init_webgl_context(cx, options)
|
||||
.map(RenderingContext::WebGLRenderingContext),
|
||||
"webgl2" | "experimental-webgl2" => self
|
||||
.get_or_init_webgl2_context(cx, options)
|
||||
.map(RenderingContext::WebGL2RenderingContext),
|
||||
"webgl" | "experimental-webgl" => unsafe {
|
||||
self.get_or_init_webgl_context(*cx, options)
|
||||
.map(RenderingContext::WebGLRenderingContext)
|
||||
},
|
||||
"webgl2" | "experimental-webgl2" => unsafe {
|
||||
self.get_or_init_webgl2_context(*cx, options)
|
||||
.map(RenderingContext::WebGL2RenderingContext)
|
||||
},
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-canvas-todataurl
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn ToDataURL(
|
||||
fn ToDataURL(
|
||||
&self,
|
||||
_context: *mut JSContext,
|
||||
_context: SafeJSContext,
|
||||
_mime_type: Option<DOMString>,
|
||||
_quality: HandleValue,
|
||||
) -> Fallible<USVString> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue