You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2015/06/22 22:22:06 UTC

git commit: [flex-asjs] [refs/heads/develop] - Fixed logic issues with Panels.

Repository: flex-asjs
Updated Branches:
  refs/heads/develop 9787ce247 -> e325df03e


Fixed logic issues with Panels.


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

Branch: refs/heads/develop
Commit: e325df03ee416d6118170295c6729b6ae554e3d5
Parents: 9787ce2
Author: Peter Ent <pe...@apache.org>
Authored: Mon Jun 22 16:21:07 2015 -0400
Committer: Peter Ent <pe...@apache.org>
Committed: Mon Jun 22 16:21:07 2015 -0400

----------------------------------------------------------------------
 .../src/org/apache/flex/core/IViewportModel.as  |   7 ++
 .../org/apache/flex/html/beads/ContainerView.as |  74 +++++++-----
 .../src/org/apache/flex/html/beads/PanelView.as | 106 ++++++++++++++---
 .../flex/html/beads/PanelWithControlBarView.as  | 117 +++++++++++++++----
 .../flex/html/beads/models/ViewportModel.as     |  10 ++
 .../html/supportClasses/ScrollingViewport.as    |  10 +-
 .../apache/flex/html/supportClasses/Viewport.as |  11 +-
 7 files changed, 254 insertions(+), 81 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e325df03/frameworks/projects/Core/as/src/org/apache/flex/core/IViewportModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/IViewportModel.as b/frameworks/projects/Core/as/src/org/apache/flex/core/IViewportModel.as
index 4ce51d0..e625a7d 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/IViewportModel.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/IViewportModel.as
@@ -10,6 +10,13 @@ package org.apache.flex.core
 		// Layout and Content
 		
 		/**
+		 * Returns true (or set to true) when the contentArea is
+		 * actually the same as the host strand.
+		 */
+		function get contentIsHost():Boolean;
+		function set contentIsHost(value:Boolean):void;
+		
+		/**
 		 * The layout being used to size and shape the content area
 		 */
 		function get layout():IBeadLayout;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e325df03/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 6470276..b02d904 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
@@ -108,13 +108,12 @@ package org.apache.flex.html.beads
 			_strand = value;
 			
 			var host:UIBase = value as UIBase;
-			var metrics:UIMetrics = getMetrics();
-			
-			checkActualParent(true);
 			
-			createViewport(metrics);
+			// determines if an offset child will act as the parent; this
+			// happens when there is padding or chrome elements.
+			checkActualParent(false);
 			
-			viewport.updateContentAreaSize();
+			createViewport(getMetrics());
 			
 			if (!host.isWidthSizedToContent() && !host.isHeightSizedToContent()) {
 				displayBackgroundAndBorder(host);
@@ -137,7 +136,9 @@ package org.apache.flex.html.beads
 		 */
 		protected function createViewport(metrics:UIMetrics):void
 		{
-			viewportModel = new ViewportModel();
+			if (viewportModel == null) {
+				viewportModel = new ViewportModel();
+			}
 			
 			// the viewport takes the entire space as there is no default chrome.
 			// if chrome children get added the viewport will need to be adjusted
@@ -154,9 +155,8 @@ package org.apache.flex.html.beads
 			viewportModel.contentX = viewportModel.viewportX + metrics.left;
 			viewportModel.contentY = viewportModel.viewportY + metrics.top;
 			
-			viewportModel.horizontalScrollPosition = 0;
-			viewportModel.verticalScrollPosition = 0;
 			viewportModel.contentArea = actualParent;
+			viewportModel.contentIsHost = actualParent == UIBase(_strand);
 			
 			if (viewport == null) {
 				viewport = _strand.getBeadByType(IViewport) as IViewport;
@@ -175,9 +175,10 @@ package org.apache.flex.html.beads
 				viewport.model = viewportModel;
 			}
 		}
+		
 				
 		/**
-		 * Event handler invoked whenever the size or children are added.
+		 * Event handler invoked whenever the size or children are added/removed
          *  
          *  @langversion 3.0
          *  @playerversion Flash 10.2
@@ -208,7 +209,16 @@ package org.apache.flex.html.beads
 			// model's content size properties. 
 			if (viewport.runLayout()) 
 			{
+				// remove size change handlers so that any size changes internally
+				// are not picked up and processed which could result in an infinite
+				// chain of events.
+//				host.removeEventListener("widthChanged", resizeHandler);
+//				host.removeEventListener("heightChanged", resizeHandler);
+				
 				handleContentResize();
+				
+//				host.addEventListener("widthChanged", resizeHandler);
+//				host.addEventListener("heightChanged", resizeHandler);
 			}			
 			
 			// update the contentArea so that it exposes all of the items as placed
@@ -218,42 +228,48 @@ package org.apache.flex.html.beads
 			displayBackgroundAndBorder(host);
 		}
 		
+		/**
+		 * This function guides the resizing of the container and/or its viewport,
+		 * depending on the constraints on the container's size (being sized by
+		 * its content or sized externally).
+		 */
 		protected function handleContentResize():void
 		{
 			var host:UIBase = UIBase(_strand);
+			var metrics:UIMetrics = getMetrics();
 			
 			// If the host is being sized by its content, the change in the contentArea
 			// causes the host's size to change
 			if (host.isWidthSizedToContent() && host.isHeightSizedToContent()) {					
 				host.setWidthAndHeight(viewportModel.contentWidth, viewportModel.contentHeight, true);
 				
-				viewportModel.viewportHeight = host.height;
-				viewportModel.viewportWidth  = host.width;				
+				viewportModel.viewportHeight = viewportModel.contentHeight + metrics.top + metrics.bottom;
+				viewportModel.viewportWidth  = viewportModel.contentWidth + metrics.left + metrics.right;
 			}
 				
-				// if the width is fixed and the height is changing, then set up horizontal
-				// scrolling (if the viewport supports it).
+			// if the width is fixed and the height is changing, then set up horizontal
+			// scrolling (if the viewport supports it).
 			else if (!host.isWidthSizedToContent() && host.isHeightSizedToContent())
 			{
 				viewport.needsHorizontalScroller();
 				
 				host.setHeight(viewportModel.contentHeight, false);
-				viewportModel.viewportHeight = host.height;
+				viewportModel.viewportHeight = viewportModel.contentHeight + metrics.top + metrics.bottom;
 				
 			}
 				
-				// if the height is fixed and the width can change, then set up
-				// vertical scrolling (if the viewport supports it).
+			// if the height is fixed and the width can change, then set up
+			// vertical scrolling (if the viewport supports it).
 			else if (host.isWidthSizedToContent() && !host.isHeightSizedToContent())
 			{
 				viewport.needsVerticalScroller();
 				
 				host.setWidth(viewportModel.contentWidth+viewport.scrollerWidth(), false);
-				viewportModel.viewportWidth = host.width;
+				viewportModel.viewportWidth = viewportModel.contentWidth + metrics.left + metrics.right + viewport.scrollerWidth();
 			}
 				
-				// Otherwise the viewport needs to display some scrollers (or other elements
-				// allowing the rest of the contentArea to be visible)
+			// Otherwise the viewport needs to display some scrollers (or other elements
+			// allowing the rest of the contentArea to be visible)
 			else {
 				
 				viewport.needsScrollers();
@@ -263,24 +279,28 @@ package org.apache.flex.html.beads
 		/**
 		 * @private
 		 */
-		private function resizeHandler(event:Event):void
+		protected function resizeHandler(event:Event):void
 		{
-//			if (event.currentTarget == _strand) {
-//				return;
-//			}
-			
 			var host:UIBase = UIBase(_strand);
-			trace("host is now "+host.width + " x " +host.height);
 			
+			// the viewport has to be adjusted to account for the change
+			// in the host size.			
 			viewportModel.viewportHeight = host.height;
 			viewportModel.viewportWidth = host.width;
 			
+			// if the host has a fixed width, reset the contentWidth to match.
 			if (!host.isWidthSizedToContent()) viewportModel.contentWidth = host.width;
-			if (!host.isHeightSizedToContent()) viewportModel.contentHeight = host.height;
 			
-			changeHandler(event);
+			// if the host has a fixed height, reset the contentHeight to match.
+			if (!host.isHeightSizedToContent()) viewportModel.contentHeight = host.height;
 			
+			// the viewport's size and position also has to be adjusted since the
+			// host's size has changed.
 			viewport.updateSize();
+			
+			// the layout needs to be run to adjust the content for 
+			// the new host size.
+			changeHandler(event);
 		}
 		
 		/**

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e325df03/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 7004b6d..c35fb9c 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
@@ -94,22 +94,27 @@ package org.apache.flex.html.beads
             
             if (!_titleBar)
                 _titleBar = new TitleBar();
-            _titleBar.percentWidth = 100;
 			// replace the TitleBar's model with the Panel's model (it implements ITitleBarModel) so that
 			// any changes to values in the Panel's model that correspond values in the TitleBar will 
 			// be picked up automatically by the TitleBar.
 			titleBar.model = host.model;
 			host.addElement(titleBar, false);
 			titleBar.addEventListener("heightChanged", titleBarHeightChanged);
-            if (isNaN(host.explicitWidth) && isNaN(host.percentWidth))
-                titleBar.addEventListener("widthChanged", changeHandler);
-			
-			trace("TitleBar's height: "+titleBar.height);
-            
+			            
             super.strand = value;
 
 		}
 		
+		/**
+		 * Creates the viewport for panel by first using the super.createViewport to get
+		 * a baseline, then adjusts the viewport to account for the title bar.
+		 */
+		override protected function createViewport(metrics:UIMetrics):void
+		{
+			super.createViewport(metrics);
+			setupViewport(metrics);
+		}
+		
 		private function setupViewport(metrics:UIMetrics):void
 		{
 			var host:UIBase = UIBase(_strand);
@@ -127,24 +132,91 @@ package org.apache.flex.html.beads
 			model.contentHeight = model.viewportHeight - metrics.top - metrics.bottom;
 		}
 		
-		override protected function createViewport(metrics:UIMetrics):void
-		{
-			super.createViewport(metrics);
-			setupViewport(metrics);
-		}
-		
+		/**
+		 * This function is called when the layout has changed the size of the contentArea
+		 * (aka, actualParent). Depending on how the Panel is being sized, the contentArea
+		 * affects how the panel is presented.
+		 */
 		override protected function handleContentResize():void
 		{
-			super.handleContentResize();
-			
 			var host:UIBase = UIBase(_strand);
+			var viewportModel:IViewportModel = viewport.model;
+			
+			titleBar.x = 0;
+			titleBar.y = 0;
 			titleBar.width = host.width;
+			
+			// If the host is being sized by its content, the change in the contentArea
+			// causes the host's size to change
+			if (host.isWidthSizedToContent() && host.isHeightSizedToContent()) {
+				host.setWidthAndHeight(viewportModel.contentWidth, viewportModel.contentHeight + titleBar.height, false);
+				
+				titleBar.setWidth(host.width, true);
+				
+				var metrics:UIMetrics = getMetrics();
+				
+				viewportModel.viewportHeight = viewportModel.contentHeight + metrics.top + metrics.bottom;
+				viewportModel.viewportWidth  = viewportModel.contentWidth + metrics.left + metrics.right;
+			}
+				
+			// if the width is fixed and the height is changing, then set up horizontal
+			// scrolling (if the viewport supports it).
+			else if (!host.isWidthSizedToContent() && host.isHeightSizedToContent())
+			{
+				viewport.needsHorizontalScroller();
+				
+				metrics = getMetrics();
+				
+				host.setHeight(viewportModel.contentHeight + titleBar.height, false);
+				viewportModel.viewportHeight = viewportModel.contentHeight + metrics.top + metrics.bottom;
+				
+			}
+				
+				// if the height is fixed and the width can change, then set up
+				// vertical scrolling (if the viewport supports it).
+			else if (host.isWidthSizedToContent() && !host.isHeightSizedToContent())
+			{
+				viewport.needsVerticalScroller();
+				
+				metrics = getMetrics();
+				
+				host.setWidth(viewportModel.contentWidth+viewport.scrollerWidth(), false);
+				viewportModel.viewportWidth = viewportModel.contentWidth + metrics.left + metrics.right;
+			}
+				
+				// Otherwise the viewport needs to display some scrollers (or other elements
+				// allowing the rest of the contentArea to be visible)
+			else {
+				
+				viewport.needsScrollers();
+			}
 		}
 		
-		override protected function changeHandler(event:Event):void
+		override protected function resizeHandler(event:Event):void
 		{
-			titleBar.width = UIBase(_strand).width;
-			super.changeHandler(event);
+			var host:UIBase = UIBase(_strand);
+			var viewportModel:IViewportModel = viewport.model;
+			
+			titleBar.width = host.width;
+						
+			// the viewport has to be adjusted to account for the change
+			// in the host size.			
+			viewportModel.viewportHeight = host.height - titleBar.height;
+			viewportModel.viewportWidth = host.width;
+			
+			// if the host has a fixed width, reset the contentWidth to match.
+			if (!host.isWidthSizedToContent()) viewportModel.contentWidth = host.width;
+			
+			// if the host has a fixed height, reset the contentHeight to match.
+			if (!host.isHeightSizedToContent()) viewportModel.contentHeight = host.height - titleBar.height;
+			
+			// the viewport's size and position also has to be adjusted since the
+			// host's size has changed.
+			viewport.updateSize();
+			
+			// the layout needs to be run to adjust the content for 
+			// the new host size.
+			changeHandler(event);
 		}
 		
 		private function titleBarHeightChanged(event:Event):void

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e325df03/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 54e6482..acaa640 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
@@ -105,15 +105,12 @@ package org.apache.flex.html.beads
 			// TODO: (aharui) get class to instantiate from CSS
 			if (!_titleBar)
 				_titleBar = new TitleBar();
-			_titleBar.percentWidth = 100;
 			// replace the TitleBar's model with the Panel's model (it implements ITitleBarModel) so that
 			// any changes to values in the Panel's model that correspond values in the TitleBar will 
 			// be picked up automatically by the TitleBar.
 			titleBar.model = host.model;
 			host.addElement(titleBar, false);
 			titleBar.addEventListener("heightChanged", chromeHeightChanged);
-			if (isNaN(host.explicitWidth) && isNaN(host.percentWidth))
-				titleBar.addEventListener("widthChanged", changeHandler);
 			
 			var controlBarItems:Array = (host.model as IPanelModel).controlBar;
 			if( controlBarItems && controlBarItems.length > 0 ) {
@@ -128,13 +125,17 @@ package org.apache.flex.html.beads
 				
 				host.addElement(controlBar, false);
 				controlBar.addEventListener("heightChanged", chromeHeightChanged);
-				if (isNaN(host.explicitWidth) && isNaN(host.percentWidth))
-					controlBar.addEventListener("widthChanged", changeHandler);
 			}
 			
 			super.strand = value;
 		}
 		
+		override protected function createViewport(metrics:UIMetrics):void
+		{
+			super.createViewport(metrics);
+			setupViewport(metrics);
+		}
+		
 		private function setupViewport(metrics:UIMetrics):void
 		{
 			var host:UIBase = UIBase(_strand);
@@ -159,30 +160,101 @@ package org.apache.flex.html.beads
 			model.contentHeight = model.viewportHeight - metrics.top - metrics.bottom;
 		}
 		
-		override protected function createViewport(metrics:UIMetrics):void
-		{
-			super.createViewport(metrics);
-			setupViewport(metrics);
-		}
-		
 		override protected function handleContentResize():void
 		{
-			super.handleContentResize();
-			
 			var host:UIBase = UIBase(_strand);
+			var viewportModel:IViewportModel = viewport.model;
+			
+			titleBar.x = 0;
+			titleBar.y = 0;
 			titleBar.width = host.width;
+			
 			if (controlBar) {
 				controlBar.width = host.width;
 				controlBar.y = host.height - controlBar.height;
 			}
+			
+			// If the host is being sized by its content, the change in the contentArea
+			// causes the host's size to change
+			if (host.isWidthSizedToContent() && host.isHeightSizedToContent()) {
+				host.setWidthAndHeight(viewportModel.contentWidth, viewportModel.contentHeight + titleBar.height, false);
+								
+				var metrics:UIMetrics = getMetrics();
+				
+				viewportModel.viewportHeight = viewportModel.contentHeight + metrics.top + metrics.bottom;
+				viewportModel.viewportWidth  = viewportModel.contentWidth + metrics.left + metrics.right;
+			}
+				
+				// if the width is fixed and the height is changing, then set up horizontal
+				// scrolling (if the viewport supports it).
+			else if (!host.isWidthSizedToContent() && host.isHeightSizedToContent())
+			{
+				viewport.needsHorizontalScroller();
+				
+				metrics = getMetrics();
+				
+				var cbHeight:Number = 0;
+				if (controlBar) {
+					controlBar.y = viewportModel.contentHeight + titleBar.height + metrics.top + metrics.bottom;
+					cbHeight = controlBar.height;
+				}
+				
+				host.setHeight(viewportModel.contentHeight + titleBar.height + cbHeight, false);
+				viewportModel.viewportHeight = viewportModel.contentHeight + metrics.top + metrics.bottom;
+				
+			}
+				
+				// if the height is fixed and the width can change, then set up
+				// vertical scrolling (if the viewport supports it).
+			else if (host.isWidthSizedToContent() && !host.isHeightSizedToContent())
+			{
+				viewport.needsVerticalScroller();
+				
+				metrics = getMetrics();
+				
+				host.setWidth(viewportModel.contentWidth+viewport.scrollerWidth(), false);
+				viewportModel.viewportWidth = viewportModel.contentWidth + metrics.left + metrics.right;
+			}
+				
+				// Otherwise the viewport needs to display some scrollers (or other elements
+				// allowing the rest of the contentArea to be visible)
+			else {
+				
+				viewport.needsScrollers();
+			}
 		}
 		
-		override protected function changeHandler(event:Event):void
+		override protected function resizeHandler(event:Event):void
 		{
-			titleBar.width = UIBase(_strand).width;	
-			controlBar.width = UIBase(_strand).width;
-			controlBar.y = UIBase(_strand).height - controlBar.height;	
-			super.changeHandler(event);
+			var host:UIBase = UIBase(_strand);
+			var viewportModel:IViewportModel = viewport.model;
+			var cbHeight:Number = 0;
+			
+			titleBar.width = host.width;
+			if (controlBar) {
+				controlBar.width = host.width;
+				controlBar.y = host.height - controlBar.height;
+				cbHeight = controlBar.height;
+			}
+			
+			// the viewport has to be adjusted to account for the change
+			// in the host size.			
+			viewportModel.viewportHeight = host.height - titleBar.height - cbHeight;
+			viewportModel.viewportWidth = host.width;
+			
+			// if the host has a fixed width, reset the contentWidth to match.
+			if (!host.isWidthSizedToContent()) viewportModel.contentWidth = host.width;
+			
+			// if the host has a fixed height, reset the contentHeight to match.
+			if (!host.isHeightSizedToContent()) viewportModel.contentHeight = host.height - titleBar.height - cbHeight;
+			
+			// the viewport's size and position also has to be adjusted since the
+			// host's size has changed.
+			viewport.updateSize();
+			
+			// the layout needs to be run to adjust the content for 
+			// the new host size.
+			changeHandler(event);
 		}
 		
 		private function chromeHeightChanged(event:Event):void
@@ -192,13 +264,8 @@ package org.apache.flex.html.beads
 		}
 		
 		/**
-		 *  Always returns true because Panel's content is separate from its chrome
-		 *  elements such as the title bar and optional control bar.
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
+		 * @private
+		 * Panel always needs content area.
 		 */
 		override protected function contentAreaNeeded():Boolean
 		{

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e325df03/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/models/ViewportModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/models/ViewportModel.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/models/ViewportModel.as
index 1cdfa55..6efebdf 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/models/ViewportModel.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/models/ViewportModel.as
@@ -16,6 +16,7 @@ package org.apache.flex.html.beads.models
 		}
 		
 		private var _layout:IBeadLayout;
+		private var _contentIsHost:Boolean = false;
 		private var _contentArea:IUIBase;
 		private var _contentWidth:Number = 0;
 		private var _contentHeight:Number = 0;
@@ -48,6 +49,15 @@ package org.apache.flex.html.beads.models
 			dispatchEvent( new Event("contentAreaChanged") );
 		}
 		
+		public function get contentIsHost():Boolean
+		{
+			return _contentIsHost;
+		}
+		public function set contentIsHost(value:Boolean):void
+		{
+			_contentIsHost = value;
+		}
+		
 		public function get viewportWidth():Number
 		{
 			return _viewportWidth;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e325df03/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/ScrollingViewport.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/ScrollingViewport.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/ScrollingViewport.as
index 1b154e3..c8e2294 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/ScrollingViewport.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/ScrollingViewport.as
@@ -115,8 +115,10 @@ package org.apache.flex.html.supportClasses
 				_horizontalScroller.setWidthAndHeight(model.viewportHeight - hbarAdjustWidthBy, scrollerSize, false);
 			} 
 			
-			contentArea.x = model.contentX;
-			contentArea.y = model.contentY;
+			if (!model.contentIsHost) {
+				contentArea.x = model.contentX;
+				contentArea.y = model.contentY;
+			}
 			contentArea.setWidthAndHeight(model.contentWidth, model.contentHeight, true);
 		}
 		
@@ -184,10 +186,6 @@ package org.apache.flex.html.supportClasses
 					contentArea.scrollRect = rect;
 				}
 			}
-			
-			updateContentAreaSize();
-			
-			// NOTE: this might make the scrollbars go away OR it might make them needed!
 		}
 		
 		/**

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e325df03/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/Viewport.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/Viewport.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/Viewport.as
index b83b838..de729a3 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/Viewport.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/Viewport.as
@@ -72,17 +72,16 @@ package org.apache.flex.html.supportClasses
 		 */
 		public function updateContentAreaSize():void
 		{
-			contentArea.x = model.contentX;
-			contentArea.y = model.contentY;
+			if (!model.contentIsHost) {
+				contentArea.x = model.contentX;
+				contentArea.y = model.contentY;
+			}
 			contentArea.setWidthAndHeight(model.contentWidth, model.contentHeight, true);
 		}
 		
 		public function updateSize():void
 		{
-			var metrics:UIMetrics = BeadMetrics.getMetrics(_strand);
-			var host:UIBase = UIBase(_strand);
-			
-			updateContentAreaSize();
+			// not needed for this type of viewport
 		}
 		
 		/**