X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6e39d509471fe9b4e2660e0d1631b350d0c66f40..2e847cf21b8ab9d15fa167b315ca5b2fa92638fc:/docs/source/Element.style-more.html diff --git a/docs/source/Element.style-more.html b/docs/source/Element.style-more.html index 180f2e0d..d4c30a6b 100644 --- a/docs/source/Element.style-more.html +++ b/docs/source/Element.style-more.html @@ -15,7 +15,7 @@ Ext.Element.boxMarkup = '
/** * More flexible version of {@link #setStyle} for setting style properties. @@ -46,28 +46,6 @@ Ext.Element.addMethods(function(){ return ret; }, - // deprecated - getStyleSize : function(){ - var me = this, - w, - h, - d = this.dom, - s = d.style; - if(s.width && s.width != 'auto'){ - w = parseInt(s.width, 10); - if(me.isBorderBox()){ - w -= me.getFrameWidth('lr'); - } - } - if(s.height && s.height != 'auto'){ - h = parseInt(s.height, 10); - if(me.isBorderBox()){ - h -= me.getFrameWidth('tb'); - } - } - return {width: w || me.getWidth(true), height: h || me.getHeight(true)}; - }, - // private ==> used by ext full setOverflow : function(v){ var dom = this.dom; @@ -155,7 +133,7 @@ Ext.Element.addMethods(function(){ var me = this, h = Math.max(me.dom.offsetHeight, me.dom.clientHeight); if(!h){ - h = parseInt(me.getStyle('height'), 10) || 0; + h = parseFloat(me.getStyle('height')) || 0; if(!me.isBorderBox()){ h += me.getFrameWidth('tb'); } @@ -172,7 +150,7 @@ Ext.Element.addMethods(function(){ getComputedWidth : function(){ var w = Math.max(this.dom.offsetWidth, this.dom.clientWidth); if(!w){ - w = parseInt(this.getStyle('width'), 10) || 0; + w = parseFloat(this.getStyle('width')) || 0; if(!this.isBorderBox()){ w += this.getFrameWidth('lr'); } @@ -253,70 +231,77 @@ Ext.Element.addMethods(function(){ height: vpSize.height * 0.95 }); // To handle window resizing you would have to hook onto onWindowResize. - - * @param {Boolean} contentBox True to return the W3 content box within the padding area of the element. False - * or omitted to return the full area of the element within the border. See http://www.w3.org/TR/CSS2/box.html - * @return {Object} An object containing the elements's area: {width: <element width>, height: <element height>} - */ - getViewSize : function(contentBox){ + * + * + * getViewSize utilizes clientHeight/clientWidth which excludes sizing of scrollbars. + * To obtain the size including scrollbars, use getStyleSize + * + * Sizing of the document body is handled at the adapter level which handles special cases for IE and strict modes, etc. + */ + + getViewSize : function(){ var doc = document, - me = this, - d = me.dom, - extdom = Ext.lib.Dom, - isDoc = (d == doc || d == doc.body), - isBB, w, h, tbBorder = 0, lrBorder = 0, - tbPadding = 0, lrPadding = 0; - if (isDoc) { - return { width: extdom.getViewWidth(), height: extdom.getViewHeight() }; - } - isBB = me.isBorderBox(); - tbBorder = me.getBorderWidth('tb'); - lrBorder = me.getBorderWidth('lr'); - tbPadding = me.getPadding('tb'); - lrPadding = me.getPadding('lr'); + d = this.dom, + isDoc = (d == doc || d == doc.body); - // Width calcs - // Try the style first, then clientWidth, then offsetWidth - if (w = me.getStyle('width').match(pxMatch)){ - if ((w = parseInt(w[1], 10)) && isBB){ - // Style includes the padding and border if isBB - w -= (lrBorder + lrPadding); - } - if (!contentBox){ - w += lrPadding; + // If the body, use Ext.lib.Dom + if (isDoc) { + var extdom = Ext.lib.Dom; + return { + width : extdom.getViewWidth(), + height : extdom.getViewHeight() } + + // Else use clientHeight/clientWidth } else { - if (!(w = d.clientWidth) && (w = d.offsetWidth)){ - w -= lrBorder; - } - if (w && contentBox){ - w -= lrPadding; + return { + width : d.clientWidth, + height : d.clientHeight } } + }, - // Height calcs - // Try the style first, then clientHeight, then offsetHeight - if (h = me.getStyle('height').match(pxMatch)){ - if ((h = parseInt(h[1], 10)) && isBB){ - // Style includes the padding and border if isBB - h -= (tbBorder + tbPadding); - } - if (!contentBox){ - h += tbPadding; +
/** + *

Returns the dimensions of the element available to lay content out in.

+ * + * getStyleSize utilizes prefers style sizing if present, otherwise it chooses the larger of offsetHeight/clientHeight and offsetWidth/clientWidth. + * To obtain the size excluding scrollbars, use getViewSize + * + * Sizing of the document body is handled at the adapter level which handles special cases for IE and strict modes, etc. + */ + + getStyleSize : function(){ + var me = this, + w, h, + doc = document, + d = this.dom, + isDoc = (d == doc || d == doc.body), + s = d.style; + + // If the body, use Ext.lib.Dom + if (isDoc) { + var extdom = Ext.lib.Dom; + return { + width : extdom.getViewWidth(), + height : extdom.getViewHeight() } - } else { - if (!(h = d.clientHeight) && (h = d.offsetHeight)){ - h -= tbBorder; + } + // Use Styles if they are set + if(s.width && s.width != 'auto'){ + w = parseFloat(s.width); + if(me.isBorderBox()){ + w -= me.getFrameWidth('lr'); } - if (h && contentBox){ - h -= tbPadding; + } + // Use Styles if they are set + if(s.height && s.height != 'auto'){ + h = parseFloat(s.height); + if(me.isBorderBox()){ + h -= me.getFrameWidth('tb'); } } - - return { - width : w, - height : h - }; + // Use getWidth/getHeight if style not set. + return {width: w || me.getWidth(true), height: h || me.getHeight(true)}; },

/** @@ -366,7 +351,7 @@ Ext.Element.addMethods(function(){ if (!side) { for (key in me.margins){ - o[hash[key]] = parseInt(me.getStyle(me.margins[key]), 10) || 0; + o[hash[key]] = parseFloat(me.getStyle(me.margins[key])) || 0; } return o; } else {