handle units for left/right

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

Branch: refs/heads/core_js_to_as
Commit: e7c023589ed450556a6ff950c96124048624c00a
Parents: 019e958
Author: Alex Harui <[email protected]>
Authored: Thu Sep 10 14:10:39 2015 -0700
Committer: Alex Harui <[email protected]>
Committed: Thu Sep 10 14:14:17 2015 -0700

----------------------------------------------------------------------
 .../flex/html/beads/layouts/VerticalLayout.as      | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e7c02358/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/VerticalLayout.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/VerticalLayout.as
 
b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/VerticalLayout.as
index 53f60ce..675a586 100644
--- 
a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/VerticalLayout.as
+++ 
b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/layouts/VerticalLayout.as
@@ -28,10 +28,10 @@ package org.apache.flex.html.beads.layouts
        import org.apache.flex.core.ValuesManager;
        import org.apache.flex.events.Event;
        import org.apache.flex.events.IEventDispatcher;
-    import org.apache.flex.geom.Rectangle;
+       import org.apache.flex.geom.Rectangle;
+       import org.apache.flex.utils.CSSContainerUtils;
+       import org.apache.flex.utils.CSSUtils;
        import org.apache.flex.utils.dbg.DOMPathUtil;
-    import org.apache.flex.utils.CSSUtils;
-    import org.apache.flex.utils.CSSContainerUtils;
        
        /**
         *  The VerticalLayout class is a simple layout
@@ -93,6 +93,7 @@ package org.apache.flex.html.beads.layouts
                        var marginBottom:Object;
                        var margin:Object;
                        var maxWidth:Number = 0;
+            var cssValue:*;
                        // asking for contentView.width can result in infinite 
loop if host isn't sized already
                        var w:Number = hostSizedToContent ? 0 : 
contentView.width;
             var h:Number = contentView.height;
@@ -102,8 +103,14 @@ package org.apache.flex.html.beads.layouts
                                var child:IUIBase = contentView.getElementAt(i) 
as IUIBase;
                                if (child == null || !child.visible) continue;
                                ilc = child as ILayoutChild;
-                               var left:Number = 
ValuesManager.valuesImpl.getValue(child, "left");
-                               var right:Number = 
ValuesManager.valuesImpl.getValue(child, "right");
+                               var left:Number = NaN;
+                cssValue = ValuesManager.valuesImpl.getValue(child, "left");
+                if (cssValue !== undefined)
+                    left = CSSUtils.toNumber(cssValue);
+                var right:Number = NaN;
+                cssValue = ValuesManager.valuesImpl.getValue(child, "right");
+                if (cssValue !== undefined)
+                    right = CSSUtils.toNumber(cssValue);
                                margin = 
ValuesManager.valuesImpl.getValue(child, "margin");
                 marginLeft = ValuesManager.valuesImpl.getValue(child, 
"margin-left");
                 marginTop = ValuesManager.valuesImpl.getValue(child, 
"margin-top");

Reply via email to