[Laszlo-dev] For Review: Change 20090219-maxcarlson-g Summary: UPDATED: Correct mouse position for invisible views in DHTML

André Bargull andre.bargull at udo.edu
Thu Feb 19 09:16:15 PST 2009



On 2/19/2009 5:41 PM, Max Carlson wrote:
> André Bargull wrote:
>> According to [1], getComputedStyle returns a CSSStyleDeclaration [2]. 
>> And to access any property, getPropertyValue must be used, but you 
>> used direct access ("styles['position'] == 'absolute'"). That doesn't 
>> work in FF3, does it work in Safari?
> 
> Yes, it does!

Oh, actually it also works in Firefox, when I tested it, I made the 
common CSS-name vs JavaScript-name error (padding-bottom vs 
paddingBottom). Sorry for that!


> 
>> ---
>> + // look up computed style for Safari
>> + if (lz.embed.browser.isSafari && document.defaultView && 
>> document.defaultView.getComputedStyle) {
>> +   var styles = document.defaultView.getComputedStyle(el, '');
>> + }
>> +
>> // opera & (safari absolute) incorrectly account for body offsetTop
>> // used quirks.absolute_position_accounts_for_offset before...
>> - if ( (lz.embed.browser.isSafari || lz.embed.browser.isOpera) && 
>> this.hasOwnProperty('getStyle') && this.getStyle(el, 'position') == 
>> 'absolute' ) {
>> + if ( lz.embed.browser.isOpera || (lz.embed.browser.isSafari && 
>> styles && styles['position'] == 'absolute' ) ) {
>>   pos.y -= document.body.offsetTop;
>> }
>> ---
>>
>>
>> And I see two times the same definition for 
>> "LzSprite.prototype.__processHiddenParents" in "apply.sh".
> 
> Fixed that.
> 
>> [1] 
>> http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSview-getComputedStyle 
>>
>> [2] 
>> http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration
>>
>> On 2/19/2009 4:59 PM, Max Carlson wrote:
>>> Change 20090219-maxcarlson-g by maxcarlson at Bank.local on 2009-02-19 
>>> 05:47:11 PST
>>>     in /Users/maxcarlson/openlaszlo/trunk-clean
>>>     for http://svn.openlaszlo.org/openlaszlo/trunk
>>>
>>> Summary: UPDATED: Correct mouse position for invisible views in DHTML
>>>
>>> Bugs Fixed: LPP-7688 - dragstate doesn't behave the same in DHTML as 
>>> swf8
>>>
>>> Technical Reviewer: andre.bargull at udo.edu
>>> QA Reviewer: promanik
>>>
>>> Details: LzSprite - Add comment for init().  Set __initdone flag to 
>>> true when canvas sprite is done initting.  Move logic for 
>>> finding/showing/hiding hidden parents to __processHiddenParents().  
>>> Use __processHiddenParents() for invisible_parent_image_sizing_fix 
>>> quirk and in __getPos() for determining sprite position - used by 
>>> getMouse().  Handle LPP-4357 in __getPos() by avoiding position 
>>> caching when the app isn't initted yet.  Fix position caching in 
>>> __getPos().
>>>
>>> embednew - Round off positions for Firefox, which sometimes returns 
>>> floats for getBoundingClientRect() according to quirksmode.  Add in 
>>> missing style lookup code for Safari, use to find divs with 
>>> position:absolute.  Fix logic to match comment above.
>>>
>>> Tests: Testcase from LPP-4357 runs as before in firefox.  Testcase 
>>> from LPP-7688 is fixed.  Firebug only shows one call to 
>>> getAbsolutePosition() per drag event - this method can be expensive 
>>> in some browsers.  Tested both on Firefox 3, Safarii 3.2.1, Opera 9.5 
>>> and IE 7.
>>>
>>> Files:
>>> M      WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
>>> M      lps/includes/source/embednew.js
>>>
>>> Changeset: 
>>> http://svn.openlaszlo.org/openlaszlo/patches/20090219-maxcarlson-g.tar
>>>
> 


More information about the Laszlo-dev mailing list