diff options
Diffstat (limited to 'components/script/dom/webglrenderingcontext.rs')
-rw-r--r-- | components/script/dom/webglrenderingcontext.rs | 87 |
1 files changed, 46 insertions, 41 deletions
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 8127f8c5f3a..dc71cf3912a 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -2,18 +2,54 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ +use std::cell::Cell; +use std::cmp; +use std::ptr::{self, NonNull}; +use std::rc::Rc; + +#[cfg(feature = "webgl_backtrace")] +use backtrace::Backtrace; +use bitflags::bitflags; +use canvas_traits::webgl::WebGLError::*; +use canvas_traits::webgl::{ + 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 euclid::default::{Point2D, Rect, Size2D}; +use ipc_channel::ipc::{self, IpcSharedMemory}; +use js::jsapi::{JSContext, JSObject, Type}; +use js::jsval::{ + BooleanValue, DoubleValue, Int32Value, JSVal, NullValue, ObjectValue, UInt32Value, + UndefinedValue, +}; +use js::rust::CustomAutoRooterGuard; +use js::typedarray::{ + ArrayBufferView, CreateWith, Float32, Float32Array, Int32, Int32Array, TypedArray, + TypedArrayElementCreator, Uint32Array, +}; +use net_traits::image_cache::ImageResponse; +use pixels::{self, PixelFormat}; +use script_layout_interface::HTMLCanvasDataSource; +use serde::{Deserialize, Serialize}; +use servo_config::pref; +use webrender_api::ImageKey; + use crate::dom::bindings::cell::{DomRefCell, Ref, RefMut}; use crate::dom::bindings::codegen::Bindings::ANGLEInstancedArraysBinding::ANGLEInstancedArraysConstants; use crate::dom::bindings::codegen::Bindings::EXTBlendMinmaxBinding::EXTBlendMinmaxConstants; use crate::dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::OESVertexArrayObjectConstants; use crate::dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants; -use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::TexImageSource; -use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLContextAttributes; -use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; -use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods; -use crate::dom::bindings::codegen::UnionTypes::ArrayBufferViewOrArrayBuffer; -use crate::dom::bindings::codegen::UnionTypes::Float32ArrayOrUnrestrictedFloatSequence; -use crate::dom::bindings::codegen::UnionTypes::Int32ArrayOrLongSequence; +use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::{ + TexImageSource, WebGLContextAttributes, WebGLRenderingContextConstants as constants, + WebGLRenderingContextMethods, +}; +use crate::dom::bindings::codegen::UnionTypes::{ + ArrayBufferViewOrArrayBuffer, Float32ArrayOrUnrestrictedFloatSequence, Int32ArrayOrLongSequence, +}; use crate::dom::bindings::conversions::{DerivedFrom, ToJSValConvertible}; use crate::dom::bindings::error::{Error, ErrorResult, Fallible}; use crate::dom::bindings::inheritance::Castable; @@ -22,8 +58,9 @@ use crate::dom::bindings::root::{Dom, DomOnceCell, DomRoot, LayoutDom, MutNullab use crate::dom::bindings::str::DOMString; 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::htmlcanvaselement::{ + utils as canvas_utils, HTMLCanvasElement, LayoutCanvasRenderingContextHelpers, +}; use crate::dom::node::{document_from_node, window_from_node, Node, NodeDamage}; use crate::dom::promise::Promise; use crate::dom::vertexarrayobject::VertexAttribData; @@ -52,38 +89,6 @@ use crate::dom::webglvertexarrayobject::WebGLVertexArrayObject; use crate::dom::webglvertexarrayobjectoes::WebGLVertexArrayObjectOES; use crate::dom::window::Window; use crate::script_runtime::JSContext as SafeJSContext; -#[cfg(feature = "webgl_backtrace")] -use backtrace::Backtrace; -use bitflags::bitflags; -use canvas_traits::webgl::WebGLError::*; -use canvas_traits::webgl::{ - 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 euclid::default::{Point2D, Rect, Size2D}; -use ipc_channel::ipc::{self, IpcSharedMemory}; -use js::jsapi::{JSContext, JSObject, Type}; -use js::jsval::{BooleanValue, DoubleValue, Int32Value, JSVal, UInt32Value}; -use js::jsval::{NullValue, ObjectValue, UndefinedValue}; -use js::rust::CustomAutoRooterGuard; -use js::typedarray::{ - ArrayBufferView, CreateWith, Float32, Float32Array, Int32, Int32Array, Uint32Array, -}; -use js::typedarray::{TypedArray, TypedArrayElementCreator}; -use net_traits::image_cache::ImageResponse; -use pixels::{self, PixelFormat}; -use script_layout_interface::HTMLCanvasDataSource; -use serde::{Deserialize, Serialize}; -use servo_config::pref; -use std::cell::Cell; -use std::cmp; -use std::ptr::{self, NonNull}; -use std::rc::Rc; -use webrender_api::ImageKey; // From the GLES 2.0.25 spec, page 85: // |