flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - Removed multiple instances of "determinePadding()" function and replaced with BeadMetrics.getMetrics() which not only determines padding, but includes border thickness as well.
Date Mon, 01 Jun 2015 20:25:25 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop edb427541 -> 673964aba


Removed multiple instances of "determinePadding()" function and replaced with BeadMetrics.getMetrics()
which not only determines padding, but includes border thickness as well.


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

Branch: refs/heads/develop
Commit: 673964aba4b105f0dfb3ef26e0c0e25761009c38
Parents: edb4275
Author: Peter Ent <pent@apache.org>
Authored: Mon Jun 1 16:25:15 2015 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Mon Jun 1 16:25:15 2015 -0400

----------------------------------------------------------------------
 .../Core/as/src/org/apache/flex/core/UIBase.as  | 63 ++-------------
 .../as/src/org/apache/flex/core/UIButtonBase.as | 63 ++-------------
 .../as/src/org/apache/flex/utils/BeadMetrics.as | 35 ++++++---
 .../org/apache/flex/html/beads/ContainerView.as | 81 ++++----------------
 .../src/org/apache/flex/html/beads/PanelView.as |  8 +-
 .../flex/html/beads/PanelWithControlBarView.as  | 20 ++---
 .../supportClasses/TextFieldItemRenderer.as     | 64 ++--------------
 7 files changed, 70 insertions(+), 264 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/673964ab/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as b/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as
index 1fcac17..eb5d272 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as
@@ -26,6 +26,7 @@ package org.apache.flex.core
 	import org.apache.flex.events.IEventDispatcher;
 	import org.apache.flex.events.MouseEvent;
 	import org.apache.flex.events.utils.MouseEventConverter;
+	import org.apache.flex.utils.BeadMetrics;
 	
 	/**
 	 *  Set a different class for click events so that
@@ -324,8 +325,8 @@ package org.apache.flex.core
 			{
 				var w:Number = _width;
 				if (isNaN(w)) w = $width;
-				var padding:Object = determinePadding();
-				return w + padding.paddingLeft + padding.paddingRight;
+				var metrics:UIMetrics = BeadMetrics.getMetrics(this);
+				return w + metrics.left + metrics.right;
 			}
 			else
 				return explicitWidth;
@@ -379,8 +380,8 @@ package org.apache.flex.core
 			{
 				var h:Number = _height;
 				if (isNaN(h)) h = $height;
-				var padding:Object = determinePadding();
-				return h + padding.paddingTop + padding.paddingBottom;
+				var metrics:UIMetrics = BeadMetrics.getMetrics(this);
+				return h + metrics.top + metrics.bottom;
 			}
 			else
 				return explicitHeight;
@@ -521,60 +522,6 @@ package org.apache.flex.core
         }
 		
 		/**
-		 *  Determines the top and left padding values, if any, as set by
-		 *  padding style values. This includes "padding" for all padding values
-		 *  as well as "padding-left" and "padding-top".
-		 * 
-		 *  Returns an object with paddingLeft and paddingTop properties.
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		protected function determinePadding():Object
-		{
-			var paddingLeft:Object;
-			var paddingTop:Object;
-			var paddingRight:Object;
-			var paddingBottom:Object;
-			var padding:Object = ValuesManager.valuesImpl.getValue(this, "padding");
-			if (padding is Array)
-			{
-				if (padding.length == 1)
-					paddingLeft = paddingTop = padding[0];
-				else if (padding.length <= 3)
-				{
-					paddingLeft = padding[1];
-					paddingTop = padding[0];
-				}
-				else if (padding.length == 4)
-				{
-					paddingLeft = padding[3];
-					paddingTop = padding[0];					
-				}
-			}
-			else if (padding == null)
-			{
-				paddingLeft = ValuesManager.valuesImpl.getValue(this, "padding-left");
-				paddingTop = ValuesManager.valuesImpl.getValue(this, "padding-top");
-				paddingRight = ValuesManager.valuesImpl.getValue(this, "padding-right");
-				paddingBottom = ValuesManager.valuesImpl.getValue(this, "padding-bottom");
-			}
-			else
-			{
-				paddingLeft = paddingTop = padding;
-				paddingRight = paddingBottom = padding;
-			}
-			var pl:Number = Number(paddingLeft);
-			var pt:Number = Number(paddingTop);
-			var pr:Number = Number(paddingRight);
-			var pb:Number = Number(paddingBottom);
-			
-			return {paddingLeft:pl, paddingTop:pt, paddingRight:pr, paddingBottom:pb};
-		}
-		
-		/**
 		 * @private
 		 */
 		override public function set visible(value:Boolean):void

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/673964ab/frameworks/projects/Core/as/src/org/apache/flex/core/UIButtonBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/UIButtonBase.as b/frameworks/projects/Core/as/src/org/apache/flex/core/UIButtonBase.as
index daad54b..5a93300 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/UIButtonBase.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/UIButtonBase.as
@@ -30,6 +30,7 @@ package org.apache.flex.core
 	import org.apache.flex.events.Event;
     import org.apache.flex.events.utils.MouseEventConverter;
 	import org.apache.flex.events.IEventDispatcher;
+	import org.apache.flex.utils.BeadMetrics;
 	
     //--------------------------------------
     //  Events
@@ -279,8 +280,8 @@ package org.apache.flex.core
 			{
 				var w:Number = _width;
 				if (isNaN(w)) w = $width;
-				var padding:Object = determinePadding();
-				return w + padding.paddingLeft + padding.paddingRight;
+				var metrics:UIMetrics = BeadMetrics.getMetrics(this);
+				return w + metrics.left + metrics.right;
 			}
 			else
 				return explicitWidth;
@@ -330,8 +331,8 @@ package org.apache.flex.core
 			{
 				var h:Number = _height;
 				if (isNaN(h)) h = $height;
-				var padding:Object = determinePadding();
-				return h + padding.paddingTop + padding.paddingBottom;
+				var metrics:UIMetrics = BeadMetrics.getMetrics(this);
+				return h + metrics.top + metrics.bottom;
 			}
 			else
 				return explicitHeight;
@@ -461,60 +462,6 @@ package org.apache.flex.core
         {
             return (isNaN(_explicitHeight) && isNaN(_percentHeight));
         }
-		
-		/**
-		 *  Determines the top and left padding values, if any, as set by
-		 *  padding style values. This includes "padding" for all padding values
-		 *  as well as "padding-left" and "padding-top".
-		 * 
-		 *  Returns an object with paddingLeft and paddingTop properties.
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		protected function determinePadding():Object
-		{
-			var paddingLeft:Object;
-			var paddingTop:Object;
-			var paddingRight:Object;
-			var paddingBottom:Object;
-			var padding:Object = ValuesManager.valuesImpl.getValue(this, "padding");
-			if (padding is Array)
-			{
-				if (padding.length == 1)
-					paddingLeft = paddingTop = padding[0];
-				else if (padding.length <= 3)
-				{
-					paddingLeft = padding[1];
-					paddingTop = padding[0];
-				}
-				else if (padding.length == 4)
-				{
-					paddingLeft = padding[3];
-					paddingTop = padding[0];					
-				}
-			}
-			else if (padding == null)
-			{
-				paddingLeft = ValuesManager.valuesImpl.getValue(this, "padding-left");
-				paddingTop = ValuesManager.valuesImpl.getValue(this, "padding-top");
-				paddingRight = ValuesManager.valuesImpl.getValue(this, "padding-right");
-				paddingBottom = ValuesManager.valuesImpl.getValue(this, "padding-bottom");
-			}
-			else
-			{
-				paddingLeft = paddingTop = padding;
-				paddingRight = paddingBottom = padding;
-			}
-			var pl:Number = Number(paddingLeft);
-			var pt:Number = Number(paddingTop);
-			var pr:Number = Number(paddingRight);
-			var pb:Number = Number(paddingBottom);
-			
-			return {paddingLeft:pl, paddingTop:pt, paddingRight:pr, paddingBottom:pb};
-		}
         
         private var _model:IBeadModel;
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/673964ab/frameworks/projects/Core/as/src/org/apache/flex/utils/BeadMetrics.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/utils/BeadMetrics.as b/frameworks/projects/Core/as/src/org/apache/flex/utils/BeadMetrics.as
index cdf267b..94d6b94 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/utils/BeadMetrics.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/utils/BeadMetrics.as
@@ -18,7 +18,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.utils
 {
-import org.apache.flex.core.IStrand;
 import org.apache.flex.core.UIMetrics;
 import org.apache.flex.core.ValuesManager;
 
@@ -38,7 +37,7 @@ public class BeadMetrics
      *  Compute the offset of the content
      *  in a container based on border-thickness and padding styles.  
      *  
-     *  @param strand The host strand.
+     *  @param object The object with style values.
      *  @return The offsets of the content.
      * 
      *  @langversion 3.0
@@ -46,9 +45,9 @@ public class BeadMetrics
      *  @playerversion AIR 2.6
      *  @productversion FlexJS 0.0
      */
-	public static function getMetrics(strand:IStrand) : UIMetrics
+	public static function getMetrics(object:Object) : UIMetrics
 	{
-		var borderThickness:Object = ValuesManager.valuesImpl.getValue(strand,"border-thickness");
+		var borderThickness:Object = ValuesManager.valuesImpl.getValue(object,"border-thickness");
 		var borderOffset:Number;
 		if( borderThickness == null ) {
 			borderOffset = 0;
@@ -60,39 +59,51 @@ public class BeadMetrics
 		
 		var paddingLeft:Object;
 		var paddingTop:Object;
-		var padding:Object = ValuesManager.valuesImpl.getValue(strand, "padding");
+		var paddingRight:Object;
+		var paddingBottom:Object;
+		
+		var padding:Object = ValuesManager.valuesImpl.getValue(object, "padding");
 		if (padding is Array)
 		{
 			if (padding.length == 1)
 				paddingLeft = paddingTop = padding[0];
 			else if (padding.length <= 3)
 			{
-				paddingLeft = padding[1];
 				paddingTop = padding[0];
+				paddingLeft = padding[1];
+				paddingBottom = padding[0];
+				paddingRight = padding[1];
 			}
 			else if (padding.length == 4)
 			{
-				paddingLeft = padding[3];
-				paddingTop = padding[0];					
+				paddingTop = padding[0];
+				paddingLeft = padding[1];
+				paddingBottom = padding[2];
+				paddingRight = padding[3];					
 			}
 		}
 		else if (padding == null)
 		{
-			paddingLeft = ValuesManager.valuesImpl.getValue(strand, "padding-left");
-			paddingTop = ValuesManager.valuesImpl.getValue(strand, "padding-top");
+			paddingLeft = ValuesManager.valuesImpl.getValue(object, "padding-left");
+			paddingTop = ValuesManager.valuesImpl.getValue(object, "padding-top");
+			paddingRight = ValuesManager.valuesImpl.getValue(object, "padding-right");
+			paddingBottom = ValuesManager.valuesImpl.getValue(object, "padding-bottom");
 		}
 		else
 		{
 			paddingLeft = paddingTop = padding;
+			paddingRight = paddingBottom = padding;
 		}
 		var pl:Number = Number(paddingLeft);
 		var pt:Number = Number(paddingTop);
+		var pr:Number = Number(paddingRight);
+		var pb:Number = Number(paddingBottom);
 		
 		var result:UIMetrics = new UIMetrics();
 		result.top = borderOffset + pt;
 		result.left = borderOffset + pl;
-		result.bottom = borderOffset + pt;
-		result.right = borderOffset + pl;
+		result.bottom = borderOffset + pb;
+		result.right = borderOffset + pr;
 		
 		return result;
 	}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/673964ab/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as
index 5798519..cb43044 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ContainerView.as
@@ -27,6 +27,7 @@ package org.apache.flex.html.beads
     import org.apache.flex.core.IParentIUIBase;
     import org.apache.flex.core.IStrand;
     import org.apache.flex.core.IUIBase;
+	import org.apache.flex.core.UIMetrics;
     import org.apache.flex.core.UIBase;
     import org.apache.flex.core.ValuesManager;
     import org.apache.flex.events.Event;
@@ -34,6 +35,7 @@ package org.apache.flex.html.beads
     import org.apache.flex.html.supportClasses.Border;
     import org.apache.flex.html.supportClasses.ContainerContentArea;
     import org.apache.flex.html.supportClasses.ScrollBar;
+	import org.apache.flex.utils.BeadMetrics;
 	
     /**
      *  The ContainerView class is the default view for
@@ -192,17 +194,17 @@ package org.apache.flex.html.beads
                 }
             }
             
-			var padding:Object = determinePadding();
+			var metrics:UIMetrics = determineMetrics();
 			
 			if (checkActualParent())
 			{
-				actualParent.x = padding.paddingLeft;
-				actualParent.y = padding.paddingTop;
+				actualParent.x = metrics.left;
+				actualParent.y = metrics.top;
             }
-            var pb:Number = padding.paddingBottom;
+            var pb:Number = metrics.bottom;
             if (isNaN(pb))
                 pb = 0;
-            var pr:Number = padding.paddingRight;
+            var pr:Number = metrics.right;
             if (isNaN(pr))
                 pr = 0;
 			
@@ -292,60 +294,6 @@ package org.apache.flex.html.beads
 		}
 		
 		/**
-		 *  Determines the top and left padding values, if any, as set by
-		 *  padding style values. This includes "padding" for all padding values
-		 *  as well as "padding-left" and "padding-top".
-		 * 
-		 *  Returns an object with paddingLeft and paddingTop properties.
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		protected function determinePadding():Object
-		{
-			var paddingLeft:Object;
-			var paddingTop:Object;
-			var paddingRight:Object;
-			var paddingBottom:Object;
-			var padding:Object = ValuesManager.valuesImpl.getValue(_strand, "padding");
-			if (padding is Array)
-			{
-				if (padding.length == 1)
-					paddingLeft = paddingTop = padding[0];
-				else if (padding.length <= 3)
-				{
-					paddingLeft = padding[1];
-					paddingTop = padding[0];
-				}
-				else if (padding.length == 4)
-				{
-					paddingLeft = padding[3];
-					paddingTop = padding[0];					
-				}
-			}
-			else if (padding == null)
-			{
-				paddingLeft = ValuesManager.valuesImpl.getValue(_strand, "padding-left");
-				paddingTop = ValuesManager.valuesImpl.getValue(_strand, "padding-top");
-				paddingRight = ValuesManager.valuesImpl.getValue(_strand, "padding-right");
-				paddingBottom = ValuesManager.valuesImpl.getValue(_strand, "padding-bottom");
-			}
-			else
-			{
-				paddingLeft = paddingTop = padding;
-				paddingRight = paddingBottom = padding;
-			}
-			var pl:Number = Number(paddingLeft);
-			var pt:Number = Number(paddingTop);
-			var pr:Number = Number(paddingRight);
-			var pb:Number = Number(paddingBottom);
-			
-			return {paddingLeft:pl, paddingTop:pt, paddingRight:pr, paddingBottom:pb};
-		}
-		
-		/**
 		 *  Returns true if container to create a separate ContainerContentArea.
 		 *  
 		 *  @langversion 3.0
@@ -355,10 +303,10 @@ package org.apache.flex.html.beads
 		 */
 		protected function contentAreaNeeded():Boolean
 		{
-			var padding:Object = determinePadding();
+			var metrics:UIMetrics = determineMetrics();
 			
-			return (!isNaN(padding.paddingLeft) && padding.paddingLeft > 0 ||
-				    !isNaN(padding.paddingTop) && padding.paddingTop > 0);
+			return (!isNaN(metrics.left) && metrics.left > 0 ||
+				    !isNaN(metrics.top) && metrics.top > 0);
 		}
 		
         /**
@@ -425,8 +373,8 @@ package org.apache.flex.html.beads
             if (inGetViewWidth)
             {
                 //trace("ContainerView: no width set for " + host);
-				var padding:Object = determinePadding();
-                return host["$width"] + padding.paddingLeft + padding.paddingRight;
+				var metrics:UIMetrics = determineMetrics();
+                return host["$width"] + metrics.left + metrics.right;
             }
             inGetViewWidth = true;
 			var vw:Number = contentView.width;
@@ -434,5 +382,10 @@ package org.apache.flex.html.beads
 			return vw;
 		}
 		
+		protected function determineMetrics():UIMetrics
+		{
+			return BeadMetrics.getMetrics(_strand);
+		}
+		
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/673964ab/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as
index c67347f..f7303e7 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelView.as
@@ -119,12 +119,12 @@ package org.apache.flex.html.beads
         /**
          * @private
          */
-        override protected function determinePadding():Object
+        override protected function determineMetrics():UIMetrics
         {
-            var paddings:Object = super.determinePadding();
+            var metrics:UIMetrics = super.determineMetrics();
             titleBar.width = UIBase(_strand).width;
-            paddings.paddingTop += titleBar.height;
-            return paddings;
+            metrics.top += titleBar.height;
+            return metrics;
         }
                 
 	}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/673964ab/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as
b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as
index 3c46544..69645fb 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/PanelWithControlBarView.as
@@ -151,16 +151,16 @@ package org.apache.flex.html.beads
 		/**
 		 * @private
 		 */
-		override protected function determinePadding():Object
+		override protected function determineMetrics():UIMetrics
 		{
-			var paddings:Object = super.determinePadding();
+			var metrics:UIMetrics = super.determineMetrics();
 			titleBar.width = UIBase(_strand).width;
-			paddings.paddingTop += titleBar.height;
+			metrics.top += titleBar.height;
 			
 			controlBar.width = UIBase(_strand).width;
-			paddings.paddingBottom += controlBar.height;
+			metrics.bottom += controlBar.height;
 
-			return paddings;
+			return metrics;
 		}
 		
 		/**
@@ -178,7 +178,7 @@ package org.apache.flex.html.beads
 		 */
 		private function layoutChromeElements():void
 		{
-			var paddings:Object = determinePadding();
+			var metrics:UIMetrics = determineMetrics();
 			titleBar.x = 0;
 			titleBar.y = 0;
 			titleBar.width = UIBase(_strand).width;
@@ -189,10 +189,10 @@ package org.apache.flex.html.beads
 				controlBar.width = UIBase(_strand).width;
 			}
 			
-			actualParent.x = paddings.paddingLeft;
-			actualParent.y = titleBar.height + paddings.paddingTop;
-			actualParent.width = UIBase(_strand).width - paddings.paddingLeft - paddings.paddingRight;
-			actualParent.height = UIBase(_strand).height - titleBar.height - paddings.paddingTop -
paddings.paddingBottom;
+			actualParent.x = metrics.left;
+			actualParent.y = titleBar.height + metrics.top;
+			actualParent.width = UIBase(_strand).width - metrics.left - metrics.right;
+			actualParent.height = UIBase(_strand).height - titleBar.height - metrics.top - metrics.bottom;
 			if (controlBar) actualParent.height -= controlBar.height;
 		}
 	}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/673964ab/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/TextFieldItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/TextFieldItemRenderer.as
b/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/TextFieldItemRenderer.as
index 298b66e..fc197c1 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/TextFieldItemRenderer.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/TextFieldItemRenderer.as
@@ -25,6 +25,7 @@ package org.apache.flex.html.supportClasses
     import org.apache.flex.core.IBeadController;
     import org.apache.flex.core.IStrand;
     import org.apache.flex.core.IUIBase;
+	import org.apache.flex.core.UIMetrics;
     import org.apache.flex.core.UIBase;
     import org.apache.flex.core.ValuesManager;
     import org.apache.flex.events.Event;
@@ -32,6 +33,7 @@ package org.apache.flex.html.supportClasses
     import org.apache.flex.events.MouseEvent;
     import org.apache.flex.events.utils.MouseEventConverter;
     import org.apache.flex.html.beads.ITextItemRenderer;
+	import org.apache.flex.utils.BeadMetrics;
 	
 	/**
 	 *  The TextFieldItemRenderer class provides a org.apache.flex.html.TextField as an itemRenderer.
@@ -227,8 +229,8 @@ package org.apache.flex.html.supportClasses
 			{
 				var w:Number = _width;
 				if (isNaN(w)) w = $width;
-				var padding:Object = determinePadding();
-				return w + padding.paddingLeft + padding.paddingRight;
+				var metrics:UIMetrics = BeadMetrics.getMetrics(this);
+				return w + metrics.left + metrics.right;
 			}
 			else
 				return explicitWidth;
@@ -265,8 +267,8 @@ package org.apache.flex.html.supportClasses
 			{
 				var h:Number = _height;
 				if (isNaN(h)) h = $height;
-				var padding:Object = determinePadding();
-				return h + padding.paddingTop + padding.paddingBottom;
+				var metrics:UIMetrics = BeadMetrics.getMetrics(this);
+				return h + metrics.top + metrics.bottom;
 			}
 			else
 				return explicitHeight;
@@ -292,60 +294,6 @@ package org.apache.flex.html.supportClasses
         {
             return super.height;
         }
-		
-		/**
-		 *  Determines the top and left padding values, if any, as set by
-		 *  padding style values. This includes "padding" for all padding values
-		 *  as well as "padding-left" and "padding-top".
-		 * 
-		 *  Returns an object with paddingLeft and paddingTop properties.
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		protected function determinePadding():Object
-		{
-			var paddingLeft:Object;
-			var paddingTop:Object;
-			var paddingRight:Object;
-			var paddingBottom:Object;
-			var padding:Object = ValuesManager.valuesImpl.getValue(this, "padding");
-			if (padding is Array)
-			{
-				if (padding.length == 1)
-					paddingLeft = paddingTop = padding[0];
-				else if (padding.length <= 3)
-				{
-					paddingLeft = padding[1];
-					paddingTop = padding[0];
-				}
-				else if (padding.length == 4)
-				{
-					paddingLeft = padding[3];
-					paddingTop = padding[0];					
-				}
-			}
-			else if (padding == null)
-			{
-				paddingLeft = ValuesManager.valuesImpl.getValue(this, "padding-left");
-				paddingTop = ValuesManager.valuesImpl.getValue(this, "padding-top");
-				paddingRight = ValuesManager.valuesImpl.getValue(this, "padding-right");
-				paddingBottom = ValuesManager.valuesImpl.getValue(this, "padding-bottom");
-			}
-			else
-			{
-				paddingLeft = paddingTop = padding;
-				paddingRight = paddingBottom = padding;
-			}
-			var pl:Number = Number(paddingLeft);
-			var pt:Number = Number(paddingTop);
-			var pr:Number = Number(paddingRight);
-			var pb:Number = Number(paddingBottom);
-			
-			return {paddingLeft:pl, paddingTop:pt, paddingRight:pr, paddingBottom:pb};
-		}
 
 		/**
 		 *  The String(data) for the itemRenderer instance.


Mime
View raw message