Approved! This is a nice improvement. Do you need to update the kernel API documentation to reflect this change?
On 2010-03-27, at 00:40, Max Carlson wrote: > Change 20100325-maxcarlson-k by maxcarl...@bank on 2010-03-25 10:44:20 PDT > in /Users/maxcarlson/openlaszlo/trunk-clean > for http://svn.openlaszlo.org/openlaszlo/trunk > > Summary: UPDATED: Update viewsystem size when compiled fonts load in DHTML, > make text measurement callbacks asynchronous. > > Bugs Fixed: LPP-8848 - DHTML: Textfields using embedded fonts aren't telling > the viewsystem when their size changes > > Technical Reviewer: ptw > QA Reviewer: hminsky > > Details: Updated to address Tucker's comments: > > Not approved yet: > > Right now, LzText seems to think it can tell the sprite to change the font > and then immediately update its size by querying the sprite. Clearly that > does not work in all cases. With this change, the LFC is still going to try > to update the size synchonously, and then the sprite will also install a > callback to update the size asynchronously. Do we really want this > redundancy? It seems inefficient if not outright wrong. > > Why don't we amend the LFC/Kernel API to say the LFC tells the sprite what to > do and then the sprite will call back to the LFC if there is a size change? > > This ended up being a fairly large change, but it wound up being much more > efficient! > > swf*/LzTextSprite - Call owner._updateSize() when initted is true and font > size could have changed. Add arg to getTextWidth() to advise if it's a user > call. > > swf*/LzSprite - Add initted, set to true when init() is called. > > dhtml/LzFontManager - Move font loading code from LzSprite. Add timeouts and > improve efficiency. > > dhtml/LzTextSprite - Allow LzSprite to track initted. Move font loading code > to LzFontManager. Make __updatefieldsize() defer until after initted. Add > __fontLoaded() callback fro LzFontManager. __updatefieldsize() tracks and > clears any existing timout IDs. Add stub setMaxLength() method. Add arg to > getTextWidth() to advise if it's a user call, to allow widths to be measured > accurately before initted. Avoid text measurement until initted. > > dhtml/LzSprite - Consolidate __rootSprite __initdone flag to initted. Add > initted, set to true when init() is called. > > dhtml/LzInputTextSprite - Completely comment out init() override, so > LzSprite.init() runs. > > LzText - Eliminate explicit _updateSize() calls, instead listen for size > changes from the sprite, or at init() time. Pass flag to sprite when > getTextWidth() is being called from user code, to force measurement during > init time. > > Tests: See LPP-8848, test/lztest/lztest-textheight.lzx, smokecheck, > examples/components/component_sampler.lzx run as before across platforms. > Profiling DHTML apps in Firebug shows reduced calls to getTextDimension() and > faster startup. > > Files: > M WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as > M WEB-INF/lps/lfc/kernel/swf/LzSprite.as > M WEB-INF/lps/lfc/kernel/dhtml/LzFontManager.js > 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/kernel/swf9/LzTextSprite.as > M WEB-INF/lps/lfc/kernel/swf9/LzSprite.as > M WEB-INF/lps/lfc/views/LzText.lzs > > Changeset: > http://svn.openlaszlo.org/openlaszlo/patches/20100325-maxcarlson-k.tar >
