Bug 632781 - Scroll non-accelerated canvases correctly with the content; r=matt,joe,roc a=blocking-betaN

This commit is contained in:
Ehsan Akhgari 2011-02-14 18:23:50 -05:00
Родитель a7d6365a7a
Коммит 0b0c2afb5f
5 изменённых файлов: 71 добавлений и 2 удалений

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

@ -226,9 +226,10 @@ CanvasLayerOGL::RenderLayer(int aPreviousDestination,
mLayerProgram =
gl()->UploadSurfaceToTexture(mCanvasSurface,
drawRect,
nsIntRect(0, 0, drawRect.width, drawRect.height),
mTexture,
true);
true,
drawRect.TopLeft());
}
if (!program) {
program = mOGLManager->GetColorTextureLayerProgram(mLayerProgram);

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

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<body>
<!--
This test makes sure that scrolling a normal sized canvas would correctly
scroll its contents. Normal sized canvases are accelerated, so this test
makes sure that the accelerated code path for this operaton works correctly.
The padding in this test is added mostly to make sure that scrollLeft/Top
correctly skip the padding.
-->
<div id="container" style="width: 100px; height: 100px; padding: 10px; overflow: hidden">
<canvas width="300" height="300" id="c"></canvas>
</div>
<script>
var ctx = document.getElementById("c").getContext("2d");
ctx.fillStyle = "red";
ctx.fillRect(0, 0, 300, 100);
ctx.fillStyle = "green";
ctx.fillRect(0, 100, 300, 200);
var container = document.getElementById("container");
container.scrollLeft = 10;
container.scrollTop = 110;
</script>
</body>
</html>

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

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<body>
<div style="width: 120px; height: 120px; overflow: hidden">
<canvas width="120" height="120" id="c"></canvas>
</div>
<script>
var ctx = document.getElementById("c").getContext("2d");
ctx.fillStyle = "green";
ctx.fillRect(0, 0, 120, 120);
</script>
</body>
</html>

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

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<body>
<!--
This test makes sure that scrolling a huge canvas would correctly scroll
its contents. We don't accelerate extremely large canvases because of
GPU maximum texture size limits, so this test makes sure that the
non-accelerated code path for this operation works correctly.
The padding in this test is added mostly to make sure that scrollLeft/Top
correctly skip the padding.
-->
<div id="container" style="width: 100px; height: 100px; padding: 10px; overflow: hidden">
<canvas width="10000" height="10000" id="c"></canvas>
</div>
<script>
var ctx = document.getElementById("c").getContext("2d");
ctx.fillStyle = "red";
ctx.fillRect(0, 0, 10000, 5000);
ctx.fillStyle = "green";
ctx.fillRect(0, 5000, 10000, 5000);
var container = document.getElementById("container");
container.scrollLeft = 10;
container.scrollTop = 5010;
</script>
</body>
</html>

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

@ -1611,3 +1611,5 @@ random-if(winWidget) HTTP(..) == 621918-2.svg 621918-2-ref.svg # same 1px issue
== 625409-1.html 625409-1-ref.html
== 627393-1.html about:blank
== 631352-1.html 631352-1-ref.html
== 632781-verybig.html 632781-ref.html
== 632781-normalsize.html 632781-ref.html