Ticket #3358: 3358.patch
File 3358.patch, 2.7 KB (added by , 15 years ago) |
---|
-
_source/core/dom/range.js
806 806 807 807 // If we don't need space or this element breaks 808 808 // the line, then enlarge it. 809 if ( !needsWhiteSpace || enlargeable.getComputedStyle( 'display' ) != 'inline' ) 809 var isBlock = enlargeable.getComputedStyle( 'display' ) != 'inline'; 810 if ( !needsWhiteSpace || isBlock ) 810 811 { 811 812 needsWhiteSpace = false; 812 813 … … 815 816 // mark it to be enlarged later if the end 816 817 // boundary also enlarges it. 817 818 if ( commonReached ) 819 { 818 820 startTop = enlargeable; 821 822 // Block element above ancestor would be the last node to enlarge. 823 if ( isBlock ) 824 break; 825 } 819 826 else 820 827 this.setStartBefore( enlargeable ); 821 828 } … … 886 893 if ( needsWhiteSpace ) 887 894 { 888 895 if ( commonReached ) 896 { 889 897 startTop = enlargeable; 898 899 // Block element above ancestor would be the last node to enlarge. 900 if ( enlargeable.getComputedStyle( 'display' ) != 'inline' ) 901 break; 902 } 890 903 else if ( enlargeable ) 891 904 this.setStartBefore( enlargeable ); 892 905 } … … 971 984 972 985 if ( !body.contains( enlargeable ) ) 973 986 break; 974 975 if ( !needsWhiteSpace || enlargeable.getComputedStyle( 'display' ) != 'inline')987 var isBlock = enlargeable.getComputedStyle( 'display' ) != 'inline'; 988 if ( !needsWhiteSpace || isBlock ) 976 989 { 977 990 needsWhiteSpace = false; 978 991 … … 977 990 needsWhiteSpace = false; 978 991 979 992 if ( commonReached ) 993 { 980 994 endTop = enlargeable; 995 if ( isBlock ) 996 break; 997 } 981 998 else if ( enlargeable ) 982 999 this.setEndAfter( enlargeable ); 983 1000 } … … 1040 1057 if ( needsWhiteSpace ) 1041 1058 { 1042 1059 if ( commonReached ) 1060 { 1043 1061 endTop = enlargeable; 1062 1063 // Block element above ancestor would be the last node to enlarge. 1064 if ( enlargeable.getComputedStyle( 'display' ) != 'inline' ) 1065 break; 1066 } 1044 1067 else 1045 1068 this.setEndAfter( enlargeable ); 1046 1069 } … … 1130 1153 1131 1154 this.setEndAfter( boundaryEvent.from ); 1132 1155 } 1156 1157 // Optimize the range to avoid partial selection on boundary blocks by enlarging it. 1158 this.enlarge( CKEDITOR.ENLARGE_ELEMENT ); 1133 1159 } 1134 1160 }, 1135 1161