flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [1/9] git commit: [flex-asjs] [refs/heads/develop] - just like the AS side, check left/right and top/bottom when determining sizeToContent and then use that correctly in ContainerView
Date Thu, 27 Aug 2015 06:46:02 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 7c7dd0508 -> 94502fde9


just like the AS side, check left/right and top/bottom when determining sizeToContent and
then use that correctly in ContainerView


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

Branch: refs/heads/develop
Commit: 9a3e19a7df586cfcf71e7459990e704f5666bcf9
Parents: 7c7dd05
Author: Alex Harui <aharui@apache.org>
Authored: Wed Aug 26 12:28:05 2015 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Wed Aug 26 12:28:05 2015 -0700

----------------------------------------------------------------------
 .../Core/js/src/org/apache/flex/core/UIBase.js  | 14 ++++++--
 .../org/apache/flex/html/beads/ContainerView.js | 36 +++++++++++++-------
 2 files changed, 35 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9a3e19a7/frameworks/projects/Core/js/src/org/apache/flex/core/UIBase.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/UIBase.js b/frameworks/projects/Core/js/src/org/apache/flex/core/UIBase.js
index 0c33d65..04dfbaa 100644
--- a/frameworks/projects/Core/js/src/org/apache/flex/core/UIBase.js
+++ b/frameworks/projects/Core/js/src/org/apache/flex/core/UIBase.js
@@ -764,7 +764,12 @@ org.apache.flex.core.UIBase.prototype.setWidthAndHeight =
  */
 org.apache.flex.core.UIBase.prototype.isWidthSizedToContent = function()
 {
-  return (isNaN(this.explicitWidth_) && isNaN(this.percentWidth_));
+  if (!isNaN(this.explicitWidth_) || !isNaN(this.percentWidth_))
+    return false;
+  var scv = window.getComputedStyle(this.element);
+  if (scv.left != 'auto' && scv.right != 'auto')
+    return false;
+  return true;
 };
 
 
@@ -774,7 +779,12 @@ org.apache.flex.core.UIBase.prototype.isWidthSizedToContent = function()
  */
 org.apache.flex.core.UIBase.prototype.isHeightSizedToContent = function()
 {
-  return (isNaN(this.explicitHeight_) && isNaN(this.percentHeight_));
+  if (!isNaN(this.explicitHeight_) || !isNaN(this.percentHeight_))
+    return false;
+  var scv = window.getComputedStyle(this.element);
+  if (scv.top != 'auto' && scv.bottom != 'auto')
+    return false;
+  return true;
 };
 
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9a3e19a7/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 23a951a..3c2f63a 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
@@ -20,6 +20,7 @@ goog.require('org.apache.flex.core.ILayoutParent');
 goog.require('org.apache.flex.html.beads.models.ViewportModel');
 goog.require('org.apache.flex.html.supportClasses.ContainerContentArea');
 goog.require('org.apache.flex.html.supportClasses.Viewport');
+goog.require('org.apache.flex.utils.BeadMetrics');
 
 
 
@@ -148,6 +149,7 @@ org.apache.flex.html.beads.ContainerView.
  */
 org.apache.flex.html.beads.ContainerView.
     prototype.sizeChangeHandler = function(event) {
+  if (this.runningLayout) return;
   this.performLayout(event);
 };
 
@@ -157,6 +159,7 @@ org.apache.flex.html.beads.ContainerView.
  */
 org.apache.flex.html.beads.ContainerView.
     prototype.resizeHandler = function(event) {
+  if (this.runningLayout) return;
   this.performLayout(event);
 };
 
@@ -166,8 +169,8 @@ org.apache.flex.html.beads.ContainerView.
  */
  org.apache.flex.html.beads.ContainerView.
     prototype.childResizeHandler = function(event) {
-    if (this.runningLayout) return;
-    this.performLayout(event);
+  if (this.runningLayout) return;
+  this.performLayout(event);
 };
 
 
@@ -178,10 +181,10 @@ org.apache.flex.html.beads.ContainerView.
     prototype.completeSetup = function() {
   this.createViewport();
 
-   this._strand.addEventListener('childrenAdded',
+  this._strand.addEventListener('childrenAdded',
       org.apache.flex.utils.Language.closure(this.childrenChangedHandler, this, 'childrenAdded'));
-   this.childrenChangedHandler(null);
-   this._strand.addEventListener('childrenAdded',
+  this.childrenChangedHandler(null);
+  this._strand.addEventListener('childrenAdded',
       org.apache.flex.utils.Language.closure(this.changeHandler, this, 'childrenAdded'));
   this._strand.addEventListener('childrenRemoved',
       org.apache.flex.utils.Language.closure(this.changeHandler, this, 'childrenRemoved'));
@@ -253,14 +256,21 @@ org.apache.flex.html.beads.ContainerView.
  */
 org.apache.flex.html.beads.ContainerView.
     prototype.adjustSizeAfterLayout = function() {
-  var max = this.contentView.width;//this.layout.maxWidth;
-  if (isNaN(this.resizableView.explicitWidth) && !isNaN(max))
-    this.resizableView.setWidth(max, true);
-  max = this.contentView.height;//this.layout.maxHeight;
-  if (isNaN(this.resizableView.explicitHeight) && !isNaN(max))
-    this.resizableView.setHeight(max, true);
-
-  this.layoutContainer(false, false);
+  var host = this._strand;
+  var metrics = org.apache.flex.utils.BeadMetrics.getMetrics(host);
+
+  if (host.isWidthSizedToContent() && host.isHeightSizedToContent()) {
+    host.setWidthAndHeight(this.viewportModel_.contentWidth + metrics.left + metrics.right,
+                           this.viewportModel_.contentHeight + metrics.top + metrics.bottom,
false);
+  }
+  else if (!host.isWidthSizedToContent() && host.isHeightSizedToContent()) {
+    host.setHeight(this.viewportModel_.contentHeight + metrics.top + metrics.bottom, false);
+  }
+  else if (host.isWidthSizedToContent() && !host.isHeightSizedToContent()) {
+    host.setWidth(this.viewportModel_.contentWidth + metrics.left + metrics.right, false);
+  }
+
+  this.layoutContainer(host.isWidthSizedToContent(), host.isHeightSizedToContent());
 
   // The JS version of Panel matches the content space to the viewport since HTML
   // takes care of scrollbars


Mime
View raw message