mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Cleanups for future script crate split (#35987)
* script: Avoid direct impl blocks on generated dicts and unions. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Remove references to codegen-specific import module. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix tidy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
3ecd1c0699
commit
d35da38a2f
43 changed files with 211 additions and 146 deletions
|
@ -29,7 +29,9 @@ use style::attr::AttrValue;
|
|||
|
||||
use crate::canvas_context::CanvasContext as _;
|
||||
pub(crate) use crate::canvas_context::*;
|
||||
use crate::conversions::Convert;
|
||||
use crate::dom::attr::Attr;
|
||||
use crate::dom::bindings::callback::ExceptionHandling;
|
||||
use crate::dom::bindings::cell::{DomRefCell, Ref, ref_filter_map};
|
||||
use crate::dom::bindings::codegen::Bindings::HTMLCanvasElementBinding::{
|
||||
BlobCallback, HTMLCanvasElementMethods, RenderingContext,
|
||||
|
@ -39,7 +41,6 @@ use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGL
|
|||
use crate::dom::bindings::codegen::UnionTypes::HTMLCanvasElementOrOffscreenCanvas;
|
||||
use crate::dom::bindings::conversions::ConversionResult;
|
||||
use crate::dom::bindings::error::{Error, Fallible};
|
||||
use crate::dom::bindings::import::module::ExceptionHandling;
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::bindings::num::Finite;
|
||||
use crate::dom::bindings::refcounted::Trusted;
|
||||
|
@ -342,9 +343,9 @@ impl HTMLCanvasElement {
|
|||
fn get_gl_attributes(cx: JSContext, options: HandleValue) -> Option<GLContextAttributes> {
|
||||
unsafe {
|
||||
match WebGLContextAttributes::new(cx, options) {
|
||||
Ok(ConversionResult::Success(ref attrs)) => Some(From::from(attrs)),
|
||||
Ok(ConversionResult::Failure(ref error)) => {
|
||||
throw_type_error(*cx, error);
|
||||
Ok(ConversionResult::Success(attrs)) => Some(attrs.convert()),
|
||||
Ok(ConversionResult::Failure(error)) => {
|
||||
throw_type_error(*cx, &error);
|
||||
None
|
||||
},
|
||||
_ => {
|
||||
|
@ -702,15 +703,15 @@ impl VirtualMethods for HTMLCanvasElement {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a WebGLContextAttributes> for GLContextAttributes {
|
||||
fn from(attrs: &'a WebGLContextAttributes) -> GLContextAttributes {
|
||||
impl Convert<GLContextAttributes> for WebGLContextAttributes {
|
||||
fn convert(self) -> GLContextAttributes {
|
||||
GLContextAttributes {
|
||||
alpha: attrs.alpha,
|
||||
depth: attrs.depth,
|
||||
stencil: attrs.stencil,
|
||||
antialias: attrs.antialias,
|
||||
premultiplied_alpha: attrs.premultipliedAlpha,
|
||||
preserve_drawing_buffer: attrs.preserveDrawingBuffer,
|
||||
alpha: self.alpha,
|
||||
depth: self.depth,
|
||||
stencil: self.stencil,
|
||||
antialias: self.antialias,
|
||||
premultiplied_alpha: self.premultipliedAlpha,
|
||||
preserve_drawing_buffer: self.preserveDrawingBuffer,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue