Skip to content

Commit

Permalink
Merge pull request #3177 from vishalduggal/timob-11377
Browse files Browse the repository at this point in the history
[TIMOB-11377] Return the calculated bounds
  • Loading branch information
srahim committed Oct 11, 2012
2 parents 842c215 + aae5e62 commit 4dad186
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
11 changes: 9 additions & 2 deletions iphone/Classes/TiUIScrollViewProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ -(CGFloat)autoWidthForSize:(CGSize)size
else if (TiDimensionIsPercent(thisChildProxy->layoutProperties.width)){
result += [thisChildProxy minimumParentWidthForSize:size];
}
else if (TiDimensionIsUndefined(thisChildProxy->layoutProperties.width)){
result += [thisChildProxy minimumParentWidthForSize:size];
}
else {
result += [thisChildProxy minimumParentWidthForSize:contentSize];
}
Expand Down Expand Up @@ -200,7 +203,10 @@ -(CGFloat)autoHeightForSize:(CGSize)size
result += size.height;
}
else if (TiDimensionIsPercent(thisChildProxy->layoutProperties.height)){
result += [thisChildProxy minimumParentWidthForSize:size];
result += [thisChildProxy minimumParentHeightForSize:size];
}
else if (TiDimensionIsUndefined(thisChildProxy->layoutProperties.height)) {
result += [thisChildProxy minimumParentHeightForSize:size];
}
else {
result += [thisChildProxy minimumParentHeightForSize:contentSize];
Expand Down Expand Up @@ -291,11 +297,12 @@ -(CGRect)computeChildSandbox:(TiViewProxy*)child withBounds:(CGRect)bounds
verticalLayoutBoundary += bounds.size.height;
return bounds;
}
else if (TiDimensionIsUndefined(child->layoutProperties.height)){
else if (TiDimensionIsUndefined(child->layoutProperties.height) && flexibleContentHeight){
//Undefined height with 2+pins. Need to use view bounds to match autoHeight behavior
bounds.origin.y = verticalLayoutBoundary;
bounds.size.height = [child minimumParentHeightForSize:viewBounds.size];
verticalLayoutBoundary += bounds.size.height;
return bounds;
}
else {
return [super computeChildSandbox:child withBounds:contentSize];
Expand Down
8 changes: 6 additions & 2 deletions iphone/Classes/TiViewProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -1820,17 +1820,19 @@ -(BOOL) widthIsAutoFill
}
else if (TiDimensionIsUndefined(layoutProperties.width) && TiDimensionIsAutoFill([self defaultAutoWidthBehavior:nil]))
{
BOOL centerDefined = NO;
int pinCount = 0;
if (!TiDimensionIsUndefined(layoutProperties.left) ) {
pinCount ++;
}
if (!TiDimensionIsUndefined(layoutProperties.centerX) ) {
centerDefined = YES;
pinCount ++;
}
if (!TiDimensionIsUndefined(layoutProperties.right) ) {
pinCount ++;
}
if (pinCount < 2) {
if ( (pinCount < 2) || (!centerDefined) ){
isAutoFill = YES;
}
}
Expand All @@ -1850,17 +1852,19 @@ -(BOOL) heightIsAutoFill
}
else if (TiDimensionIsUndefined(layoutProperties.height) && TiDimensionIsAutoFill([self defaultAutoHeightBehavior:nil]))
{
BOOL centerDefined = NO;
int pinCount = 0;
if (!TiDimensionIsUndefined(layoutProperties.top) ) {
pinCount ++;
}
if (!TiDimensionIsUndefined(layoutProperties.centerY) ) {
centerDefined = YES;
pinCount ++;
}
if (!TiDimensionIsUndefined(layoutProperties.bottom) ) {
pinCount ++;
}
if (pinCount < 2) {
if ( (pinCount < 2) || (!centerDefined) ) {
isAutoFill = YES;
}
}
Expand Down

0 comments on commit 4dad186

Please sign in to comment.