[Laszlo-dev] For Review: Change 20080623-ptw-Y Summary: Fix meassure{Width, Height}
Sarah Allen
sallen at laszlosystems.com
Mon Jun 23 08:20:39 PDT 2008
yes, I misread... resourcewidth/height should be zero if there is no
resource. But the same null Number issue applies to width/height. If a
view has nothing in it, I assume the width/height are zero. How do you
know if they are set deliberately to zero or just happen to be zero?
When designing a component, you often want to set a default width/height
based on the contents if the developer doesn't set one (like with window).
Thanks,
Sarah
P T Withington wrote:
> resourcewidth/height are read-only and represent the size of the
> resource of the view. They are declared to be of type Number. null
> is not a Number. Having an initial value of null was what was
> breaking the measurement code. The rest of the view system uses 0
> when you don't have a resource (e.g., when a resource fails to load).
> So, it seemed expedient and proper.
>
> Since these are read-only, it would be an error for the developer to
> set them to 0 (although we don't have any way of preventing that in
> JS1 runtimes).
>
> [The _real_ bug is that swf8 does not implement coercion of null to a
> Number correctly. They coerce it to NaN, it is supposed to coerce to
> +0. But I don't have any easy way to fix that other than to wait for
> us to stop supporting swf8...]
>
> On 2008-06-23, at 10:51 EDT, Sarah Allen wrote:
>
>> Why is the default 0 now, not null? (I seem to remember hearing
>> about the desire to change this but I forget the details.) How does
>> someone check if a developer intentionally set the size to 0 or it
>> just happens to be zero? (This is especially important in writing
>> components.)
>>
>> Sarah
>>
>>
>> P T Withington wrote:
>>> Change 20080623-ptw-Y by ptw at dueling-banjos.local on 2008-06-23
>>> 04:54:06 EDT
>>> in /Users/ptw/OpenLaszlo/ringding-clean
>>> for http://svn.openlaszlo.org/openlaszlo/trunk
>>>
>>> Summary: Fix meassure{Width,Height}
>>>
>>> Bugs Fixed:
>>> LPP-6339: '<view> component. measureWidth and measureHeight
>>> functions for a view return null unless a resource is attached to
>>> that view.'
>>>
>>> Technical Reviewer: max (pending)
>>> QA Reviewer: mwilde (pending)
>>> Doc Reviewer: sallen (Message-ID: <485F1F44.3060907 at laszlosystems.com>)
>>>
>>> Details:
>>> Default resource dimensions to 0, not null. Update measureSize to
>>> mimmic __LZcheckSize. Update documentation.
>>>
>>> Tests:
>>> ant lztest, smokecheck, test case from bug
>>>
>>> Files:
>>> M WEB-INF/lps/lfc/views/LaszloView.lzs
>>>
>>> Changeset:
>>> http://svn.openlaszlo.org/openlaszlo/patches/20080623-ptw-Y.tar
>>
>
More information about the Laszlo-dev
mailing list