X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fcore%2Fdom%2Felement.js;h=77031f07f3ebeac03bdf5d4df72f00025ca01d89;hp=b2f9bcc44a326243b40f57614f69e5b9360ffa8b;hb=c9fdde67e6384bd5a66adc2b3bba5c4ce9db56c7;hpb=9873d66421922c7aef8be0f5d2ab51e547b19e66 diff --git a/_source/core/dom/element.js b/_source/core/dom/element.js index b2f9bcc..77031f0 100644 --- a/_source/core/dom/element.js +++ b/_source/core/dom/element.js @@ -789,7 +789,7 @@ CKEDITOR.tools.extend( CKEDITOR.dom.element.prototype, { var child = children.getItem( i ); - if ( child.type == CKEDITOR.NODE_ELEMENT && child.getAttribute( '_fck_bookmark' ) ) + if ( child.type == CKEDITOR.NODE_ELEMENT && child.getAttribute( '_cke_bookmark' ) ) continue; if ( child.type == CKEDITOR.NODE_ELEMENT && !child.isEmptyInlineRemoveable() @@ -917,7 +917,7 @@ CKEDITOR.tools.extend( CKEDITOR.dom.element.prototype, // queuing them to be moved later. (#5567) var pendingNodes = []; - while ( sibling.getAttribute( '_fck_bookmark' ) + while ( sibling.getAttribute( '_cke_bookmark' ) || sibling.isEmptyInlineRemoveable() ) { pendingNodes.push( sibling ); @@ -1522,5 +1522,35 @@ CKEDITOR.tools.extend( CKEDITOR.dom.element.prototype, if ( !event.data.getTarget().hasClass( 'cke_enable_context_menu' ) ) event.data.preventDefault(); } ); - } + }, + + /** + * Update the element's size with box model awareness. + * @name CKEDITOR.dom.element.setSize + * @param {String} type [width|height] + * @param {Number} size The length unit in px. + * @param isBorderBox Apply the {@param width} and {@param height} based on border box model. + */ + setSize : ( function() + { + var sides = { + width : [ "border-left-width", "border-right-width","padding-left", "padding-right" ], + height : [ "border-top-width", "border-bottom-width", "padding-top", "padding-bottom" ] + }; + + return function( type, size, isBorderBox ) + { + if ( typeof size == 'number' ) + { + if ( isBorderBox && !( CKEDITOR.env.ie && CKEDITOR.env.quirks ) ) + { + var adjustment = 0; + for ( var i = 0, len = sides [ type ].length; i < len; i++ ) + adjustment += parseInt( this.getComputedStyle( sides [ type ][ i ] ) || 0, 10 ); + size -= adjustment; + } + this.setStyle( type, size + 'px' ); + } + }; + })() });