[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Public WebGL] css size vs. canvas size; Firefox 4 bug?



The attached html file has a canvas whose style sets the display type to block and the width & height to 50%. The <canvas> tag does not specify a width & height. When I run the file in either FF4 or Chrome the canvas is displayed at the expected half of the window size. The actual canvas size (canvas.{width,height}) is reported as the default 300 x 150. So far so good.

I then added an resize handler which does

    canvas.width = canvas.clientWidth;
    canvas.height = canvas.clientHeight;

so as to change the size of the canvas to the displayed size. It works as expected in Chrome. In FF4  beta 7, the displayed height of the canvas is changed to the actual height (150) and this is the value returned by canvas.clientHeight. If I comment out both the lines the displayed size is correct.

I have to comment out both lines. It is the act of querying canvas.clientWidth that  triggers the bug, and changes the displayed height of the canvas to 150.

Very weird.

Regards

-Mark




here
begin:vcard
fn:Mark Callow
n:Callow;Mark
org:HI Corporation;Graphics Lab, Research & Development
adr:Higashiyama 1-4-4, Meguro-ku;;Meguro Higashiyama Bldg 5F;Tokyo;;153-0043;Japan
email;internet:callow_mark@hicorp.co.jp
title:Chief Architect
tel;work:+81 3 3710 9367 x228
tel;fax:+81 3 5773 8660
x-mozilla-html:TRUE
url:http://www.hicorp.co.jp,  http://www.mascotcapsule.com
version:2.1
end:vcard