- /**\r
- * Returns an object with properties top, left, right and bottom representing the margins of this element unless sides is passed,\r
- * then it returns the calculated width of the sides (see getPadding)\r
- * @param {String} sides (optional) Any combination of l, r, t, b to get the sum of those sides\r
- * @return {Object/Number}\r
- */\r
- getMargins : function(side){\r
- var me = this,\r
- key,\r
- hash = {t:"top", l:"left", r:"right", b: "bottom"},\r
- o = {};\r
+ getStyleSize : function(){\r
+ var me = this,\r
+ w, h,\r
+ doc = document,\r
+ d = this.dom,\r
+ isDoc = (d == doc || d == doc.body),\r
+ s = d.style;\r
+\r
+ // If the body, use Ext.lib.Dom\r
+ if (isDoc) {\r
+ var extdom = Ext.lib.Dom;\r
+ return {\r
+ width : extdom.getViewWidth(),\r
+ height : extdom.getViewHeight()\r
+ }\r
+ }\r
+ // Use Styles if they are set\r
+ if(s.width && s.width != 'auto'){\r
+ w = parseFloat(s.width);\r
+ if(me.isBorderBox()){\r
+ w -= me.getFrameWidth('lr');\r
+ }\r
+ }\r
+ // Use Styles if they are set\r
+ if(s.height && s.height != 'auto'){\r
+ h = parseFloat(s.height);\r
+ if(me.isBorderBox()){\r
+ h -= me.getFrameWidth('tb');\r
+ }\r
+ }\r
+ // Use getWidth/getHeight if style not set.\r
+ return {width: w || me.getWidth(true), height: h || me.getHeight(true)};\r
+ },\r
+\r
+ /**\r
+ * Returns the size of the element.\r
+ * @param {Boolean} contentSize (optional) true to get the width/size minus borders and padding\r
+ * @return {Object} An object containing the element's size {width: (element width), height: (element height)}\r
+ */\r
+ getSize : function(contentSize){\r
+ return {width: this.getWidth(contentSize), height: this.getHeight(contentSize)};\r
+ },\r
+\r
+ /**\r
+ * Forces the browser to repaint this element\r
+ * @return {Ext.Element} this\r
+ */\r
+ repaint : function(){\r
+ var dom = this.dom;\r
+ this.addClass("x-repaint");\r
+ setTimeout(function(){\r
+ Ext.fly(dom).removeClass("x-repaint");\r
+ }, 1);\r
+ return this;\r
+ },\r
+\r
+ /**\r
+ * Disables text selection for this element (normalized across browsers)\r
+ * @return {Ext.Element} this\r
+ */\r
+ unselectable : function(){\r
+ this.dom.unselectable = "on";\r
+ return this.swallowEvent("selectstart", true).\r
+ applyStyles("-moz-user-select:none;-khtml-user-select:none;").\r
+ addClass("x-unselectable");\r
+ },\r
+\r
+ /**\r
+ * Returns an object with properties top, left, right and bottom representing the margins of this element unless sides is passed,\r
+ * then it returns the calculated width of the sides (see getPadding)\r
+ * @param {String} sides (optional) Any combination of l, r, t, b to get the sum of those sides\r
+ * @return {Object/Number}\r
+ */\r
+ getMargins : function(side){\r
+ var me = this,\r
+ key,\r
+ hash = {t:"top", l:"left", r:"right", b: "bottom"},\r
+ o = {};\r