[Laszlo-dev] [UPDATED] For Review: Change 20090213-ptw-X Summary: DHTML scrolling tweaks

P T Withington ptw at pobox.com
Tue Feb 24 12:41:23 PST 2009


I believe I have addressed your comments.

I've implemented a new philosophy of how text sprites work.  I've  
given the div element of the sprite (and the clickcontainer) a  
different class, depending on the type of text (plain, input, input- 
multiline).  This class handles the padding chore of positioning and  
clipping the text component correctly to match swf metrics.  The text  
components themselves handle the text layout and scrolling.  They are  
set to always have scrollbars, which are pushed outside the clipping  
region of the containing div so they are not visible, but this allows  
us to measure text more easily.

I found a nasty bug in the getTextSize cache:  it was caching  
different numbers for the same key depending on whether the sprite it  
was being asked to measure was multiline or not (because it was  
conditionally adding in the swf padding).  This meant that whoever got  
their first got cached, and the other polarity got the wrong answer!   
I moved the quirk from getTextSize to its clients.

Eventually, we should rip out the quirk flag for swf metrics, since it  
is always on.  Having it conditional just makes the code hard to read.

I've run all the tests you suggested, and they seem vastly improved.

---

Change 20090213-ptw-X by ptw at dueling-banjos.home on 2009-02-13  
21:32:09 EST
     in /Users/ptw/OpenLaszlo/trunk-4
     for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: DHTML scrolling tweaks

Bugs Fixed: LPP-6580 scrolledittext doesn't work in 4.1 (partial0

Technical Reviewer: max (pending)
QA Reviewer: hminsky (pending)

Details:

     LzSprite, LzTextSprite, LzInputTextSprite: note constructor for
     debugger, assign correct className's to divs

     LzSprite: better debugger printing of sprite, adjust
     default CSS to always create scrollbars for text elements (that
     will be clipped away), add a new quirk for scrollbar_width, create
     new container styles that are used to pad the text element to
     match where it would be positioned in swf, adjust lineHeight and
     letterSpacing of text elements to match swf

     LzTextSprite: Use lztextcontainer for div.  Changed getTextSize to
     _not_ include quirks, because it does not include the quirks in
     the cache key, so bad matches were being found in the cache.
     Instead, it's clients apply quirks as necessary. Fixed
     getTextWidth, getTextHeight, getTextfieldHeight, to obey kernel
     API contract.

     LzTextSprite, LzInputTextSprite: correctly call super
     methods for setWidth, setHeight; arrange to hide scrollbars under
     clip

     LzInputTextSprite: Use lzinputtextcontainer for div.  Update div
     and clipcontainer styles for multiline.  Remove redundant
     getTextHeight and getTextfieldHeight methods.  Fix setMultiline to
     correctly copy styles to new div

     LzDebug: note div style in debug name

     LzText, LzTextSprite: Use view height to adjust legacy attributes

     build-opt: Missing dependency noticed in passing

     scrolledittext: Correct math error

     scrolledittext-test: Spiff up diagnostic info

Tests:
     test/lfc/legals/keyboardandmouse.lzx?lzr=dhtml&debug=true
     (scrolling left and right)
     demos/lzpix/app.lzx?lzt=html&lzr=dhtml
     examples/components/edittext_example.lzx?lzt=testboth
     lps/components/incubator/test/scrolledittext-test.lzx?lzt=testboth

Files:
M      WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as
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/debugger/platform/dhtml/LzDebug.js
M      WEB-INF/lps/lfc/views/LzText.lzs
M      build-tools/build-opt.xml
M      lps/components/incubator/scrolledittext.lzx
M      lps/components/incubator/test/scrolledittext-test.lzx

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20090213-ptw-X.tar


More information about the Laszlo-dev mailing list