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 2015/08/27 22:55:49 UTC

[2/5] git commit: [flex-asjs] [refs/heads/develop] - change when we set size on contentView

change when we set size on contentView


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

Branch: refs/heads/develop
Commit: edd9deb199bdd610ac9e25d064b03e7fe70566fb
Parents: 7153ac9
Author: Alex Harui <ah...@apache.org>
Authored: Thu Aug 27 12:43:20 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Aug 27 12:43:20 2015 -0700

----------------------------------------------------------------------
 .../org/apache/flex/html/beads/ContainerView.js | 23 +++++++++++---------
 1 file changed, 13 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/edd9deb1/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/ContainerView.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/ContainerView.js b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/ContainerView.js
index 858da12..836d826 100644
--- a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/ContainerView.js
+++ b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/ContainerView.js
@@ -222,12 +222,15 @@ org.apache.flex.html.beads.ContainerView.
  */
 org.apache.flex.html.beads.ContainerView.
     prototype.adjustSizeBeforeLayout = function() {
-    this.viewportModel_.contentWidth = this._strand.width;
-    this.viewportModel_.contentHeight = this._strand.height;
+    var host = this._strand;
+    this.viewportModel_.contentWidth = host.width;
+    this.viewportModel_.contentHeight = host.height;
     this.viewportModel_.contentX = 0;
     this.viewportModel_.contentY = 0;
-    this.contentView.width = this.viewportModel_.contentWidth;
-    this.contentView.height = this.viewportModel_.contentHeight;
+    if (!host.isWidthSizedToContent())
+      this.contentView.width = this.viewportModel_.contentWidth;
+    if (!host.isHeightSizedToContent())
+      this.contentView.height = this.viewportModel_.contentHeight;
 };
 
 
@@ -261,8 +264,10 @@ org.apache.flex.html.beads.ContainerView.
   var host = this._strand;
   var metrics = org.apache.flex.utils.BeadMetrics.getMetrics(host);
 
-  this.viewportModel_.contentWidth = Math.max(this.viewportModel_.contentWidth, this.contentView.width);
-  this.viewportModel_.contentHeight = Math.max(this.viewportModel_.contentHeight, this.contentView.height);
+  if (host.isWidthSizedToContent())
+    this.viewportModel_.contentWidth = this.contentView.width;
+  if (host.isWidthSizedToContent())
+    this.viewportModel_.contentHeight = this.contentView.height;
 
   if (host.isWidthSizedToContent() && host.isHeightSizedToContent()) {
     host.setWidthAndHeight(this.viewportModel_.contentWidth + metrics.left + metrics.right,
@@ -286,8 +291,8 @@ org.apache.flex.html.beads.ContainerView.
 
   this.contentView.x = this.viewportModel_.contentX;
   this.contentView.y = this.viewportModel_.contentY;
-  this.contentView.width = this.viewportModel_.contentWidth;
-  this.contentView.height = this.viewportModel_.contentHeight;
+  //this.contentView.width = this.viewportModel_.contentWidth;
+  //this.contentView.height = this.viewportModel_.contentHeight;
 
   this.viewport_.updateSize();
   this.viewport_.updateContentAreaSize();
@@ -363,8 +368,6 @@ Object.defineProperties(org.apache.flex.html.beads.ContainerView.prototype, {
         set: function(value) {
             org.apache.flex.utils.Language.superSetter(org.apache.flex.html.beads.ContainerView, this, 'strand', value);
             this.contentView = this.createContentView();
-            this.contentView.percentWidth = 100;
-            this.contentView.percentHeight = 100;
             this.host.addElement(this.contentView);
             this.host.setActualParent(this.contentView);
             this._strand.addEventListener('initComplete',