Ticket #3360: 3306.patch

File 3306.patch, 2.5 KB (added by Garry Yao, 15 years ago)
  • _source/core/dom/range.js

     
    806806
    807807                                                        // If we don't need space or this element breaks
    808808                                                        // the line, then enlarge it.
    809                                                         if ( !needsWhiteSpace || enlargeable.getComputedStyle( 'display' ) != 'inline' )
     809                                                        var isBlock = enlargeable.getComputedStyle( 'display' ) != 'inline';
     810                                                        if ( !needsWhiteSpace || isBlock )
    810811                                                        {
    811812                                                                needsWhiteSpace = false;
    812813
     
    815816                                                                // mark it to be enlarged later if the end
    816817                                                                // boundary also enlarges it.
    817818                                                                if ( commonReached )
     819                                                                {
    818820                                                                        startTop = enlargeable;
     821                                                                       
     822                                                                        // Block element above ancestor would be the last node to enlarge.
     823                                                                        if ( isBlock )
     824                                                                                break;
     825                                                                }
    819826                                                                else
    820827                                                                        this.setStartBefore( enlargeable );
    821828                                                        }
     
    886893                                                                if ( needsWhiteSpace )
    887894                                                                {
    888895                                                                        if ( commonReached )
     896                                                                        {
    889897                                                                                startTop = enlargeable;
     898                                                                               
     899                                                                                // Block element above ancestor would be the last node to enlarge.                                       
     900                                                                                if ( enlargeable.getComputedStyle( 'display' ) != 'inline' )
     901                                                                                        break;
     902                                                                        }
    890903                                                                        else if ( enlargeable )
    891904                                                                                this.setStartBefore( enlargeable );
    892905                                                                }
     
    971984
    972985                                                        if ( !body.contains( enlargeable ) )
    973986                                                                break;
    974 
    975                                                         if ( !needsWhiteSpace || enlargeable.getComputedStyle( 'display' ) != 'inline' )
     987                                                        var isBlock = enlargeable.getComputedStyle( 'display' ) != 'inline';
     988                                                        if ( !needsWhiteSpace || isBlock )
    976989                                                        {
    977990                                                                needsWhiteSpace = false;
    978991
     
    977990                                                                needsWhiteSpace = false;
    978991
    979992                                                                if ( commonReached )
     993                                                                {
    980994                                                                        endTop = enlargeable;
     995                                                                        if ( isBlock )
     996                                                                                break;
     997                                                                }
    981998                                                                else if ( enlargeable )
    982999                                                                        this.setEndAfter( enlargeable );
    9831000                                                        }
     
    10401057                                                                if ( needsWhiteSpace )
    10411058                                                                {
    10421059                                                                        if ( commonReached )
     1060                                                                        {
    10431061                                                                                endTop = enlargeable;
     1062
     1063                                                                                // Block element above ancestor would be the last node to enlarge.                                       
     1064                                                                                if ( enlargeable.getComputedStyle( 'display' ) != 'inline' )
     1065                                                                                        break;
     1066                                                                        }
    10441067                                                                        else
    10451068                                                                                this.setEndAfter( enlargeable );
    10461069                                                                }
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy