Skip to content

Commit

Permalink
Bug 632781 - Scroll non-accelerated canvases correctly with the conte…
Browse files Browse the repository at this point in the history
…nt; r=matt,joe,roc a=blocking-betaN
  • Loading branch information
ehsan committed Feb 14, 2011
1 parent f18e1ad commit c6d9c95
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gfx/layers/opengl/CanvasLayerOGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
26 changes: 26 additions & 0 deletions layout/reftests/bugs/632781-normalsize.html
Original file line number Diff line number Diff line change
@@ -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>
13 changes: 13 additions & 0 deletions layout/reftests/bugs/632781-ref.html
Original file line number Diff line number Diff line change
@@ -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>
27 changes: 27 additions & 0 deletions layout/reftests/bugs/632781-verybig.html
Original file line number Diff line number Diff line change
@@ -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>
2 changes: 2 additions & 0 deletions layout/reftests/bugs/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -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
fails-if(winWidget&&layersGPUAccelerated) == 632781-verybig.html 632781-ref.html # large canvas elements are not drawn on Windows, see bug 633936
== 632781-normalsize.html 632781-ref.html

0 comments on commit c6d9c95

Please sign in to comment.