Bug 576453. Let the reftest window auto-size itself to fit the browser element. r=dbaron

This commit is contained in:
Robert O'Callahan 2010-07-16 09:07:44 +12:00
parent aecbd67be5
commit b2d82bd07e
5 changed files with 27 additions and 12 deletions

View File

@ -1,3 +1,7 @@
<body class="scrollTop" style="height:2000px; overflow:hidden">
<!DOCTYPE HTML>
<html>
<body style="height:2000px; overflow:hidden">
<script src="scrolling.js"></script>
<div style="height:300px; background:url(repeatable-diagonal-gradient.png) fixed;"></div>
</body>
</html>

View File

@ -1,7 +1,12 @@
<script src="scrolling.js"></script>
<div class="scrollTop" style="overflow:auto; width:200px; height:200px;">
<!DOCTYPE HTML>
<html>
<body>
<div class="scrollTop" style="overflow:hidden; width:200px; height:200px;">
<div style="margin:70px 20px; opacity:0.5; height:400px; background:yellow;">
<div style="position:absolute; background:yellow; width:50px; height:100px; top: 0; left:50px;">
</div>
</div>
</div>
<script src="scrolling.js"></script>
</body>
</html>

View File

@ -1,3 +1,7 @@
<body class="scrollTop" style="height:2000px; overflow:hidden">
<!DOCTYPE HTML>
<html>
<body style="height:2000px; overflow:hidden">
<script src="scrolling.js"></script>
<div style="height:300px; background:url(repeatable-diagonal-gradient.png);"></div>
</body>
</html>

View File

@ -140,8 +140,9 @@ function AllocateCanvas()
return gRecycledCanvases.shift();
var canvas = document.createElementNS(XHTML_NS, "canvas");
canvas.setAttribute("width", windowElem.getAttribute("width"));
canvas.setAttribute("height", windowElem.getAttribute("height"));
var r = gBrowser.getBoundingClientRect();
canvas.setAttribute("width", Math.ceil(r.width));
canvas.setAttribute("height", Math.ceil(r.height));
return canvas;
}
@ -944,14 +945,17 @@ function DoDrawWindow(ctx, win, x, y, w, h)
gDrawWindowFlags = ctx.DRAWWINDOW_DRAW_CARET |
ctx.DRAWWINDOW_DRAW_VIEW;
var flags = "DRAWWINDOW_DRAW_CARET | DRAWWINDOW_DRAW_VIEW";
if (window.innerWidth == gCurrentCanvas.width &&
window.innerHeight == gCurrentCanvas.height) {
var r = gBrowser.getBoundingClientRect();
if (window.innerWidth >= r.right && window.innerHeight >= r.bottom) {
// We can use the window's retained layers
// because the window is big enough to display the entire reftest
// because the window is big enough to display the entire browser element
gDrawWindowFlags |= ctx.DRAWWINDOW_USE_WIDGET_LAYERS;
flags += " | DRAWWINDOW_USE_WIDGET_LAYERS";
}
dump("REFTEST INFO | drawWindow flags = " + flags + "\n");
dump("REFTEST INFO | drawWindow flags = " + flags +
"; window.innerWidth/Height = " + window.innerWidth + "," +
window.innerHeight + "; browser.width/height = " +
r.width + "," + r.height + "\n");
}
var scrollX = 0;

View File

@ -46,8 +46,6 @@
id="reftest-window"
onload="OnRefTestLoad();"
onunload="OnRefTestUnload();"
width="800"
height="1000"
style="background:white; overflow:hidden"
>
<script type="application/ecmascript" src="quit.js" />