In general we need deferred execution to handle changes to the DOM rendering.
Both Flash and DHTML will defer rendering while JS is running, so if you want
JS to change the DOM in some way (style or content) and then it needs to react
to the change (e.g., measuring the resulting rendering), the reaction code must
be done as a "idle" callback. In both runtimes it is sufficient to put the
code on a timeout of 0 because the rendering will happen when the current
thread returns and then the expired timeouts will be called.
We should try to remember to document when/why we need a callback.
On 2010-08-05, at 12:40, André Bargull wrote:
> I've added the timeout for __handleLostFocus in r11662, but I can't tell
> anymore why I did so. Maybe it was necessary to fix LPP-7101, or maybe I just
> wanted to be conservative. My note from the change set about adjusting the
> control flow doesn't ring a bell.
>
>> LzInputTextSprite (swf9):
>> - removed "updateData" (only necessary in LzInputText)
>> - removed focus-check in "__handlelostFocus"
>> - added defered execution in "__lostFocus", that way control flow is like in
>> swf8
>> - set keyboard focus in "gotFocus"
>> - unset keyboard focus in "gotBlur"
>> - use String#replace instead of split+join, because it's faster (I've tested
>> it!)
>
>
>
>
> On 8/5/2010 5:50 PM, Henry Minsky wrote:
>> Approved!
>>
>> Thanks for discovering that adobe focus bug.
>>
>> There's a conflict with this change and the last change I checked into
>> swf9 LzInputTextSprite, I had removed the setTimeout delay in the call
>> to __handleLostFocus , because I didn't think we needed it
>> anymore. I'm not sure if that is still necessary
>>
>> function __lostFocus (event:FocusEvent) :void {
>> + // defer execution, see swf8 kernel
>> + LzTimeKernel.setTimeout(this.__handlelostFocus, 1, event);
>>
>>
>> On Thu, Aug 5, 2010 at 11:22 AM, André Bargull <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> Change 20100805-bargull-LmW by barg...@bargull02 on 2010-08-05
>> 17:06:57
>> in /home/anba/src/svn/openlaszlo/trunk
>> for http://svn.openlaszlo.org/openlaszlo/trunk
>>
>> Summary: handle premature loss of focus for inputtext
>>
>> Bugs Fixed: LPP-9170 (inputtext can have cursor and allow input
>> without focus on it)
>>
>> Technical Reviewer: henry
>> QA Reviewer: max
>>
>> Details:
>> LzInputText:
>> - calling lz.setFocus() doesn't ensure the focus will actually
>> change, handle this case in inputtextevent()
>> - changed lzxtype from booleanLiteral to boolean which is the proper
>> type
>> LzInputTextSprite:
>> - implement workaround for flash player bug FP-5021
>> LzFocus:
>> - changed if statement so it triggers conditional compilation
>>
>>
>> Tests:
>> testcase from bugreport (swf8, swf10, dhtml [Firefox, IE, Safari,
>> except Opera - but mouse-events are currently broken in Opera, so
>> it's difficult to test in this case])
>>
>> Files:
>> M WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as
>> M WEB-INF/lps/lfc/kernel/swf9/LzInputTextSprite.as
>> M WEB-INF/lps/lfc/services/LzFocus.lzs
>> M WEB-INF/lps/lfc/views/LzInputText.lzs
>>
>> Changeset:
>> http://svn.openlaszlo.org/openlaszlo/patches/20100805-bargull-LmW.tar
>>
>>
>>
>>
>> --
>> Henry Minsky
>> Software Architect
>> [email protected] <mailto:[email protected]>
>>
>>