Ticket #7946: 7946_3.patch

File 7946_3.patch, 1.4 KB (added by Garry Yao, 11 years ago)
  • _source/core/dom/element.js

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    14301430                        var currentScroll = win.getScrollPosition().y;
    14311431                        if ( offset > currentScroll || offset < currentScroll - winHeight )
    14321432                                win.$.scrollTo( 0, offset );
     1433
     1434                        // Check whether the host page need to scroll too. (#7946)
     1435                        var doc = CKEDITOR.document;
     1436                        if ( !this.getDocument().equals( doc ) )
     1437                        {
     1438                                var rect = this.$.getBoundingClientRect(),
     1439                                        pos = this.getDocumentPosition( doc ),
     1440                                        marker = new CKEDITOR.dom.element( 'div', doc );
     1441
     1442                                // marker will of the same size of the current.
     1443                                marker.setStyles(
     1444                                {
     1445                                        position : 'absolute',
     1446                                        visibility : 'hidden',
     1447                                        left : pos.x + 'px',
     1448                                        top : pos.y + 'px',
     1449                                        width : ( rect.width || rect.right - rect.left ) + 'px',
     1450                                        height : ( rect.height || rect.top - rect.bottom ) + 'px'
     1451                                });
     1452                                doc.getBody().append( marker );
     1453
     1454                                rect = marker.$.getBoundingClientRect();
     1455                                winHeight = doc.getWindow().getViewPaneSize().height;
     1456
     1457                                // Scroll host page only when client rectangle is outside of viewport.
     1458                                if ( rect.bottom < 0 || rect.top > winHeight )
     1459                                        marker.$.scrollIntoView( alignTop );
     1460
     1461                                marker.remove();
     1462                        }
    14331463                },
    14341464
    14351465                setState : function( state )
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy