Merge remote-tracking branch 'facebook/master' into 500pxgram

This commit is contained in:
Hannah Troisi
2016-04-10 21:47:28 -07:00
5 changed files with 25 additions and 3 deletions

View File

@@ -293,9 +293,18 @@
CGSize size = self.preferredFrameSize;
if (CGSizeEqualToSize(size, CGSizeZero)) {
size = constrainedSize;
// FIXME: Need a better way to allow maps to take up the right amount of space in a layout (sizeRange, etc)
// These fallbacks protect against inheriting a constrainedSize that contains a CGFLOAT_MAX value.
if (!isValidForLayout(size.width)) {
size.width = 100.0;
}
if (!isValidForLayout(size.height)) {
size.height = 100.0;
}
}
[self setSnapshotSizeWithReloadIfNeeded:size];
return constrainedSize;
return size;
}
// -layout isn't usually needed over -layoutSpecThatFits, but this way we can avoid a needless node wrapper for MKMapView.

View File

@@ -8,6 +8,7 @@
*
*/
#pragma once
#import <UIKit/UIKit.h>
#import <AsyncDisplayKit/ASBaseDefines.h>
@@ -34,6 +35,8 @@ typedef struct {
extern ASRelativeDimension const ASRelativeDimensionUnconstrained;
#define isValidForLayout(x) ((isnormal(x) || x == 0.0) && x >= 0.0 && x < (CGFLOAT_MAX / 2.0))
ASDISPLAYNODE_EXTERN_C_BEGIN
NS_ASSUME_NONNULL_BEGIN

View File

@@ -8,6 +8,8 @@
*
*/
#pragma once
#import <UIKit/UIKit.h>
#import <AsyncDisplayKit/ASAssert.h>
#import <AsyncDisplayKit/ASLayoutable.h>

View File

@@ -39,7 +39,15 @@ extern BOOL CGPointIsNull(CGPoint point)
ASLayout *l = [super new];
if (l) {
l->_layoutableObject = layoutableObject;
l->_size = CGSizeMake(ASCeilPixelValue(size.width), ASCeilPixelValue(size.height));
if (!isValidForLayout(size.width) || !isValidForLayout(size.height)) {
ASDisplayNodeAssert(NO, @"layoutSize is invalid and unsafe to provide to Core Animation! Production will force to 0, 0. Size = %@, node = %@", NSStringFromCGSize(size), layoutableObject);
size = CGSizeZero;
} else {
size = CGSizeMake(ASCeilPixelValue(size.width), ASCeilPixelValue(size.height));
}
l->_size = size;
if (CGPointIsNull(position) == NO) {
l->_position = CGPointMake(ASCeilPixelValue(position.x), ASCeilPixelValue(position.y));
} else {

View File

@@ -99,7 +99,7 @@ to implement node hierarchies or custom drawing.
### Learn more
* Read the [Getting Started guide](http://asyncdisplaykit.org/docs/getting-started.html/)
* Read the [Getting Started guide](http://asyncdisplaykit.org/docs/getting-started.html)
* Get the [sample projects](https://github.com/facebook/AsyncDisplayKit/tree/master/examples)
* Browse the [API reference](http://asyncdisplaykit.org/appledocs.html)
* Watch the [NSLondon talk](http://vimeo.com/103589245) or the [NSSpain talk](https://www.youtube.com/watch?v=RY_X7l1g79Q)