Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
[ASDisplayNode] Rename ASDisplayNodeTransitionContext to ASLayoutTran…
Browse files Browse the repository at this point in the history
…sition (#1680)

* [ASDisplayNode] Rename ASDisplayNodeTransitionContext to ASLayoutTransition

* Rename internal ivar to fit new naming

* Fix tabbing
  • Loading branch information
levi authored and appleguy committed May 25, 2016
1 parent d0c30a4 commit 95f1ab4
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 47 deletions.
24 changes: 12 additions & 12 deletions AsyncDisplayKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,8 @@
DBDB83971C6E879900D0098C /* ASPagerFlowLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = DBDB83931C6E879900D0098C /* ASPagerFlowLayout.m */; };
DE040EF91C2B40AC004692FF /* ASCollectionViewFlowLayoutInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 251B8EF41BBB3D690087C538 /* ASCollectionViewFlowLayoutInspector.h */; settings = {ATTRIBUTES = (Public, ); }; };
DE0702FC1C3671E900D7DE62 /* libAsyncDisplayKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 058D09AC195D04C000B7D73C /* libAsyncDisplayKit.a */; };
DE4843DB1C93EAB100A1F33B /* ASDisplayNodeLayoutContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = E52405B21C8FEF03004DC8E7 /* ASDisplayNodeLayoutContext.mm */; };
DE4843DC1C93EAC100A1F33B /* ASDisplayNodeLayoutContext.h in Headers */ = {isa = PBXBuildFile; fileRef = E52405B41C8FEF16004DC8E7 /* ASDisplayNodeLayoutContext.h */; };
DE4843DB1C93EAB100A1F33B /* ASLayoutTransition.mm in Sources */ = {isa = PBXBuildFile; fileRef = E52405B21C8FEF03004DC8E7 /* ASLayoutTransition.mm */; };
DE4843DC1C93EAC100A1F33B /* ASLayoutTransition.h in Headers */ = {isa = PBXBuildFile; fileRef = E52405B41C8FEF16004DC8E7 /* ASLayoutTransition.h */; };
DE6EA3221C14000600183B10 /* ASDisplayNode+FrameworkPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = DE6EA3211C14000600183B10 /* ASDisplayNode+FrameworkPrivate.h */; };
DE6EA3231C14000600183B10 /* ASDisplayNode+FrameworkPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = DE6EA3211C14000600183B10 /* ASDisplayNode+FrameworkPrivate.h */; };
DE84918D1C8FFF2B003D89E9 /* ASRunLoopQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 81EE384D1C8E94F000456208 /* ASRunLoopQueue.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand All @@ -574,8 +574,8 @@
DECBD6E91BE56E1900CF4905 /* ASButtonNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = DECBD6E61BE56E1900CF4905 /* ASButtonNode.mm */; };
DECBD6EA1BE56E1900CF4905 /* ASButtonNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = DECBD6E61BE56E1900CF4905 /* ASButtonNode.mm */; };
DEFAD8131CC48914000527C4 /* ASVideoNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = AEEC47E01C20C2DD00EC1693 /* ASVideoNode.mm */; };
E52405B31C8FEF03004DC8E7 /* ASDisplayNodeLayoutContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = E52405B21C8FEF03004DC8E7 /* ASDisplayNodeLayoutContext.mm */; };
E52405B51C8FEF16004DC8E7 /* ASDisplayNodeLayoutContext.h in Headers */ = {isa = PBXBuildFile; fileRef = E52405B41C8FEF16004DC8E7 /* ASDisplayNodeLayoutContext.h */; };
E52405B31C8FEF03004DC8E7 /* ASLayoutTransition.mm in Sources */ = {isa = PBXBuildFile; fileRef = E52405B21C8FEF03004DC8E7 /* ASLayoutTransition.mm */; };
E52405B51C8FEF16004DC8E7 /* ASLayoutTransition.h in Headers */ = {isa = PBXBuildFile; fileRef = E52405B41C8FEF16004DC8E7 /* ASLayoutTransition.h */; };
E55D86321CA8A14000A0C26F /* ASLayoutable.mm in Sources */ = {isa = PBXBuildFile; fileRef = E55D86311CA8A14000A0C26F /* ASLayoutable.mm */; };
E55D86331CA8A14000A0C26F /* ASLayoutable.mm in Sources */ = {isa = PBXBuildFile; fileRef = E55D86311CA8A14000A0C26F /* ASLayoutable.mm */; };
E5711A2B1C840C81009619D4 /* ASIndexedNodeContext.h in Headers */ = {isa = PBXBuildFile; fileRef = E5711A2A1C840C81009619D4 /* ASIndexedNodeContext.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -936,8 +936,8 @@
DEC146B51C37A16A004A0EE7 /* ASCollectionInternal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ASCollectionInternal.m; path = Details/ASCollectionInternal.m; sourceTree = "<group>"; };
DECBD6E51BE56E1900CF4905 /* ASButtonNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASButtonNode.h; sourceTree = "<group>"; };
DECBD6E61BE56E1900CF4905 /* ASButtonNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASButtonNode.mm; sourceTree = "<group>"; };
E52405B21C8FEF03004DC8E7 /* ASDisplayNodeLayoutContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASDisplayNodeLayoutContext.mm; sourceTree = "<group>"; };
E52405B41C8FEF16004DC8E7 /* ASDisplayNodeLayoutContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASDisplayNodeLayoutContext.h; sourceTree = "<group>"; };
E52405B21C8FEF03004DC8E7 /* ASLayoutTransition.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASLayoutTransition.mm; sourceTree = "<group>"; };
E52405B41C8FEF16004DC8E7 /* ASLayoutTransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutTransition.h; sourceTree = "<group>"; };
E55D86311CA8A14000A0C26F /* ASLayoutable.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ASLayoutable.mm; path = AsyncDisplayKit/Layout/ASLayoutable.mm; sourceTree = "<group>"; };
E5711A2A1C840C81009619D4 /* ASIndexedNodeContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIndexedNodeContext.h; sourceTree = "<group>"; };
E5711A2D1C840C96009619D4 /* ASIndexedNodeContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIndexedNodeContext.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1305,8 +1305,8 @@
DE6EA3211C14000600183B10 /* ASDisplayNode+FrameworkPrivate.h */,
058D0A0B195D050800B7D73C /* ASDisplayNode+UIViewBridge.mm */,
058D0A0C195D050800B7D73C /* ASDisplayNodeInternal.h */,
E52405B41C8FEF16004DC8E7 /* ASDisplayNodeLayoutContext.h */,
E52405B21C8FEF03004DC8E7 /* ASDisplayNodeLayoutContext.mm */,
E52405B41C8FEF16004DC8E7 /* ASLayoutTransition.h */,
E52405B21C8FEF03004DC8E7 /* ASLayoutTransition.mm */,
69E100691CA89CB600D88C1B /* ASEnvironmentInternal.h */,
69E1006A1CA89CB600D88C1B /* ASEnvironmentInternal.mm */,
058D0A0D195D050800B7D73C /* ASImageNode+CGExtras.h */,
Expand Down Expand Up @@ -1595,7 +1595,7 @@
055B9FA81A1C154B00035D6D /* ASNetworkImageNode.h in Headers */,
ACF6ED2B1B17843500DA7C62 /* ASOverlayLayoutSpec.h in Headers */,
055F1A3819ABD413004DAFF1 /* ASRangeController.h in Headers */,
E52405B51C8FEF16004DC8E7 /* ASDisplayNodeLayoutContext.h in Headers */,
E52405B51C8FEF16004DC8E7 /* ASLayoutTransition.h in Headers */,
ACF6ED2D1B17843500DA7C62 /* ASRatioLayoutSpec.h in Headers */,
AC47D9451B3BB41900AAEE9D /* ASRelativeSize.h in Headers */,
291B63FB1AA53A7A000A71B3 /* ASScrollDirection.h in Headers */,
Expand Down Expand Up @@ -1769,7 +1769,7 @@
E5711A2C1C840C81009619D4 /* ASIndexedNodeContext.h in Headers */,
254C6B7B1BF94DF4003EC431 /* ASTextKitRenderer+Positioning.h in Headers */,
CC7FD9E21BB603FF005CCB2B /* ASPhotosFrameworkImageRequest.h in Headers */,
DE4843DC1C93EAC100A1F33B /* ASDisplayNodeLayoutContext.h in Headers */,
DE4843DC1C93EAC100A1F33B /* ASLayoutTransition.h in Headers */,
254C6B761BF94DF4003EC431 /* ASTextNodeTypes.h in Headers */,
34EFC7711B701CFF00AD841F /* ASStackLayoutSpec.h in Headers */,
2767E9411BB19BD600EA9B77 /* ASViewController.h in Headers */,
Expand Down Expand Up @@ -2077,7 +2077,7 @@
0442850F1BAA64EC00D16268 /* ASMultidimensionalArrayUtils.mm in Sources */,
7A06A73A1C35F08800FE8DAA /* ASRelativeLayoutSpec.mm in Sources */,
257754921BED28F300737CA5 /* ASEqualityHashHelpers.mm in Sources */,
E52405B31C8FEF03004DC8E7 /* ASDisplayNodeLayoutContext.mm in Sources */,
E52405B31C8FEF03004DC8E7 /* ASLayoutTransition.mm in Sources */,
69CB62AD1CB8165900024920 /* _ASDisplayViewAccessiblity.mm in Sources */,
257754AB1BEE44CD00737CA5 /* ASTextKitEntityAttribute.m in Sources */,
055F1A3919ABD413004DAFF1 /* ASRangeController.mm in Sources */,
Expand Down Expand Up @@ -2164,7 +2164,7 @@
buildActionMask = 2147483647;
files = (
9C70F2091CDABA36007D6C76 /* ASViewController.mm in Sources */,
DE4843DB1C93EAB100A1F33B /* ASDisplayNodeLayoutContext.mm in Sources */,
DE4843DB1C93EAB100A1F33B /* ASLayoutTransition.mm in Sources */,
B30BF6541C59D889004FCD53 /* ASLayoutManager.m in Sources */,
92DD2FE71BF4D0850074C9DD /* ASMapNode.mm in Sources */,
636EA1A51C7FF4EF00EE152F /* ASDefaultPlayButton.m in Sources */,
Expand Down
56 changes: 28 additions & 28 deletions AsyncDisplayKit/ASDisplayNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#import "_ASDisplayView.h"
#import "_ASScopeTimer.h"
#import "_ASCoreAnimationExtras.h"
#import "ASDisplayNodeLayoutContext.h"
#import "ASLayoutTransition.h"
#import "ASDisplayNodeExtras.h"
#import "ASTraitCollection.h"
#import "ASEqualityHelpers.h"
Expand Down Expand Up @@ -613,19 +613,19 @@ - (ASLayout *)measureWithSizeRange:(ASSizeRange)constrainedSize
ASLayout *newLayout = [self calculateLayoutThatFits:constrainedSize];

if (ASHierarchyStateIncludesLayoutPending(_hierarchyState)) {
_pendingLayoutContext = [[ASDisplayNodeLayoutContext alloc] initWithNode:self
pendingLayout:newLayout
pendingConstrainedSize:constrainedSize
previousLayout:previousLayout
previousConstrainedSize:previousConstrainedSize];
_pendingLayoutTransition = [[ASLayoutTransition alloc] initWithNode:self
pendingLayout:newLayout
pendingConstrainedSize:constrainedSize
previousLayout:previousLayout
previousConstrainedSize:previousConstrainedSize];
} else {
ASDisplayNodeLayoutContext *layoutContext;
ASLayoutTransition *layoutContext;
if (self.usesImplicitHierarchyManagement) {
layoutContext = [[ASDisplayNodeLayoutContext alloc] initWithNode:self
pendingLayout:newLayout
pendingConstrainedSize:constrainedSize
previousLayout:previousLayout
previousConstrainedSize:previousConstrainedSize];
layoutContext = [[ASLayoutTransition alloc] initWithNode:self
pendingLayout:newLayout
pendingConstrainedSize:constrainedSize
previousLayout:previousLayout
previousConstrainedSize:previousConstrainedSize];
}
[self applyLayout:newLayout constrainedSize:constrainedSize layoutContext:layoutContext];
[self _completeLayoutCalculation];
Expand Down Expand Up @@ -740,15 +740,15 @@ - (void)transitionLayoutWithSizeRange:(ASSizeRange)constrainedSize
completion();
}

_pendingLayoutContext = [[ASDisplayNodeLayoutContext alloc] initWithNode:self
pendingLayout:newLayout
pendingConstrainedSize:constrainedSize
previousLayout:previousLayout
previousConstrainedSize:previousConstrainedSize];
[_pendingLayoutContext applySubnodeInsertions];
_pendingLayoutTransition = [[ASLayoutTransition alloc] initWithNode:self
pendingLayout:newLayout
pendingConstrainedSize:constrainedSize
previousLayout:previousLayout
previousConstrainedSize:previousConstrainedSize];
[_pendingLayoutTransition applySubnodeInsertions];

_transitionContext = [[_ASTransitionContext alloc] initWithAnimation:animated
layoutDelegate:_pendingLayoutContext
layoutDelegate:_pendingLayoutTransition
completionDelegate:self];
[self animateLayoutTransition:_transitionContext];
});
Expand Down Expand Up @@ -849,9 +849,9 @@ - (void)animateLayoutTransition:(id<ASContextTransitioning>)context

- (void)didCompleteLayoutTransition:(id<ASContextTransitioning>)context
{
[_pendingLayoutContext applySubnodeRemovals];
[_pendingLayoutTransition applySubnodeRemovals];
[self _completeLayoutCalculation];
_pendingLayoutContext = nil;
_pendingLayoutTransition = nil;
}


Expand Down Expand Up @@ -2308,7 +2308,7 @@ - (void)setHierarchyState:(ASHierarchyState)newState
{
ASDN::MutexLocker l(_propertyLock);
_pendingTransitionID = ASLayoutableContextInvalidTransitionID;
_pendingLayoutContext = nil;
_pendingLayoutTransition = nil;
}
}
}
Expand Down Expand Up @@ -2341,17 +2341,17 @@ - (void)exitHierarchyState:(ASHierarchyState)hierarchyState
- (void)applyPendingLayoutContext
{
ASDN::MutexLocker l(_propertyLock);
if (_pendingLayoutContext) {
[self applyLayout:_pendingLayoutContext.pendingLayout
constrainedSize:_pendingLayoutContext.pendingConstrainedSize
layoutContext:_pendingLayoutContext];
_pendingLayoutContext = nil;
if (_pendingLayoutTransition) {
[self applyLayout:_pendingLayoutTransition.pendingLayout
constrainedSize:_pendingLayoutTransition.pendingConstrainedSize
layoutContext:_pendingLayoutTransition];
_pendingLayoutTransition = nil;
}
}

- (void)applyLayout:(ASLayout *)layout
constrainedSize:(ASSizeRange)constrainedSize
layoutContext:(ASDisplayNodeLayoutContext *)layoutContext
layoutContext:(ASLayoutTransition *)layoutContext
{
ASDN::MutexLocker l(_propertyLock);
_layout = layout;
Expand Down
4 changes: 2 additions & 2 deletions AsyncDisplayKit/Private/ASDisplayNodeInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#import "ASSentinel.h"
#import "ASThread.h"
#import "_ASTransitionContext.h"
#import "ASDisplayNodeLayoutContext.h"
#import "ASLayoutTransition.h"
#import "ASEnvironment.h"

#include <vector>
Expand Down Expand Up @@ -113,7 +113,7 @@ FOUNDATION_EXPORT NSString * const ASRenderingEngineDidDisplayNodesScheduledBefo
BOOL _usesImplicitHierarchyManagement;

int32_t _pendingTransitionID;
ASDisplayNodeLayoutContext *_pendingLayoutContext;
ASLayoutTransition *_pendingLayoutTransition;

ASDisplayNodeViewBlock _viewBlock;
ASDisplayNodeLayerBlock _layerBlock;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// ASDisplayNodeLayoutContext.h
// ASLayoutTransition.h
// AsyncDisplayKit
//
// Created by Huy Nguyen on 3/8/16.
Expand All @@ -12,7 +12,7 @@
@class ASDisplayNode;
@class ASLayout;

@interface ASDisplayNodeLayoutContext : NSObject <_ASTransitionContextLayoutDelegate>
@interface ASLayoutTransition : NSObject <_ASTransitionContextLayoutDelegate>

@property (nonatomic, readonly, weak) ASDisplayNode *node;
@property (nonatomic, readonly, strong) ASLayout *pendingLayout;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//
// ASDisplayNodeLayoutContext.mm
// ASLayoutTransition.mm
// AsyncDisplayKit
//
// Created by Huy Nguyen on 3/8/16.
// Copyright © 2016 Facebook. All rights reserved.
//

#import "ASDisplayNodeLayoutContext.h"
#import "ASLayoutTransition.h"

#import "ASDisplayNode.h"
#import "ASDisplayNodeInternal.h"
Expand All @@ -18,7 +18,7 @@
#import "NSArray+Diffing.h"
#import "ASEqualityHelpers.h"

@implementation ASDisplayNodeLayoutContext {
@implementation ASLayoutTransition {
ASDN::RecursiveMutex _propertyLock;
BOOL _calculatedSubnodeOperations;
NSArray<ASDisplayNode *> *_insertedSubnodes;
Expand Down

0 comments on commit 95f1ab4

Please sign in to comment.