It sounds like a good optimization, maybe we should file an improvement task for it..<br>I suppose we&#39;d need to check that IE7 didn&#39;t have some bug with parsing the style<br>text, like it has with reading it out... <br>

<br><br><div class="gmail_quote">On Wed, Oct 14, 2009 at 10:09 AM, P T Withington <span dir="ltr">&lt;<a href="mailto:ptw@laszlosystems.com">ptw@laszlosystems.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

My idea is that we&#39;d keep the classes around, so if I create a div that uses 15pt monospace, there would be a class for that.  I&#39;d only create it the first time around, after that, I&#39;d look up the class name and just jam it in:<br>


<br>
  var fontclass = findClassForFont(style, variant, weight, size, lineHeight, family);<br>
  div.className = &#39;lzswftext &#39; + fontclass;<br>
<br>
And when switching from single to multiline I would be able to just reuse the &quot;type style&quot; class, doing something like:<br>
<br>
  newdiv.className = olddiv.className.replace(&#39;lzswftext&#39;, &#39;lzswftextmultiline&#39;);  // leave the type style class alone.<div><div></div><div class="h5"><br>
<br>
<br>
On 2009-10-14, at 09:59, Henry Minsky wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
What would be the advantage? making it cleaner to apply and remove these<br>
properties as a group? I don&#39;t think it would help with speed because it<br>
would cost you as much time and space to cons up the new class as to frob<br>
the properties directly on the div...<br>
<br>
On Wed, Oct 14, 2009 at 9:55 AM, P T Withington &lt;<a href="mailto:ptw@laszlosystems.com" target="_blank">ptw@laszlosystems.com</a>&gt;wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Ok, here&#39;s another idea, maybe too whacky:<br>
<br>
Instead of smacking styles into divs, what if we dynamically created a CSS<br>
class style rule for each case?  We already have some of this mechanism in<br>
the measurement cache.  At least for the various text attributes we could do<br>
something like, accumulate all the text style properties, build a CSS rule,<br>
assign it to a (generated) class name, and add that class name to the div&#39;s<br>
class (you can have multiple classes apply to a div, they are separated by<br>
spaces).<br>
<br>
We&#39;d still use individual styles for position/overflow/width/height/clip,<br>
but for the styles that affect text, bundle them into a class.<br>
<br>
<br>
On 2009-10-14, at 09:37, Henry Minsky wrote:<br>
<br>
In Firefox, asking for cssText gives you this<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
lzx&gt; foo.sprite.__LzInputDiv.style.cssText<br>
&#39;overflow: scroll; font-family: monospace; width: 415px; height: 115px;&#39;<br>
lzx&gt;<br>
<br>
But in IE7 you get no font info<br>
lzx&gt; foo.sprite.__LzInputDiv.style.cssText<br>
&#39;OVERFLOW: scroll; WIDTH: 417px; CLIP: rect(auto auto auto auto); HEIGHT:<br>
117px&#39;<br>
lzx&gt;<br>
<br>
<br>
On Wed, Oct 14, 2009 at 9:29 AM, Henry Minsky &lt;<a href="mailto:henry.minsky@gmail.com" target="_blank">henry.minsky@gmail.com</a><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
wrote:<br>
</blockquote>
<br>
That apparently does not work in IE7 for some reason...<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
On Wed, Oct 14, 2009 at 9:25 AM, P T Withington &lt;<a href="mailto:ptw@laszlosystems.com" target="_blank">ptw@laszlosystems.com</a><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
wrote:<br>
</blockquote>
<br>
I don&#39;t follow.  setMultiline copies _all_ of the div styles over:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
    lz.embed.__setAttr(newdiv, &#39;style&#39;, olddiv.style.cssText);<br>
<br>
(in addition to the scroll position).  So, something else is going<br>
wrong...<br>
<br>
<br>
On 2009-10-14, at 08:22, Max Carlson wrote:<br>
<br>
Yes, I think it needs to copy the necessary fontstyles over.  Right now<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
LzInputTextSprite#setMultiline() only preserves the text contents,<br>
scrollLeft and scrollTop.  The necessary styles should be preserved in:<br>
LzInputTextSprite.prototype.__fontStyle = &#39;normal&#39;;<br>
LzInputTextSprite.prototype.__fontWeight = &#39;normal&#39;;<br>
LzInputTextSprite.prototype.__fontSize = &#39;11px&#39;;<br>
LzInputTextSprite.prototype.__fontFamily = &#39;Verdana,Vera,sans-serif&#39;;<br>
<br>
I&#39;d avoid copying the entire CSS style - that&#39;s pretty risky.<br>
<br>
Henry Minsky wrote:<br>
<br>
I&#39;m trying to figure out why the font is changing back to the default<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
font when an input field<br>
is set to multiline in IE7/DHTML.<br>
The code in LzInputTextSprite.setMultiline does create a new div, with<br>
_createInputDiv, does that need to<br>
copy the font styles over?<br>
&lt;canvas&gt;<br>
&lt;inputtext id=&quot;foo&quot; width=&quot;400&quot; x=&quot;14&quot; name=&quot;foo&quot;  font=&quot;monospace&quot;<br>
fontsize=&quot;11&quot; fontstyle=&quot;plain&quot;<br>
        multiline=&quot;false&quot;<br>
        text=&quot;${canvas.runtime}&quot;<br>
        bgcolor=&quot;#ccffcc&quot;<br>
        onclick=&quot;   setAttribute(&#39;multiline&#39;, true);<br>
this.setAttribute(&#39;height&#39;, 100); &quot;/&gt;<br>
&lt;/canvas&gt;<br>
--<br>
Henry Minsky<br>
Software Architect<br>
<a href="mailto:hminsky@laszlosystems.com" target="_blank">hminsky@laszlosystems.com</a> &lt;mailto:<a href="mailto:hminsky@laszlosystems.com" target="_blank">hminsky@laszlosystems.com</a>&gt;<br>
<br>
<br>
</blockquote>
--<br>
Regards,<br>
Max Carlson<br>
OpenLaszlo.org<br>
<br>
<br>
</blockquote>
<br>
<br>
</blockquote>
<br>
--<br>
Henry Minsky<br>
Software Architect<br>
<a href="mailto:hminsky@laszlosystems.com" target="_blank">hminsky@laszlosystems.com</a><br>
<br>
<br>
<br>
<br>
</blockquote>
<br>
--<br>
Henry Minsky<br>
Software Architect<br>
<a href="mailto:hminsky@laszlosystems.com" target="_blank">hminsky@laszlosystems.com</a><br>
<br>
</blockquote>
<br>
<br>
</blockquote>
<br>
<br>
-- <br>
Henry Minsky<br>
Software Architect<br>
<a href="mailto:hminsky@laszlosystems.com" target="_blank">hminsky@laszlosystems.com</a><br>
</blockquote>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Henry Minsky<br>Software Architect<br><a href="mailto:hminsky@laszlosystems.com">hminsky@laszlosystems.com</a><br><br><br>