diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs index 95cd5758586..b8a4bc5582b 100644 --- a/components/canvas/webgl_thread.rs +++ b/components/canvas/webgl_thread.rs @@ -1046,7 +1046,7 @@ impl WebGLImpl { gl.clear_color(r, g, b, a); }, WebGLCommand::ClearDepth(depth) => { - let value = depth.max(0.).min(1.) as f64; + let value = depth.clamp(0., 1.) as f64; state.depth_clear_value = value; gl.clear_depth(value) }, @@ -1085,7 +1085,7 @@ impl WebGLImpl { state.restore_depth_invariant(gl); }, WebGLCommand::DepthRange(near, far) => { - gl.depth_range(near.max(0.).min(1.) as f64, far.max(0.).min(1.) as f64) + gl.depth_range(near.clamp(0., 1.) as f64, far.clamp(0., 1.) as f64) }, WebGLCommand::Disable(cap) => match cap { gl::SCISSOR_TEST => {