flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [01/22] git commit: [flex-asjs] [refs/heads/develop] - try to not return 0. offsetHeight/Width can be zero if parents don't have size constraints enough to constrain a % calculation on an element
Date Fri, 09 Jan 2015 16:10:14 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 4644861a9 -> b5bcfc2ac


try to not return 0.  offsetHeight/Width can be zero if parents don't have size constraints
enough to constrain a % calculation on an element


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/8b357cff
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/8b357cff
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/8b357cff

Branch: refs/heads/develop
Commit: 8b357cff0749969b34d48f8f7d8fd71df9bc75d7
Parents: 942ef40
Author: Alex Harui <aharui@apache.org>
Authored: Tue Jan 6 21:36:28 2015 -0800
Committer: Alex Harui <aharui@apache.org>
Committed: Fri Jan 9 08:09:46 2015 -0800

----------------------------------------------------------------------
 .../js/FlexJS/src/org/apache/flex/core/UIBase.js      | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8b357cff/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js b/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js
index 3a35c6e..37265bc 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js
@@ -446,8 +446,13 @@ org.apache.flex.core.UIBase.prototype.get_width = function() {
   var pixels;
   var strpixels = this.positioner.style.width;
   pixels = parseFloat(strpixels);
-  if (isNaN(pixels))
+  if (isNaN(pixels)) {
     pixels = this.positioner.offsetWidth;
+    if (pixels == 0 && this.positioner.scrollWidth != 0) {
+      // invisible child elements cause offsetWidth to be 0.
+      pixels = this.positioner.scrollWidth;
+    }
+  }
   return pixels;
 };
 
@@ -511,8 +516,13 @@ org.apache.flex.core.UIBase.prototype.get_height = function() {
   var pixels;
   var strpixels = this.positioner.style.height;
   pixels = parseFloat(strpixels);
-  if (isNaN(pixels))
+  if (isNaN(pixels)) {
     pixels = this.positioner.offsetHeight;
+    if (pixels == 0 && this.positioner.scrollHeight != 0) {
+      // invisible child elements cause offsetHeight to be 0.
+      pixels = this.positioner.scrollHeight;
+    }
+  }
   return pixels;
 };
 


Mime
View raw message