@@ -48,11 +48,8 @@ - (void)_staticInitialize;
4848
4949@end
5050
51- #if ASDisplayNodeLoggingEnabled
52- #define LOG (...) NSLog (__VA_ARGS__)
53- #else
54- #define LOG (...)
55- #endif
51+ // #define LOG(...) NSLog(__VA_ARGS__)
52+ #define LOG (...)
5653
5754// Conditionally time these scopes to our debug ivars (only exist in debug/profile builds)
5855#if TIME_DISPLAYNODE_OPS
@@ -1076,60 +1073,19 @@ - (void)__layout
10761073 ASDisplayNodeAssertMainThread ();
10771074 ASDN::MutexLocker l (_propertyLock);
10781075 CGRect bounds = self.bounds ;
1079-
1080- [self measureNodeWithBoundsIfNecessary: bounds];
1081-
1082- // Performing layout on a zero-bounds view often results in frame calculations
1083- // with negative sizes after applying margins, which will cause
1084- // measureWithSizeRange: on subnodes to assert.
1085- if (!CGRectEqualToRect (bounds, CGRectZero)) {
1086- // Handle placeholder layer creation in case the size of the node changed after the initial placeholder layer
1087- // was created
1088- if ([self _shouldHavePlaceholderLayer ]) {
1089- [self _setupPlaceholderLayerIfNeeded ];
1090- }
1091- _placeholderLayer.frame = bounds;
1092-
1093- [self layout ];
1094- [self layoutDidFinish ];
1095- }
1096- }
1097-
1098- - (void )measureNodeWithBoundsIfNecessary : (CGRect)bounds
1099- {
1100- // Normally measure will be called before layout occurs. If this doesn't happen, nothing is going to call it at all.
1101- // We simply call measureWithSizeRange: using a size range equal to whatever bounds were provided to that element or
1102- // try to measure the node with the largest size as possible
1103- if (self.supernode == nil && !self.supportsRangeManagedInterfaceState && [self _hasDirtyLayout ] == NO ) {
1104- if (CGRectEqualToRect (bounds, CGRectZero)) {
1105- LOG (@" Warning: No size given for node before node was trying to layout itself: %@ . Please provide a frame for the node." , self);
1106- } else {
1107- [self measureWithSizeRange: ASSizeRangeMake (CGSizeZero, bounds.size)];
1108- }
1109- }
1110- }
1111-
1112- - (void )layout
1113- {
1114- ASDisplayNodeAssertMainThread ();
1115-
1116- if ([self _hasDirtyLayout ]) {
1076+ if (CGRectEqualToRect (bounds, CGRectZero)) {
1077+ // Performing layout on a zero-bounds view often results in frame calculations
1078+ // with negative sizes after applying margins, which will cause
1079+ // measureWithSizeRange: on subnodes to assert.
11171080 return ;
11181081 }
1119-
1120- [self __layoutSublayouts ];
1121- }
1122-
1123- - (void )__layoutSublayouts
1124- {
1125- for (ASLayout *subnodeLayout in _layout.immediateSublayouts ) {
1126- ((ASDisplayNode *)subnodeLayout.layoutableObject ).frame = [subnodeLayout frame ];
1127- }
1082+ _placeholderLayer.frame = bounds;
1083+ [self layout ];
1084+ [self layoutDidFinish ];
11281085}
11291086
11301087- (void )layoutDidFinish
11311088{
1132- // Hook for subclasses
11331089}
11341090
11351091- (CATransform3D)_transformToAncestor : (ASDisplayNode *)ancestor
@@ -2417,6 +2373,24 @@ - (void)applyLayout:(ASLayout *)layout layoutContext:(ASLayoutTransition *)layou
24172373 }
24182374}
24192375
2376+ - (void )layout
2377+ {
2378+ ASDisplayNodeAssertMainThread ();
2379+
2380+ if (![self _hasDirtyLayout ]) {
2381+ return ;
2382+ }
2383+
2384+ [self __layoutSublayouts ];
2385+ }
2386+
2387+ - (void )__layoutSublayouts
2388+ {
2389+ for (ASLayout *subnodeLayout in _layout.immediateSublayouts ) {
2390+ ((ASDisplayNode *)subnodeLayout.layoutableObject ).frame = [subnodeLayout frame ];
2391+ }
2392+ }
2393+
24202394- (void )displayWillStart
24212395{
24222396 ASDisplayNodeAssertMainThread ();
0 commit comments