Ticket #3034: 3034_3.patch

File 3034_3.patch, 4.6 KB (added by Martin Kou, 15 years ago)
  • _source/tests/core/dom/element.html

     
    486486                        var element = new CKEDITOR.dom.element( document.getElementsByTagName( 'small' )[0] );
    487487                        assert.isTrue( element.hasAttributes() );
    488488                },
    489 
     489               
     490                test_getDocumentPosition : function()
     491                {
     492                        // Assign the page location of the element.
     493                        YAHOO.util.Dom.setXY('DocPositionTarget', [ 350, 450 ] );
     494                        var pos = CKEDITOR.document.getById( 'DocPositionTarget' ).getDocumentPosition();
     495                        if ( !CKEDITOR.env.ie )
     496                        {
     497                                assert.areEqual( 350, pos.x, 'Position coordinates:x relative to document doesn\'t match.' );
     498                                assert.areEqual( 450, pos.y, 'Position coordinates:y relative to document doesn\'t match.' );
     499                        }
     500                        else
     501                        {
     502                                assert.isTrue( pos.x == 348 || pos.x == 349, 'Position coordinates:x relative to document doesn\'t match.' );
     503                                assert.areEqual( 448, pos.y, 'Position coordinates:y relative to document doesn\'t match.' );
     504                        }
     505                },
     506               
    490507                name : document.title
    491508        };
    492509})() );
    493510
    494511        //]]>
    495512        </script>
     513        <style type="text/css" media="screen">
     514                #test-computed {
     515                    width:50%;
     516                    margin:auto;
     517                    padding:10px;
     518                    z-index: 2;
     519                }
     520                .scroll
     521                {
     522                        overflow: visible;
     523                }
     524                .block1
     525                {
     526                        width: 100%;
     527                        height: 100px;
     528                        background-color: blue;
     529                        text-align: center;
     530                }
     531                .block2
     532                {
     533                        margin: auto;
     534                        width: 200px;
     535                        height: 200px;
     536                        background-color: green;
     537                        position : relative;
     538                }
     539                .block3
     540                {
     541                        position: absolute;
     542                        float:right;
     543                        width: 300px;
     544                        height: 300px;
     545                        background-color: black;
     546                }
     547                .block4
     548                {
     549                        position: absolute;
     550                        left: 50px;
     551                        right: 50px;
     552                        width: 400px;
     553                        height: 400px;
     554                        background-color: pink;
     555                }
     556                #DocPositionTarget
     557                {
     558                        background-color: red;
     559                }
     560        </style>
    496561</head>
    497562<body>
    498563        <textarea id="test1" rows="10" cols="80"></textarea>
     
    515580B</div>
    516581        <big>Test</big>
    517582        <small title="Testing">Test</small>
     583       
     584        <div class="block1 scroll" id="block1"><div class="block2 scroll" id="block2"><div class="block3 scroll" id="block3"><div class="block4 scroll" id="block4"><div id="DocPositionTarget">target</div></div></div></div></div>
     585       
    518586</body>
    519587</html>
  • _source/skins/office2003/richcombo.css

     
    5757    text-overflow: ellipsis;
    5858    overflow: hidden;
    5959        display: inline-block;
     60        position: relative;
    6061}
    6162
    6263.cke_skin_office2003 .cke_ltr .cke_rcombo .cke_text
  • _source/skins/v2/richcombo.css

     
    5252    text-overflow: ellipsis;
    5353    overflow: hidden;
    5454        display: inline-block;
     55        position: relative;
    5556}
    5657
    5758.cke_skin_v2 .cke_ltr .cke_rcombo .cke_text
  • _source/core/dom/element.js

     
    11121112                                x += current.$.offsetLeft - current.$.scrollLeft;
    11131113                                y += current.$.offsetTop - current.$.scrollTop;
    11141114
     1115                                /*
     1116                                 * IE doesn't really include the element borders into offsetLeft and
     1117                                 * offsetTop, despite their claims on their MSDN documentations.
     1118                                 * (#3034)
     1119                                 */
     1120                                if ( CKEDITOR.env.ie && !this.equals( current ) )
     1121                                {
     1122                                        x += current.$.clientLeft;
     1123                                        y += current.$.clientTop;
     1124                                }
     1125
    11151126                                if ( !CKEDITOR.env.opera )
    11161127                                {
    11171128                                        var scrollElement = previous;
     
    11461157                        // 1. It matters if document.body itself is a positioned element;
    11471158                        // 2. It matters when we're in IE and the element has no positioned ancestor.
    11481159                        // Otherwise the values should be ignored.
    1149                         if ( this.getComputedStyle( 'position' ) != 'static' || ( CKEDITOR.env.ie && !this.getPositionedAncestor() ) )
     1160                        var body = this.getDocument().getBody();
     1161                        if ( body.getComputedStyle( 'position' ) != 'static' || ( CKEDITOR.env.ie && this.getPositionedAncestor() == null ) )
    11501162                        {
    1151                                 x += this.getDocument().getBody().$.offsetLeft;
    1152                                 y += this.getDocument().getBody().$.offsetTop;
     1163                                x += body.$.offsetLeft;
     1164                                y += body.$.offsetTop;
    11531165                        }
    11541166
    11551167                        return { x : x, y : y };
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy