+\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
+ // Generate list of specific style rules, applicable to margin/padding/border.\r
+ function expandedRules( style )\r
+ {\r
+ var sides = [ 'top', 'left', 'right', 'bottom' ], components;\r
+\r
+ if ( style == 'border' )\r
+ components = [ 'color', 'style', 'width' ];\r
+\r
+ var styles = [];\r
+ for ( var i = 0 ; i < sides.length ; i++ )\r
+ {\r
+\r
+ if ( components )\r
+ {\r
+ for ( var j = 0 ; j < components.length ; j++ )\r
+ styles.push( [ style, sides[ i ], components[j] ].join( '-' ) );\r
+ }\r
+ else\r
+ styles.push( [ style, sides[ i ] ].join( '-' ) );\r
+ }\r
+\r
+ return styles;\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
+ * Sets the element size considering the box model.\r
+ * @name CKEDITOR.dom.element.prototype.setSize\r
+ * @function\r
+ * @param {String} type The dimension to set. It accepts "width" and "height".\r
+ * @param {Number} size The length unit in px.\r
+ * @param {Boolean} isBorderBox Apply the size based on the 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
+ * Gets the element size, possibly considering the box model.\r
+ * @name CKEDITOR.dom.element.prototype.getSize\r
+ * @function\r
+ * @param {String} type The dimension to get. It accepts "width" and "height".\r
+ * @param {Boolean} isBorderBox Get the size based on the border box model.\r
+ */\r
+ CKEDITOR.dom.element.prototype.getSize = function( type, isBorderBox )\r
+ {\r
+ var size = Math.max( this.$[ 'offset' + CKEDITOR.tools.capitalize( type ) ],\r
+ this.$[ 'client' + CKEDITOR.tools.capitalize( type ) ] ) || 0;\r
+\r
+ if ( isBorderBox )\r
+ size -= marginAndPaddingSize.call( this, type );\r
+\r
+ return size;\r
+ };\r
+})();\r