Revert "Bug 1950748 part 3: Don't return a caret inside an editor when no editor is focused. r=morgan" as requested for causing accessibility crashes (bug 1977012).
This reverts commit aaf970807d281c28c1e937491719d996cb11648a.
This reverts commit f5f2e3cf4d34c2430372ba790d77620837d56b75.
This reverts commit 5565c5899c32c0b0f5446561a21c5b6499fd44c6.
<!--Copyright (c) 2019 The Khronos Group Inc.Use of this source code is governed by an MIT-style license that can befound in the LICENSE.txt file.--><!DOCTYPE html><html><head><metacharset="utf-8"><title>WebGL Uniform Buffers Conformance Tests</title><linkrel="stylesheet"href="../../resources/js-test-style.css"/><scriptsrc="../../js/js-test-pre.js"></script><scriptsrc="../../js/webgl-test-utils.js"></script></head><body><divid="description"></div><canvasid="canvas"style="width: 50px; height: 50px;"></canvas><divid="console"></div><scriptid="vshader"type="x-shader/x-vertex">#version300esinvec4position;voidmain(){gl_Position=position;}</script><scriptid="fshader"type="x-shader/x-fragment">#version300esprecisionmediumpfloat;uniformuni{vec4color;};outvec4fragColor;voidmain(){fragColor=color;}</script><script>"use strict";description("This test covers ANGLE bugs when using a large uniform blocks. ANGLE would confuse an internal clipped uniform buffer size and produce an assert or error. Also there were issues with readback of large UBOs. See http://crbug.com/660670.");debug("");varwtu=WebGLTestUtils;varcanvas=document.getElementById("canvas");vargl=wtu.create3DContext(canvas,null,2);varquadVB;if(!gl){testFailed("WebGL context does not exist");}else{testPassed("WebGL context exists");debug("");debug("Testing uniform block with large data store");runTest();debug("");debug("Testing readback on uniform block with large data store");runReadbackTest();}functiongetQuadVerts(depth){varquadVerts=newFloat32Array(3*6);quadVerts[0]=-1.0;quadVerts[1]=1.0;quadVerts[2]=depth;quadVerts[3]=-1.0;quadVerts[4]=-1.0;quadVerts[5]=depth;quadVerts[6]=1.0;quadVerts[7]=-1.0;quadVerts[8]=depth;quadVerts[9]=-1.0;quadVerts[10]=1.0;quadVerts[11]=depth;quadVerts[12]=1.0;quadVerts[13]=-1.0;quadVerts[14]=depth;quadVerts[15]=1.0;quadVerts[16]=1.0;quadVerts[17]=depth;returnquadVerts;}functiondrawQuad(depth){if(!quadVB){quadVB=gl.createBuffer()}varquadVerts=getQuadVerts(depth);gl.bindBuffer(gl.ARRAY_BUFFER,quadVB);gl.bufferData(gl.ARRAY_BUFFER,quadVerts,gl.STATIC_DRAW);gl.vertexAttribPointer(0,3,gl.FLOAT,gl.FALSE,0,0);gl.enableVertexAttribArray(0);gl.drawArrays(gl.TRIANGLES,0,6);}functionrunTest(){// Create the programvarprogram=wtu.setupProgram(gl,["vshader","fshader"],["position"]);if(!program){testFailed("Failed to set up the program");return;}// Init uniform buffer. To trigger the bug, it's necessary to use the// DYNAMIC_DRAW usage. This makes ANGLE attempt to map the buffer internally// with an incorrect copy size.varubo=gl.createBuffer();varbig_size=4096*64;vardata=newFloat32Array([0.5,0.75,0.25,1.0]);gl.bindBuffer(gl.UNIFORM_BUFFER,ubo);gl.bufferData(gl.UNIFORM_BUFFER,big_size,gl.DYNAMIC_DRAW);gl.bufferSubData(gl.UNIFORM_BUFFER,0,data);gl.bindBufferBase(gl.UNIFORM_BUFFER,0,ubo);varbuffer_index=gl.getUniformBlockIndex(program,"uni");if(buffer_index==-1){testFailed("Failed to get uniform block index");return;}gl.uniformBlockBinding(program,buffer_index,0);wtu.glErrorShouldBe(gl,gl.NO_ERROR,"Setting up uniform block should succeed");// Draw the quadgl.useProgram(program);drawQuad(0.5);wtu.glErrorShouldBe(gl,gl.NO_ERROR,"Draw with uniform block should succeed");// Verify the output colorvarcolor=[127,191,64,255];wtu.checkCanvas(gl,color,"canvas should be same as input uniform",1);}functionrunReadbackTest(){// Create the programvarprogram=wtu.setupProgram(gl,["vshader","fshader"],["position"]);if(!program){testFailed("Failed to set up the program");return;}// Init uniform buffer. To trigger the bug, it's necessary to use the// DYNAMIC_DRAW usage. This makes ANGLE attempt to map the buffer internally// with an incorrect copy size.varubo=gl.createBuffer();varnum_floats=4096*16;varexpected_data=newFloat32Array(num_floats);for(varindex=0;index<num_floats;++index){expected_data[index]=index;}expected_data[0]=0.5;expected_data[1]=0.75;expected_data[2]=0.25;expected_data[3]=1.0;gl.bindBuffer(gl.UNIFORM_BUFFER,ubo);gl.bufferData(gl.UNIFORM_BUFFER,expected_data,gl.DYNAMIC_DRAW);gl.bufferSubData(gl.UNIFORM_BUFFER,0,expected_data);gl.bindBufferBase(gl.UNIFORM_BUFFER,0,ubo);varbuffer_index=gl.getUniformBlockIndex(program,"uni");if(buffer_index==-1){testFailed("Failed to get uniform block index");return;}gl.uniformBlockBinding(program,buffer_index,0);wtu.glErrorShouldBe(gl,gl.NO_ERROR,"Setting up uniform block should succeed");// Draw the quadgl.useProgram(program);drawQuad(0.5);wtu.glErrorShouldBe(gl,gl.NO_ERROR,"Draw with uniform block should succeed");// Verify the output colorvarcolor=[127,191,64,255];wtu.checkCanvas(gl,color,"canvas should be same as input uniform",1);// Verify readbackvaractual_data=newFloat32Array(num_floats);gl.getBufferSubData(gl.UNIFORM_BUFFER,0,actual_data);wtu.glErrorShouldBe(gl,gl.NO_ERROR,"Readback from uniform block should succeed");for(varindex=0;index<num_floats;++index){if(actual_data[index]!=expected_data[index]){testFailed("Expected and actual buffer data do not match");return;}}}debug("");varsuccessfullyParsed=true;</script><scriptsrc="../../js/js-test-post.js"></script></body></html>