You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by li...@apache.org on 2009/07/31 19:57:45 UTC
svn commit: r799676 -
/incubator/shindig/trunk/features/src/main/javascript/features/dynamic-height/dynamic-height.js
Author: lindner
Date: Fri Jul 31 17:57:45 2009
New Revision: 799676
URL: http://svn.apache.org/viewvc?rev=799676&view=rev
Log:
SHINDIG-1129 | Patch from Michael Hermanto | Dynamic height is over-calculated for Webkit-based browsers
Modified:
incubator/shindig/trunk/features/src/main/javascript/features/dynamic-height/dynamic-height.js
Modified: incubator/shindig/trunk/features/src/main/javascript/features/dynamic-height/dynamic-height.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/dynamic-height/dynamic-height.js?rev=799676&r1=799675&r2=799676&view=diff
==============================================================================
--- incubator/shindig/trunk/features/src/main/javascript/features/dynamic-height/dynamic-height.js (original)
+++ incubator/shindig/trunk/features/src/main/javascript/features/dynamic-height/dynamic-height.js Fri Jul 31 17:57:45 2009
@@ -61,14 +61,15 @@
for (var i = 0; i < children.length; i++) {
if (typeof children[i].offsetTop !== 'undefined' &&
typeof children[i].scrollHeight !== 'undefined') {
+ // scrollHeight already accounts for border-bottom and padding-bottom.
var bottom = children[i].offsetTop + children[i].scrollHeight
- + parseIntFromElemPxAttribute(children[i], "margin-bottom")
- + parseIntFromElemPxAttribute(children[i], "padding-bottom");
+ + parseIntFromElemPxAttribute(children[i], "margin-bottom");
result = Math.max(result, bottom);
}
}
- // Add margin and padding height specificed in the body (if any).
+ // Add border, padding and margin of the containing body.
return result
+ + parseIntFromElemPxAttribute(document.body, "border-bottom")
+ parseIntFromElemPxAttribute(document.body, "margin-bottom")
+ parseIntFromElemPxAttribute(document.body, "padding-bottom");
}
@@ -114,8 +115,7 @@
// In Webkit:
// Property scrollHeight and offsetHeight will only increase in value.
// This will incorrectly calculate reduced height of a gadget
- // (ie: made smaller). These properties also do not account margin and
- // padding size of an element.
+ // (ie: made smaller).
newHeight = getHeightForWebkit();
} else if (body && docEl) {
// In Quirks mode: