You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2017/05/23 07:16:18 UTC

[10/13] git commit: [flex-asjs] [refs/heads/release0.8.0] - if sizedToContent, don't show a scrollbar

if sizedToContent, don't show a scrollbar


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

Branch: refs/heads/release0.8.0
Commit: 23c4c7a51640884ae5af64541ff6a4f5515af183
Parents: 43bbbdb
Author: Alex Harui <ah...@apache.org>
Authored: Tue May 23 00:11:28 2017 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue May 23 00:15:57 2017 -0700

----------------------------------------------------------------------
 .../flex/html/supportClasses/ScrollingViewport.as     | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/23c4c7a5/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as
index 444606b..fb6d784 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/supportClasses/ScrollingViewport.as
@@ -188,11 +188,13 @@ package org.apache.flex.html.supportClasses
          */
 		override public function layoutViewportAfterContentLayout(contentSize:Size):void
 		{
+			var host:UIBase = UIBase(_strand);
+			
 			var hadV:Boolean = _verticalScroller != null && _verticalScroller.visible;
 			var hadH:Boolean = _horizontalScroller != null && _horizontalScroller.visible;
 			
-			var hostWidth:Number = UIBase(_strand).width;
-			var hostHeight:Number = UIBase(_strand).height;
+			var hostWidth:Number = host.width;
+			var hostHeight:Number = host.height;
 			
 			var borderMetrics:org.apache.flex.geom.Rectangle = CSSContainerUtils.getBorderMetrics(_strand);
 			
@@ -202,6 +204,14 @@ package org.apache.flex.html.supportClasses
 			var needV:Boolean = contentSize.height > viewportHeight;
 			var needH:Boolean = contentSize.width > viewportWidth;
 			
+			// if sized to content, the container should stretch to fit, making the original
+			// viewport dimensions obsolete and scrollbars unnecessary.
+			// This might not work for the flexible child.
+			if (host.isWidthSizedToContent())
+				needH = false;
+			if (host.isHeightSizedToContent())
+				needV = false;
+
 			if (needV)
 			{
 				if (_verticalScroller == null) {