On 2007-06-07, at 00:36 EDT, Henry Minsky wrote:
There's a couple of issues here, mostly having to do with corner cases
and the semantics of "resize".
Firstly, there are a couple of errors in the lztest-textheight that
are
present without
my change, these two
ERROR: In suite Text Size Test Suite, test 1, failed assertion: FAIL:
inputtext5 heightEquals expected 52, got 54
ERROR: In suite Text Size Test Suite, test 1, failed assertion: FAIL:
inputtext5.heightEquals expected 52, got 54
The others have to do with how the width of the text field is
affected by
subsequent calls to setText; whether it should resize it's width to
fit the
text or not. We have the
"resize" property on text which says whether it sizes to fit the text.
The value of "resize" defaults to true on LzText . However, I
believe that
if the user
has specified an explicit width in the attributes of the <text >
tag, then
the LzText construct method should automatically set resize=false,
because
if the user went to the trouble to specify the text width, they
probably
want it to stay that width unless explicitly changed.
I think that is what the attribute `hassetwidth` is supposed to
implement. And then there is the usual Adam magic that you can undo
an explicit width by setting your width to `null`. I guess this is
the equivalent of CSS `auto`.
The other error has to do with the system expecting a multiline
text field
which had
no explicit width to default to width 100. That's kind of
conflicting with
my change
which sets the initial width of text fields to the text content
width (and
which will be zero if the text is empty).
There's a comment in the LzText which isn't actually implemented,
but it
says
// To compute our width:
// + if text is multiline:
// if no width is supplied, use parent width
// + if text is single line:
// if no width was supplied and there's no constraint,
measure the
text width:
// if empty text content was supplied, use DEFAULT_WIDTH
I actually like the idea of defaulting the width to the parent if
no width
is specified, it
seems like that will "do the right thing" most of the time. Perhaps we
should implement that?
That's more like CSS. Setting the width to `auto` maximizes width
within the boundary of the parent. (CSS has margin/border/padding to
contend with too, but that is not a concern here.)