Changeset 1091

Show
Ignore:
Timestamp:
2007-11-20 03:34:27 (8 months ago)
Author:
martinkou
Message:

Fixed #1514 : Fixed the issue where popup menus are incorrectly positioned in non-IE browsers when the FCKeditor widget is not static positioned.

Location:
FCKeditor/trunk/editor/_source
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/trunk/editor/_source/classes/fckpanel.js

    r1089 r1091  
    192192 
    193193                // Base the popup coordinates upon the coordinates of relElement. 
    194                 var oPos = FCKTools.GetElementPosition( 
     194                var oPos = FCKTools.GetDocumentPosition( this._Window, 
    195195                        relElement.nodeType == 9 ? 
    196196                                ( FCKTools.IsStrictMode( relElement ) ? relElement.documentElement : relElement.body ) : 
    197                                 relElement, 
    198                         this._Window ) ; 
     197                                relElement ) ; 
    199198 
    200199                // Minus the offsets provided by any positioned parent element of the panel iframe. 
     
    202201                if ( positionedAncestor ) 
    203202                { 
    204                         // GetElementPosition() does not work here for some reason... so I'm using GetDocumentPosition() here instead. 
    205203                        var nPos = FCKTools.GetDocumentPosition( FCKTools.GetElementWindow( positionedAncestor ), positionedAncestor ) ; 
    206                         oPos.X -= nPos.x ; 
    207                         oPos.Y -= nPos.y ; 
     204                        oPos.x -= nPos.x ; 
     205                        oPos.y -= nPos.y ; 
    208206                } 
    209207 
     
    211209                        x = ( x * -1 ) ; 
    212210 
    213                 x += oPos.X ; 
    214                 y += oPos.Y ; 
     211                x += oPos.x ; 
     212                y += oPos.y ; 
    215213 
    216214                if ( this.IsRTL ) 
  • FCKeditor/trunk/editor/_source/internals/fcktools.js

    r1017 r1091  
    424424        var y = 0 ; 
    425425        var curNode = node ; 
    426         while ( curNode && curNode != w.document.body ) 
     426        var prevNode = null ; 
     427        var curWindow = FCKTools.GetElementWindow( curNode ) ; 
     428        while ( curNode && !( curWindow == w && curNode == w.document.body ) ) 
    427429        { 
    428430                x += curNode.offsetLeft - curNode.scrollLeft ; 
    429431                y += curNode.offsetTop - curNode.scrollTop ; 
    430                 curNode = curNode.offsetParent ; 
    431         } 
     432 
     433                if ( ! FCKBrowserInfo.IsOpera ) 
     434                { 
     435                        var scrollNode = prevNode ; 
     436                        while ( scrollNode && scrollNode != curNode ) 
     437                        { 
     438                                x -= scrollNode.scrollLeft ; 
     439                                y -= scrollNode.scrollTop ; 
     440                                scrollNode = scrollNode.parentNode ; 
     441                        } 
     442                } 
     443 
     444                prevNode = curNode ; 
     445                if ( curNode.offsetParent ) 
     446                        curNode = curNode.offsetParent ; 
     447                else 
     448                { 
     449                        if ( curWindow != w ) 
     450                        { 
     451                                curNode = curWindow.frameElement ; 
     452                                prevNode = null ; 
     453                                if ( curNode ) 
     454                                        curWindow = FCKTools.GetElementWindow( curNode ) ; 
     455                        } 
     456                        else 
     457                                curNode = null ; 
     458                } 
     459        } 
     460        x += w.document.body.offsetLeft ; 
     461        y += w.document.body.offsetTop ; 
    432462        return { "x" : x, "y" : y } ; 
    433463}