Your fix clearly works, so approved.

BUT, the etiology of this bug is interesting:  You made the resize property act 
as a cache in the superclass, and the subclass was clobbering your cache in an 
attempt to compute its default resize, so the call to the setter in the 
superclass, which used to work, became a noop.

We've had this problem before when introducing caches (see the width setter in 
view), and it is a general problem if we ever hope to take advantage of 
Javascript getters and setters.  As long as we are using an actual property 
with the same name as what should be a virtual property to store the state of 
that property, we are going to continue to screw ourselves.

I would _really_ like to see us adopt a discipline where if we are trying to 
make our setters more efficient we use a private property to act as the cache 
(or memo as I called it in set width) so we stop stepping on our own toes.

I think this would be a more correct fix, in which case, you could revert the 
change to <inputetext>:

> Index: LzText.lzs
> ===================================================================
> --- LzText.lzs        (revision 17623)
> +++ LzText.lzs        (working copy)
> @@ -809,16 +809,18 @@
>     * @type Boolean
>     */
>    var resize:Boolean = true;
> +
>    /** @access private */
> +  var _set_resize_memo;
> +  /** @access private */
>    function $lzc$set_resize(val:Boolean) {
>      val = !! val;
> -    if (val !== this.resize) {
> -      this.resize = val;
> +    if (val !== this._set_resize_memo) {
> +      this.resize = this._set_resize_memo = val;
>        this.tsprite.setResize(val);
>      }
>    }

[I also note there is no support in this setter for the onresize event]

Since in the breaking change, you made the same optimization to the setter for 
`multiline`, I'd suggest you use a separate memo property there too.  It's just 
plain bad practice to use the same name for the virtual slot and the state 
variable.

There's an additional documentation problem here, because we have no way to 
document that the default value of the resize property is different for 
<inputtext> than it is for its superclass <text>.  We can do that in LZX, but 
we don't have a mechanism in the LFC for simply defining and documenting 
overridden defaults. Instead we have these custom constructor overrides that 
munge the initarg list.  That's something we ought to have an improvement filed 
for.

 
On 2010-09-27, at 22:15, Max Carlson wrote:

> Change maxcarlson-20100927-UiM by [email protected] on 2010-09-27 
> 20:04:21 MDT
>    in /Users/maxcarlson/openlaszlo/trunk-clean
>    for http://svn.openlaszlo.org/openlaszlo/trunk
> 
> Summary: Fix inputtext resizing
> 
> Bugs Fixed: LPP-9405 - OL 5.0.x - SWF10 - Amazon - The input field of 
> Shipping Address or Payment Method can NOT work
> 
> Technical Reviewer: ptw
> QA Reviewer: hminsky
> 
> Details: I'm gonna check this one in.  
> 
> LzInputText - Mirror the construct method in LzText, but default to false 
> like this.resize used to.
> 
> Tests: See LPP-9405.
> 
> Files:
> M       WEB-INF/lps/lfc/views/LzInputText.lzs
> 
> Changeset: 
> http://svn.openlaszlo.org/openlaszlo/patches/maxcarlson-20100927-UiM.tar


Reply via email to