Not approved yet. Functionally, it looks good - the text fields now update their size when I type into them in dhtml. I am seeing one strange thing in swf8 when running my components demo - I can't click to select text, instead every time I click it selects _all_ the text. The height and width changes don't seem to be propagating to parent views in swf8/10.

When running test/lztest/lztest-textheight.lzx?debug=true&lzr=dhtml I see some regressions. With your patch I see five additional errors: ERROR: In suite Text Size Test Suite, test 2, failed assertion: inputtext c sprite.getTextfieldHeight() within 82±1 got 96 ERROR: In suite Text Size Test Suite, test 2, failed assertion: inputtext c getTextHeight() within 82±1 got 96 ERROR: In suite Text Size Test Suite, test 2, failed assertion: inputtext d getTextfieldHeight() within 82±1 got 96 ERROR: In suite Text Size Test Suite, test 2, failed assertion: inputtext d getTextHeight() within 82±1 got 96 ERROR: In suite Text Size Test Suite, test 2, failed assertion: inputtext d height within 82±1 got 96

These need to be tracked down and resolved.


I'm not comfortable with the DHTML sprite reading it's owner.hassetheight - we need an API to ensure this stays in sync, even if it's an additional argument to sprite.setHeight()...

Also it seems this:
                if (sprite.sizeToHeight && sprite.multiline) {
                    // NOTE: This sequence of operations is needed to
                    // make autosizing work reliably in IE7. If you do
                    // not first set the field height to zero before
                    // looking at scrollHeight, then when you type
                    // into the field it sometimes scrolls a little
                    // upwards. There is a visual artifact, a "jump",
                    // when you add a new line to the end of the
                    // field. However that seems to be the state of
                    // the art right now.
                    d.style.height = "0px";
                    d.style.height = d.scrollHeight + "px";
                    d.scrollTop = 0+"px";

                }
should be wrapped in a quirk if it's really IE-specific...

On 3/26/10 3:41 PM, Henry Minsky wrote:
Change 20100325-hqm-i by [email protected] on 2010-03-25 15:07:05 EDT
     in /Users/hqm/openlaszlo/trunk
     for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: fix for autosizing of inputtext fields

New Features:

Bugs Fixed: LPP-8591

Technical Reviewer: max
QA Reviewer: ptw
Doc Reviewer: (pending)

Documentation:

Release Notes:

Overview:

Fix autosizing behavior for inputtext fields.




Details:

LaszloView.lzs: make updateHeight() update the cached height value

LzText.lzs: set_text and set_width call updateHeight instead of the height 
setter,
to prevent the hassetheight flag from getting incorrectly set on autosizing 
text views.

LzInputText.lzs: Changed the call in inputtevent()'s onchange handler, to
use updateHeight() instead of the height setter (to prevent turning an 
autosizing
field into a fixed height field)

LzSprite.js: modified CSS for multiline input text to use the whiteSpace='pre' 
CSS option,
to get accurate height measurement.

LzTextSprite.js: Added 'sizeToHeight' flag, to track whether the the
sprite is autosizing. I know the kernel sprite shouldn't be ppeeking
at any more properties of the view, but we can do a real cleanup when
we design the new text class.

[One thing that would be nice is if we allowed the user to change from
a single line to a multiline inputtext dynamically, like you can do in
SWF. In DHTML, we'd have to destroy the DOM input div and make a new one]

LzInputTextSprite.js: in __textEvent(), use a technique to autosize the text 
height,
by asking for it's scrollHeight. This seems to work in IE7, IE8, Firefox.
Safari does not like setting the height to zero.


Tests:

Test case at end of LPP-8591, run in FF, IE7, IE8, Safari, Chrome, Opera

1) Enter text to cause text field to grow in height, see that
background size matches the view height.  See that no scrolling
happens.

2) Select all and delete text, see height of field and background
shrink to single line.

3) Try typing text that auto-wraps, i.e., words with spaces between
but no newlines. See that text height grows to contain text, with no
scrolling.



smokecheck
amazon demo
calendar demo


Files:
M       WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
M       WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
M       WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
M       WEB-INF/lps/lfc/views/LzInputText.lzs
M       WEB-INF/lps/lfc/views/LzText.lzs
M       WEB-INF/lps/lfc/views/LaszloView.lzs


Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20100325-hqm-i.tar

--
Regards,
Max Carlson
OpenLaszlo.org

Reply via email to