mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Auto merge of #13060 - anholt:webgl-invalid-passed-params, r=emilio
webgl: Do validation of glScissor/glViewport(width, height) on the DOM side <!-- Please describe your changes on the following line: --> webgl: Do validation of glScissor/glViewport(width, height) on the DOM side --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Avoids testcase CRASHes due to unexpected GL errors. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13060) <!-- Reviewable:end -->
This commit is contained in:
commit
11e8e42fd8
3 changed files with 131 additions and 8 deletions
|
@ -1526,6 +1526,10 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.4
|
||||
fn Scissor(&self, x: i32, y: i32, width: i32, height: i32) {
|
||||
if width < 0 || height < 0 {
|
||||
return self.webgl_error(InvalidValue)
|
||||
}
|
||||
|
||||
self.ipc_renderer
|
||||
.send(CanvasMsg::WebGL(WebGLCommand::Scissor(x, y, width, height)))
|
||||
.unwrap()
|
||||
|
@ -1938,6 +1942,10 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.4
|
||||
fn Viewport(&self, x: i32, y: i32, width: i32, height: i32) {
|
||||
if width < 0 || height < 0 {
|
||||
return self.webgl_error(InvalidValue)
|
||||
}
|
||||
|
||||
self.ipc_renderer
|
||||
.send(CanvasMsg::WebGL(WebGLCommand::Viewport(x, y, width, height)))
|
||||
.unwrap()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue