+\r
+( function()\r
+{\r
+ var sides = {\r
+ width : [ "border-left-width", "border-right-width","padding-left", "padding-right" ],\r
+ height : [ "border-top-width", "border-bottom-width", "padding-top", "padding-bottom" ]\r
+ };\r
+\r
+ function marginAndPaddingSize( type )\r
+ {\r
+ var adjustment = 0;\r
+ for ( var i = 0, len = sides[ type ].length; i < len; i++ )\r
+ adjustment += parseInt( this.getComputedStyle( sides [ type ][ i ] ) || 0, 10 ) || 0;\r
+ return adjustment;\r
+ }\r
+\r
+ /**\r
+ * Update the element's size with box model awareness.\r
+ * @name CKEDITOR.dom.element.setSize\r
+ * @param {String} type [width|height]\r
+ * @param {Number} size The length unit in px.\r
+ * @param isBorderBox Apply the {@param width} and {@param height} based on border box model.\r
+ */\r
+ CKEDITOR.dom.element.prototype.setSize = function( type, size, isBorderBox )\r
+ {\r
+ if ( typeof size == 'number' )\r
+ {\r
+ if ( isBorderBox && !( CKEDITOR.env.ie && CKEDITOR.env.quirks ) )\r
+ size -= marginAndPaddingSize.call( this, type );\r
+\r
+ this.setStyle( type, size + 'px' );\r
+ }\r
+ };\r
+\r
+ /**\r
+ * Get the element's size, possibly with box model awareness.\r
+ * @name CKEDITOR.dom.element.getSize\r
+ * @param {String} type [width|height]\r
+ * @param {Boolean} contentSize Get the {@param width} or {@param height} based on border box model.\r
+ */\r
+ CKEDITOR.dom.element.prototype.getSize = function( type, contentSize )\r
+ {\r
+ var size = Math.max( this.$[ 'offset' + CKEDITOR.tools.capitalize( type ) ],\r
+ this.$[ 'client' + CKEDITOR.tools.capitalize( type ) ] ) || 0;\r
+\r
+ if ( contentSize )\r
+ size -= marginAndPaddingSize.call( this, type );\r
+\r
+ return size;\r
+ };\r
+})();\r