Ticket #3034: 3034_4.patch

File 3034_4.patch, 1.7 KB (added by Frederico Caldeira Knabben, 15 years ago)
  • _source/core/dom/element.js

     
    11141114
    11151115                                if ( !CKEDITOR.env.opera )
    11161116                                {
     1117                                        // Opera includes clientTop|Left into offsetTop|Left.
     1118                                        if ( !current.equals( this ) )
     1119                                        {
     1120                                                x += ( current.$.clientLeft || 0 );
     1121                                                y += ( current.$.clientTop || 0 );
     1122                                        }
     1123
    11171124                                        var scrollElement = previous;
    11181125                                        while ( scrollElement && !scrollElement.equals( current ) )
    11191126                                        {
     
    11411148                                }
    11421149                        }
    11431150
     1151                        var body = this.getDocument().getBody();
     1152
    11441153                        // document.body is a special case when it comes to offsetTop and offsetLeft
    11451154                        // values.
    11461155                        // 1. It matters if document.body itself is a positioned element;
    11471156                        // 2. It matters when we're in IE and the element has no positioned ancestor.
    11481157                        // Otherwise the values should be ignored.
    1149                         if ( this.getComputedStyle( 'position' ) != 'static' || ( CKEDITOR.env.ie && !this.getPositionedAncestor() ) )
     1158                        if ( body.getComputedStyle( 'position' ) != 'static' || ( CKEDITOR.env.ie && !this.getPositionedAncestor() ) )
    11501159                        {
    1151                                 x += this.getDocument().getBody().$.offsetLeft;
    1152                                 y += this.getDocument().getBody().$.offsetTop;
     1160                                x += body.$.offsetLeft + ( body.$.clientLeft || 0 );
     1161                                y += body.$.offsetTop + ( body.$.clientTop || 0 );
    11531162                        }
    11541163
     1164                        // In Firefox, we'll endup one pixel before the element positions,
     1165                        // so we must add it here.
     1166                        if ( CKEDITOR.env.gecko && !CKEDITOR.env.quirks )
     1167                        {
     1168                                x += this.$.clientLeft ? 1 : 0;
     1169                                y += this.$.clientTop ? 1 : 0;;
     1170                        }
     1171
    11551172                        return { x : x, y : y };
    11561173                },
    11571174
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy