servo: Merge #13060 - webgl: Do validation of glScissor/glViewport(width, height) on the DOM side (from anholt:webgl-invalid-passed-params); r=emilio

<!-- 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.

Source-Repo: https://github.com/servo/servo
Source-Revision: 11e8e42fd855c1078364c70926dfb1c888bdb7bb
This commit is contained in:
Eric Anholt 2016-08-28 20:10:47 -05:00
Родитель 95ae94306a
Коммит 4c169f0d81
1 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -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()