[Laszlo-dev] Query args width and height processed by LaszloCanvas.lzs#construct()

Max Carlson max at laszlosystems.com
Tue Jul 21 20:37:05 PDT 2009


The way it's supposed to work is, canvas values are the default - if 
unspecified they're 100% x 100%.  Object tags override the canvas 
values.  It seems like the bug is that we are passing the values in via 
the query string to the app, instead of reading them some other way. 
This allows for the two problem cases - where the query string and 
object tag values differ.

As Tucker said, fixing this bug would prevent users from overriding the 
size accidentally due to namespace collision:
http://jira.openlaszlo.org/jira/browse/LPP-3479

Ideally, we'd read the actual values from the object tag instead of 
relying on reading them from the query string.  Flash only provides 
access to the current pixel size which changes for percentage values -
see 
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Stage.html 
and 
http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary675.html 
for the relevant docs.  Unfortunately, the canvas code currently relies 
on being able to read the query string for percentage values to detect 
when it should listen for screen resize events.

Maybe always listening for screen resize events is okay in Flash. 
Alternately, we could just change the query args to something more 
obscure to get around this (__lzwidth/height) - but LPP-3479 is the 
'real' solution.

In DHTML, we read the values directly from the call to lz.embed.dhtml() 
so there are no query string values - so this isn't an issue.

Raju Bitter wrote:
> Correction for 3) I meant precedence instead of preference. ;-) "The 
> passed values of 100%25 (URL encoded) for width and height have 
> precedence over the canvas settings in LZX"
> 
> On Jul 22, 2009, at 2:20 AM, Raju Bitter wrote:
> 
>> This is the behavior I see:
>>
>> 1) WORKS: Canvas resizes to full screen, debug window resizes with it 
>> (if debug is enabled)
>> <canvas width="100%" height="100%"
>> <object type="application/x-shockwave-flash" 
>> data="fullscreen2.lzx.swf8.swf?lzproxied=false" width="100%" heig\
>> ht="100%">
>>         <param name="movie" 
>> value="fullscreenexample/fullscreen2.lzx.swf8.swf?lzproxied=false">
>>         <param name="quality" value="high">
>>         <param name="scale" value="noscale">
>>         <param name="salign" value="LT">
>>         <param name="allowFullScreen" value="true">
>>         <param name="menu" value="false"></object>
>>
>> 2) WORKS: Canvas resizes to full screen, debug window resizes with it 
>> (if debug enabled)
>> <canvas width="100%" height="100%"
>> <object type="application/x-shockwave-flash" 
>> data="fullscreen2.lzx.swf8.swf?lzproxied=false" width="600" heig\
>> ht="600">
>>         <param name="movie" 
>> value="fullscreenexample/fullscreen2.lzx.swf8.swf?lzproxied=false">
>>         <param name="quality" value="high">
>>         <param name="scale" value="noscale">
>>         <param name="salign" value="LT">
>>         <param name="allowFullScreen" value="true">
>>         <param name="menu" value="false"></object>
>>
>> 3) WORKS: in normal mode at 800x800 pixel, going into full screen 
>> without problem, debug window resizes automatically. The passed values 
>> of 100%25 (URL encoded) for width and height have preference over the 
>> canvas settings in LZX
>> <canvas width="600" height="600"
>> <object type="application/x-shockwave-flash" 
>> data="fullscreen2.lzx.swf8.swf?lzproxied=false&width=100%25&height=100%25"\ 
>>
>> width="800" height="800">
>>         <param name="movie" 
>> value="fullscreenexample/fullscreen2.lzx.swf8.swf?lzproxied=false">
>>         <param name="quality" value="high">
>>         <param name="scale" value="noscale">
>>         <param name="salign" value="LT">
>>         <param name="allowFullScreen" value="true">
>>         <param name="menu" value="false"></object>
>>
>> 4) PROBLEM: Reported values for canvas dimensions in normal display 
>> mode: canvas.width=500, canvas.height=400, but area covered by Flash 
>> movie is 800x800. In case the debug window is visible it's sized for 
>> the 500x400 dimension, but can be visibly dragged in an area of about 
>> 800x600 pixels. Going into full screen canvas still reports 500x400 
>> pixels, debug window can be dragged in a larger area (around 800x600)
>> <canvas width="100%" height="100%"
>> <object type="application/x-shockwave-flash" 
>> data="fullscreen2.lzx.swf8.swf?lzproxied=false&width=500&height=4\
>> 00" width="800" height="800">
>>         <param name="movie" 
>> value="fullscreenexample/fullscreen2.lzx.swf8.swf?lzproxied=false">
>>         <param name="quality" value="high">
>>         <param name="scale" value="noscale">
>>         <param name="salign" value="LT">
>>         <param name="allowFullScreen" value="true">
>>         <param name="menu" value="false"></object>
>>
>> 5) PROBLEM: Application initially has dimension of 800x800, but 
>> centering takes place based on the 600x600 values for canvas. oes into 
>> full screen without any problems. The debug window resizes (if 
>> visible) on maximizing, but seems to miss the minimize event and stays 
>> large
>> <canvas width="600" height="600"
>> <object type="application/x-shockwave-flash" 
>> data="fullscreen2.lzx.swf8.swf?lzproxied=false" width="800" heigh\
>> t="800">
>>         <param name="movie" 
>> value="fullscreenexample/fullscreen2.lzx.swf8.swf?lzproxied=false">
>>         <param name="quality" value="high">
>>         <param name="scale" value="noscale">
>>         <param name="salign" value="LT">
>>         <param name="allowFullScreen" value="true">
>>         <param name="menu" value="false"></object>
>>
>> Does this make the situation clearer? I did all this testing to make 
>> sure everyone has the right understanding of how apps behave.
>>
>> On Jul 21, 2009, at 5:09 PM, Max Carlson wrote:
>>
>>> It seems full screen mode shows the application at the size specified 
>>> by the developer. If resizing is desired, percentage values should be 
>>> used for width/height - whether specified in the query string, html 
>>> embedding code, orcoming from the canvas.
>>>
>>> -----Original Message-----
>>> From: Raju Bitter <rajubitter at me.com>
>>> Sent: Monday, July 20, 2009 2:59 PM
>>> To: P T Withington <ptw at pobox.com>
>>> Cc: Max Carlson <max at laszlosystems.com>; Laszlo-dev bug reporting 
>>> <laszlo-dev at openlaszlo.org>
>>> Subject: Re: [Laszlo-dev] Query args width and height processed by 
>>> LaszloCanvas.lzs#construct()
>>>
>>> Yes, I know that the LaszloCanvas code is looking for those args.
>>> Isn't it like there are 4 sources for the width/height value?
>>>
>>> 1) canvas attributes
>>> 2) embedding code
>>> 3) query args for SWF file
>>> 4) default values 400/400, in case the query args contain an invalid
>>> value
>>>
>>> But what you are saying means: if a developer wants to use full screen
>>> feature, he must take caution not pass any values for width and height
>>> into the app at runtime, or full screen mode might not auto-adjust the
>>> canvas size.
>>>
>>>
>>> On Jul 20, 2009, at 5:18 PM, P T Withington wrote:
>>>
>>>> I don't know the history, but notice that the canvas is _looking_
>>>> for those params.  It's not that query params override an
>>>> application var or setting (which could be a security issue).  The
>>>> developer of the canvas specifically asks for these params.
>>>>
>>>> The history of canvas size is long and tortured, and there are a lot
>>>> of crazy paths in the compiler to handle absolute vs. percentage
>>>> sizing.  I am a big proponent for letting the size be dynamic, taken
>>>> from the browser or query args, rather than having to recompile your
>>>> app to resize it.
>>>>
>>>> On 2009-07-19, at 11:21EDT, Max Carlson wrote:
>>>>
>>>>> Perhaps we want a different behavior when fullscreen is on.  It
>>>>> should act much more like the default of 100% by 100%. Maybe the
>>>>> part of canvas.construct() that registers for screen size
>>>>> notifications should be refactored to a separate method so it can
>>>>> be called when fullscreen is turned on...
>>>>>
>>>>> -----Original Message-----
>>>>> From: Raju Bitter <rajubitter at me.com>
>>>>> Sent: Sunday, July 19, 2009 8:47 AM
>>>>> To: Raju Bitter <rajubitter at me.com>
>>>>> Cc: Laszlo-dev bug reporting <laszlo-dev at openlaszlo.org>
>>>>> Subject: Re: [Laszlo-dev] Query args width and height processed by
>>>>> LaszloCanvas.lzs#construct()
>>>>>
>>>>> And if you don't want to read the forum post: he attached a width and
>>>>> height parameter to the SWF for whatever reason (customer
>>>>> requirement), and never expected that t
>>>
>>> [The entire original message is not included]
>>
> 

-- 
Regards,
Max Carlson
OpenLaszlo.org


More information about the Laszlo-dev mailing list