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 08:46:06 UTC
[5/9] git commit: [flex-asjs] [refs/heads/develop] - use
sizedToContent (and fix up use of internalDisplay)
use sizedToContent (and fix up use of internalDisplay)
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/f7de7d90
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/f7de7d90
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/f7de7d90
Branch: refs/heads/develop
Commit: f7de7d90cdce3c663f653dd8acc7cb39287cb640
Parents: cd7b69e
Author: Alex Harui <ah...@apache.org>
Authored: Wed Aug 26 17:33:55 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Wed Aug 26 17:33:55 2015 -0700
----------------------------------------------------------------------
.../org/apache/flex/core/HTMLElementWrapper.js | 4 ++--
.../apache/flex/html/beads/layouts/BasicLayout.js | 18 +++++++-----------
.../flex/html/beads/layouts/ButtonBarLayout.js | 2 +-
.../flex/html/beads/layouts/HorizontalLayout.js | 11 ++++-------
.../apache/flex/html/beads/layouts/TileLayout.js | 4 ++--
.../flex/html/beads/layouts/VerticalLayout.js | 10 ++++------
6 files changed, 20 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f7de7d90/frameworks/projects/Core/js/src/org/apache/flex/core/HTMLElementWrapper.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/HTMLElementWrapper.js b/frameworks/projects/Core/js/src/org/apache/flex/core/HTMLElementWrapper.js
index e8ecb5b..c9b82bf 100644
--- a/frameworks/projects/Core/js/src/org/apache/flex/core/HTMLElementWrapper.js
+++ b/frameworks/projects/Core/js/src/org/apache/flex/core/HTMLElementWrapper.js
@@ -59,10 +59,10 @@ org.apache.flex.core.HTMLElementWrapper.prototype._beads = null;
/**
- * @protected
+ * Used internally by layouts.
* @type {string}
*/
-org.apache.flex.core.HTMLElementWrapper.prototype.internalDisplay = 'inline';
+org.apache.flex.core.HTMLElementWrapper.prototype.internalDisplay = 'block';
/**
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f7de7d90/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/BasicLayout.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/BasicLayout.js b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/BasicLayout.js
index daaf348..80f0f42 100644
--- a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/BasicLayout.js
+++ b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/BasicLayout.js
@@ -28,8 +28,6 @@ goog.require('org.apache.flex.utils.Language');
org.apache.flex.html.beads.layouts.BasicLayout =
function() {
this.strand_ = null;
- this.lastWidth_ = '';
- this.lastHeight_ = '';
this.className = 'BasicLayout';
};
@@ -66,18 +64,16 @@ org.apache.flex.html.beads.layouts.BasicLayout.
var viewBead = this.strand_.getBeadByType(org.apache.flex.core.ILayoutParent);
var contentView = viewBead.contentView;
- var cvs = contentView.positioner.style;
- var cv = getComputedStyle(contentView.positioner);
w = contentView.width;
- var hasWidth = cvs.width !== undefined && cvs.width != this.lastWidth_;
+ var hasWidth = !this.strand_.isWidthSizedToContent();
h = contentView.height;
- var hasHeight = cvs.height !== undefined && cvs.height != this.lastHeight_;
+ var hasHeight = !this.strand_.isHeightSizedToContent();
var maxHeight = 0;
var maxWidth = 0;
n = contentView.numElements;
for (i = 0; i < n; i++) {
var child = contentView.getElementAt(i);
- child.positioner.internalDisplay = 'block';
+ child.internalDisplay = 'block';
var left = org.apache.flex.core.ValuesManager.valuesImpl.getValue(child, 'left');
var right = org.apache.flex.core.ValuesManager.valuesImpl.getValue(child, 'right');
var top = org.apache.flex.core.ValuesManager.valuesImpl.getValue(child, 'top');
@@ -119,10 +115,10 @@ org.apache.flex.html.beads.layouts.BasicLayout.
}
// if there are children and maxHeight is ok, use it.
// maxHeight can be NaN if the child hasn't been rendered yet.
- if (!hasWidth && n > 0 && !isNaN(maxWidth) && (!(cv.left != 'auto' && cv.right != 'auto'))) {
- this.lastWidth_ = cvs.width = maxWidth.toString() + 'px';
+ if (!hasWidth && n > 0 && !isNaN(maxWidth)) {
+ contentView.width = maxWidth;
}
- if (!hasHeight && n > 0 && !isNaN(maxHeight) && (!(cv.top != 'auto' && cv.bottom != 'auto'))) {
- this.lastHeight_ = cvs.height = maxHeight.toString() + 'px';
+ if (!hasHeight && n > 0 && !isNaN(maxHeight)) {
+ contentView.height = maxHeight;
}
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f7de7d90/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.js b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.js
index dec2378..3690bc1 100644
--- a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.js
+++ b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.js
@@ -88,7 +88,7 @@ org.apache.flex.html.beads.layouts.ButtonBarLayout.
{
var ir = itemRendererParent.getElementAt(i);
ir.height = useHeight;
- ir.positioner.internalDisplay = 'inline-block';
+ ir.internalDisplay = 'inline-block';
ir.positioner.style['vertical-align'] = 'middle';
ir.positioner.style['text-align'] = 'center';
ir.positioner.style['left-margin'] = 'auto';
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f7de7d90/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/HorizontalLayout.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/HorizontalLayout.js b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/HorizontalLayout.js
index 54ff416..8db30eb 100644
--- a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/HorizontalLayout.js
+++ b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/HorizontalLayout.js
@@ -26,7 +26,6 @@ org.apache.flex.html.beads.layouts.HorizontalLayout =
function() {
this.strand_ = null;
this.className = 'HorizontalLayout';
- this.lastHeight_ = '';
};
@@ -65,15 +64,13 @@ org.apache.flex.html.beads.layouts.HorizontalLayout.
var viewBead = this.strand_.getBeadByType(org.apache.flex.core.ILayoutParent);
var contentView = viewBead.contentView;
children = contentView.internalChildren();
- var sps = this.strand_.positioner.style;
- var scv = getComputedStyle(this.strand_.positioner);
- var hasHeight = sps.height !== undefined && sps.height != this.lastHeight_;
+ var hasHeight = !this.strand_.isHeightSizedToContent();
var maxHeight = 0;
n = children.length;
for (i = 0; i < n; i++)
{
var child = children[i];
- child.internalDisplay = 'inline-block';
+ child.flexjs_wrapper.internalDisplay = 'inline-block';
if (child.style.display == 'none')
child.lastDisplay_ = 'inline-block';
else
@@ -83,7 +80,7 @@ org.apache.flex.html.beads.layouts.HorizontalLayout.
}
// if there are children and maxHeight is ok, use it.
// maxHeight can be NaN if the child hasn't been rendered yet.
- if (!hasHeight && n > 0 && !isNaN(maxHeight) && (!(scv.top != 'auto' && scv.bottom != 'auto'))) {
- this.lastHeight_ = sps.height = maxHeight.toString() + 'px';
+ if (!hasHeight && n > 0 && !isNaN(maxHeight)) {
+ contentView.height = maxHeight;
}
};
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f7de7d90/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/TileLayout.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/TileLayout.js b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/TileLayout.js
index 0e0095c..6a8b7e6 100644
--- a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/TileLayout.js
+++ b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/TileLayout.js
@@ -123,7 +123,7 @@ org.apache.flex.html.beads.layouts.TileLayout.
{
child = children[i].flexjs_wrapper;
if (!child.visible) continue;
- child.positioner.internalDisplay = 'inline-block';
+ child.internalDisplay = 'inline-block';
child.width = useWidth;
child.height = useHeight;
}
@@ -151,7 +151,7 @@ org.apache.flex.html.beads.layouts.TileLayout.
{
child = children[i].flexjs_wrapper;
if (!child.visible) continue;
- child.positioner.internalDisplay = 'inline-block';
+ child.internalDisplay = 'inline-block';
child.width = useWidth;
child.height = useHeight;
child.x = xpos;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f7de7d90/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/VerticalLayout.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/VerticalLayout.js b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/VerticalLayout.js
index 428675e..b569245 100644
--- a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/VerticalLayout.js
+++ b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/VerticalLayout.js
@@ -27,7 +27,6 @@ org.apache.flex.html.beads.layouts.VerticalLayout =
function() {
this.strand_ = null;
this.className = 'VerticalLayout';
- this.lastWidth_ = '';
};
@@ -68,15 +67,14 @@ org.apache.flex.html.beads.layouts.VerticalLayout.
var viewBead = this.strand_.getBeadByType(org.apache.flex.core.ILayoutParent);
var contentView = viewBead.contentView;
children = contentView.internalChildren();
- var sps = this.strand_.positioner.style;
var scv = getComputedStyle(this.strand_.positioner);
- var hasWidth = sps.width !== undefined && sps.width != this.lastWidth_;
+ var hasWidth = !this.strand_.isWidthSizedToContent();
var maxWidth = 0;
n = children.length;
for (i = 0; i < n; i++)
{
var child = children[i];
- child.internalDisplay = 'block';
+ child.flexjs_wrapper.internalDisplay = 'block';
if (child.style.display === 'none') {
child.lastDisplay_ = 'block';
} else {
@@ -85,12 +83,12 @@ org.apache.flex.html.beads.layouts.VerticalLayout.
maxWidth = Math.max(maxWidth, child.offsetLeft + child.offsetWidth);
child.flexjs_wrapper.dispatchEvent('sizeChanged');
}
- if (!hasWidth && n > 0 && !isNaN(maxWidth) && (!(scv.left != 'auto' && scv.right != 'auto'))) {
+ if (!hasWidth && n > 0 && !isNaN(maxWidth)) {
var pl = scv['padding-left'];
var pr = scv['padding-right'];
pl = parseInt(pl.substring(0, pl.length - 2), 10);
pr = parseInt(pr.substring(0, pr.length - 2), 10);
maxWidth += scv.paddingLeft + pl + pr;
- this.lastWidth_ = sps.width = maxWidth.toString() + 'px';
+ contentView.width = maxWidth;
}
};