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

Commit fe5a580

Browse files
committed
Merge branch 'master' into cells-with-view-controllers
2 parents 17c985d + 0cc229d commit fe5a580

8 files changed

Lines changed: 168 additions & 41 deletions

File tree

AsyncDisplayKit.xcodeproj/project.pbxproj

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,12 @@
255255
509E68641B3AEDB7009B9150 /* ASCollectionViewLayoutController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 205F0E1C1B373A2C007741D0 /* ASCollectionViewLayoutController.mm */; };
256256
509E68651B3AEDC5009B9150 /* CGRect+ASConvenience.h in Headers */ = {isa = PBXBuildFile; fileRef = 205F0E1F1B376416007741D0 /* CGRect+ASConvenience.h */; settings = {ATTRIBUTES = (Public, ); }; };
257257
509E68661B3AEDD7009B9150 /* CGRect+ASConvenience.m in Sources */ = {isa = PBXBuildFile; fileRef = 205F0E201B376416007741D0 /* CGRect+ASConvenience.m */; };
258+
68B0277A1C1A79CC0041016B /* ASDisplayNode+Beta.h in Headers */ = {isa = PBXBuildFile; fileRef = 68B027791C1A79CC0041016B /* ASDisplayNode+Beta.h */; settings = {ATTRIBUTES = (Public, ); }; };
259+
68B0277B1C1A79D60041016B /* ASDisplayNode+Beta.h in Headers */ = {isa = PBXBuildFile; fileRef = 68B027791C1A79CC0041016B /* ASDisplayNode+Beta.h */; settings = {ATTRIBUTES = (Public, ); }; };
260+
68EE0DBD1C1B4ED300BA1B99 /* ASMainSerialQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 68EE0DBB1C1B4ED300BA1B99 /* ASMainSerialQueue.h */; };
261+
68EE0DBE1C1B4ED300BA1B99 /* ASMainSerialQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 68EE0DBB1C1B4ED300BA1B99 /* ASMainSerialQueue.h */; };
262+
68EE0DBF1C1B4ED300BA1B99 /* ASMainSerialQueue.mm in Sources */ = {isa = PBXBuildFile; fileRef = 68EE0DBC1C1B4ED300BA1B99 /* ASMainSerialQueue.mm */; };
263+
68EE0DC01C1B4ED300BA1B99 /* ASMainSerialQueue.mm in Sources */ = {isa = PBXBuildFile; fileRef = 68EE0DBC1C1B4ED300BA1B99 /* ASMainSerialQueue.mm */; };
258264
6BDC61F61979037800E50D21 /* AsyncDisplayKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BDC61F51978FEA400E50D21 /* AsyncDisplayKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
259265
92DD2FE31BF4B97E0074C9DD /* ASMapNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 92DD2FE11BF4B97E0074C9DD /* ASMapNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
260266
92DD2FE41BF4B97E0074C9DD /* ASMapNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 92DD2FE21BF4B97E0074C9DD /* ASMapNode.mm */; };
@@ -531,7 +537,7 @@
531537
058D09D7195D050800B7D73C /* ASControlNode+Subclasses.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASControlNode+Subclasses.h"; sourceTree = "<group>"; };
532538
058D09D8195D050800B7D73C /* ASDisplayNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = ASDisplayNode.h; sourceTree = "<group>"; };
533539
058D09D9195D050800B7D73C /* ASDisplayNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = ASDisplayNode.mm; sourceTree = "<group>"; };
534-
058D09DA195D050800B7D73C /* ASDisplayNode+Subclasses.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = "ASDisplayNode+Subclasses.h"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
540+
058D09DA195D050800B7D73C /* ASDisplayNode+Subclasses.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = "ASDisplayNode+Subclasses.h"; sourceTree = "<group>"; };
535541
058D09DB195D050800B7D73C /* ASDisplayNodeExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASDisplayNodeExtras.h; sourceTree = "<group>"; };
536542
058D09DC195D050800B7D73C /* ASDisplayNodeExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASDisplayNodeExtras.mm; sourceTree = "<group>"; };
537543
058D09DD195D050800B7D73C /* ASImageNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASImageNode.h; sourceTree = "<group>"; };
@@ -659,6 +665,9 @@
659665
4640521B1A3F83C40061C0BA /* ASFlowLayoutController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASFlowLayoutController.h; sourceTree = "<group>"; };
660666
4640521C1A3F83C40061C0BA /* ASFlowLayoutController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASFlowLayoutController.mm; sourceTree = "<group>"; };
661667
4640521D1A3F83C40061C0BA /* ASLayoutController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASLayoutController.h; sourceTree = "<group>"; };
668+
68B027791C1A79CC0041016B /* ASDisplayNode+Beta.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASDisplayNode+Beta.h"; sourceTree = "<group>"; };
669+
68EE0DBB1C1B4ED300BA1B99 /* ASMainSerialQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASMainSerialQueue.h; sourceTree = "<group>"; };
670+
68EE0DBC1C1B4ED300BA1B99 /* ASMainSerialQueue.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASMainSerialQueue.mm; sourceTree = "<group>"; };
662671
6BDC61F51978FEA400E50D21 /* AsyncDisplayKit.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; path = AsyncDisplayKit.h; sourceTree = "<group>"; };
663672
92DD2FE11BF4B97E0074C9DD /* ASMapNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASMapNode.h; sourceTree = "<group>"; };
664673
92DD2FE21BF4B97E0074C9DD /* ASMapNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASMapNode.mm; sourceTree = "<group>"; };
@@ -872,6 +881,7 @@
872881
058D09D7195D050800B7D73C /* ASControlNode+Subclasses.h */,
873882
058D09D8195D050800B7D73C /* ASDisplayNode.h */,
874883
058D09D9195D050800B7D73C /* ASDisplayNode.mm */,
884+
68B027791C1A79CC0041016B /* ASDisplayNode+Beta.h */,
875885
058D09DA195D050800B7D73C /* ASDisplayNode+Subclasses.h */,
876886
058D09DB195D050800B7D73C /* ASDisplayNodeExtras.h */,
877887
058D09DC195D050800B7D73C /* ASDisplayNodeExtras.mm */,
@@ -998,6 +1008,8 @@
9981008
05F20AA31A15733C00DCA68A /* ASImageProtocols.h */,
9991009
4640521D1A3F83C40061C0BA /* ASLayoutController.h */,
10001010
292C59991A956527007E5DD6 /* ASLayoutRangeType.h */,
1011+
68EE0DBB1C1B4ED300BA1B99 /* ASMainSerialQueue.h */,
1012+
68EE0DBC1C1B4ED300BA1B99 /* ASMainSerialQueue.mm */,
10011013
058D09E8195D050800B7D73C /* ASMutableAttributedStringBuilder.h */,
10021014
058D09E9195D050800B7D73C /* ASMutableAttributedStringBuilder.m */,
10031015
055F1A3619ABD413004DAFF1 /* ASRangeController.h */,
@@ -1225,6 +1237,7 @@
12251237
058D0A74195D05F800B7D73C /* _ASPendingState.h in Headers */,
12261238
9C5586691BD549CB00B50E3A /* ASAsciiArtBoxCreator.h in Headers */,
12271239
058D0A76195D05F900B7D73C /* _ASScopeTimer.h in Headers */,
1240+
68EE0DBD1C1B4ED300BA1B99 /* ASMainSerialQueue.h in Headers */,
12281241
257754B31BEE44CD00737CA5 /* ASTextKitTailTruncater.h in Headers */,
12291242
205F0E191B37339C007741D0 /* ASAbstractLayoutController.h in Headers */,
12301243
058D0A82195D060300B7D73C /* ASAssert.h in Headers */,
@@ -1257,6 +1270,7 @@
12571270
058D0A84195D060300B7D73C /* ASDisplayNodeExtraIvars.h in Headers */,
12581271
AC7A2C171BDE11DF0093FE1A /* ASTableViewInternal.h in Headers */,
12591272
058D0A4D195D05CB00B7D73C /* ASDisplayNodeExtras.h in Headers */,
1273+
68B0277A1C1A79CC0041016B /* ASDisplayNode+Beta.h in Headers */,
12601274
257754B11BEE44CD00737CA5 /* ASTextKitShadower.h in Headers */,
12611275
058D0A7B195D05F900B7D73C /* ASDisplayNodeInternal.h in Headers */,
12621276
0587F9BD1A7309ED00AFF0BA /* ASEditableTextNode.h in Headers */,
@@ -1345,6 +1359,7 @@
13451359
B35062491B010EFD0018CF92 /* _ASCoreAnimationExtras.h in Headers */,
13461360
B350620F1B010EFD0018CF92 /* _ASDisplayLayer.h in Headers */,
13471361
B35062111B010EFD0018CF92 /* _ASDisplayView.h in Headers */,
1362+
68EE0DBE1C1B4ED300BA1B99 /* ASMainSerialQueue.h in Headers */,
13481363
B350624B1B010EFD0018CF92 /* _ASPendingState.h in Headers */,
13491364
9C55866C1BD54A3000B50E3A /* ASAsciiArtBoxCreator.h in Headers */,
13501365
B350624D1B010EFD0018CF92 /* _ASScopeTimer.h in Headers */,
@@ -1419,6 +1434,7 @@
14191434
34EFC76E1B701CF400AD841F /* ASRatioLayoutSpec.h in Headers */,
14201435
34EFC7651B701CCC00AD841F /* ASRelativeSize.h in Headers */,
14211436
254C6B741BF94DF4003EC431 /* ASTextNodeWordKerner.h in Headers */,
1437+
68B0277B1C1A79D60041016B /* ASDisplayNode+Beta.h in Headers */,
14221438
B350622D1B010EFD0018CF92 /* ASScrollDirection.h in Headers */,
14231439
254C6B751BF94DF4003EC431 /* ASTextKitHelpers.h in Headers */,
14241440
B35062081B010EFD0018CF92 /* ASScrollNode.h in Headers */,
@@ -1650,6 +1666,7 @@
16501666
AC026B711BD57DBF00BBC17E /* _ASHierarchyChangeSet.m in Sources */,
16511667
257754BF1BEE458E00737CA5 /* ASTextKitCoreTextAdditions.m in Sources */,
16521668
058D0A18195D050800B7D73C /* _ASDisplayLayer.mm in Sources */,
1669+
68EE0DBF1C1B4ED300BA1B99 /* ASMainSerialQueue.mm in Sources */,
16531670
058D0A19195D050800B7D73C /* _ASDisplayView.mm in Sources */,
16541671
9C55866A1BD549CB00B50E3A /* ASAsciiArtBoxCreator.m in Sources */,
16551672
058D0A27195D050800B7D73C /* _ASPendingState.m in Sources */,
@@ -1777,6 +1794,7 @@
17771794
AC026B721BD57DBF00BBC17E /* _ASHierarchyChangeSet.m in Sources */,
17781795
B35062421B010EFD0018CF92 /* _ASAsyncTransactionGroup.m in Sources */,
17791796
B350624A1B010EFD0018CF92 /* _ASCoreAnimationExtras.mm in Sources */,
1797+
68EE0DC01C1B4ED300BA1B99 /* ASMainSerialQueue.mm in Sources */,
17801798
2767E9421BB19BD600EA9B77 /* ASViewController.m in Sources */,
17811799
B35062101B010EFD0018CF92 /* _ASDisplayLayer.mm in Sources */,
17821800
9C55866B1BD54A1900B50E3A /* ASAsciiArtBoxCreator.m in Sources */,
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* Copyright (c) 2014-present, Facebook, Inc.
2+
* All rights reserved.
3+
*
4+
* This source code is licensed under the BSD-style license found in the
5+
* LICENSE file in the root directory of this source tree. An additional grant
6+
* of patent rights can be found in the PATENTS file in the same directory.
7+
*/
8+
9+
@interface ASDisplayNode (Beta)
10+
11+
/** @name Layout */
12+
13+
14+
/**
15+
* @abstract Recursively ensures node and all subnodes are displayed.
16+
*/
17+
- (void)recursivelyEnsureDisplay;
18+
19+
@end

AsyncDisplayKit/ASEditableTextNode.mm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ - (void)didLoad
124124
textView.opaque = NO;
125125
}
126126
textView.textContainerInset = self.textContainerInset;
127-
textView.clipsToBounds = NO; // We don't want selection handles cut off.
128127
};
129128

130129
// Create and configure the placeholder text view.

AsyncDisplayKit/ASTextNode.mm

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -223,25 +223,13 @@ - (void)didLoad
223223
- (void)setFrame:(CGRect)frame
224224
{
225225
[super setFrame:frame];
226-
if (!CGSizeEqualToSize(frame.size, _constrainedSize)) {
227-
// Our bounds have changed to a size that is not identical to our constraining size,
228-
// so our previous layout information is invalid, and TextKit may draw at the
229-
// incorrect origin.
230-
_constrainedSize = CGSizeMake(-INFINITY, -INFINITY);
231-
[self _invalidateRenderer];
232-
}
226+
[self _invalidateRendererIfNeeded:frame.size];
233227
}
234228

235229
- (void)setBounds:(CGRect)bounds
236230
{
237231
[super setBounds:bounds];
238-
if (!CGSizeEqualToSize(bounds.size, _constrainedSize)) {
239-
// Our bounds have changed to a size that is not identical to our constraining size,
240-
// so our previous layout information is invalid, and TextKit may draw at the
241-
// incorrect origin.
242-
_constrainedSize = CGSizeMake(-INFINITY, -INFINITY);
243-
[self _invalidateRenderer];
244-
}
232+
[self _invalidateRendererIfNeeded:bounds.size];
245233
}
246234

247235
#pragma mark - Renderer Management
@@ -283,6 +271,27 @@ - (void)_invalidateRenderer
283271
_renderer = nil;
284272
}
285273

274+
- (void)_invalidateRendererIfNeeded
275+
{
276+
[self _invalidateRendererIfNeeded:self.bounds.size];
277+
}
278+
279+
- (void)_invalidateRendererIfNeeded:(CGSize)newSize
280+
{
281+
if ([self _needInvalidateRenderer:newSize]) {
282+
// Our bounds of frame have changed to a size that is not identical to our constraining size,
283+
// so our previous layout information is invalid, and TextKit may draw at the
284+
// incorrect origin.
285+
_constrainedSize = CGSizeMake(-INFINITY, -INFINITY);
286+
[self _invalidateRenderer];
287+
}
288+
}
289+
290+
- (BOOL)_needInvalidateRenderer:(CGSize)newSize
291+
{
292+
return !CGSizeEqualToSize(newSize, _constrainedSize);
293+
}
294+
286295
#pragma mark - Modifying User Text
287296

288297
- (void)setAttributedString:(NSAttributedString *)attributedString {
@@ -377,6 +386,8 @@ + (void)drawRect:(CGRect)bounds withParameters:(ASTextNodeDrawParameters *)param
377386

378387
- (NSObject *)drawParametersForAsyncLayer:(_ASDisplayLayer *)layer
379388
{
389+
[self _invalidateRendererIfNeeded];
390+
380391
// Offset the text origin by any shadow padding
381392
UIEdgeInsets shadowPadding = [self shadowPadding];
382393
CGPoint textOrigin = CGPointMake(self.bounds.origin.x - shadowPadding.left, self.bounds.origin.y - shadowPadding.top);

AsyncDisplayKit/Details/ASCollectionDataController.mm

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ - (instancetype)initWithAsyncDataFetching:(BOOL)asyncDataFetchingEnabled
4040

4141
- (void)prepareForReloadData
4242
{
43-
NSArray *kinds = [self supplementaryKinds];
44-
for (NSString *kind in kinds) {
43+
for (NSString *kind in [self supplementaryKinds]) {
4544
LOG(@"Populating elements of kind: %@", kind);
4645
NSMutableArray *indexPaths = [NSMutableArray array];
4746
NSMutableArray *nodes = [NSMutableArray array];
@@ -83,8 +82,7 @@ - (void)willReloadData
8382

8483
- (void)prepareForInsertSections:(NSIndexSet *)sections
8584
{
86-
NSArray *kinds = [self supplementaryKinds];
87-
for (NSString *kind in kinds) {
85+
for (NSString *kind in [self supplementaryKinds]) {
8886
LOG(@"Populating elements of kind: %@, for sections: %@", kind, sections);
8987
NSMutableArray *nodes = [NSMutableArray array];
9088
NSMutableArray *indexPaths = [NSMutableArray array];
@@ -116,8 +114,7 @@ - (void)willInsertSections:(NSIndexSet *)sections
116114

117115
- (void)willDeleteSections:(NSIndexSet *)sections
118116
{
119-
NSArray *kinds = [self supplementaryKinds];
120-
for (NSString *kind in kinds) {
117+
for (NSString *kind in [self supplementaryKinds]) {
121118
NSArray *indexPaths = ASIndexPathsForMultidimensionalArrayAtIndexSet([self editingNodesOfKind:kind], sections);
122119

123120
[self deleteNodesOfKind:kind atIndexPaths:indexPaths completion:nil];
@@ -127,8 +124,7 @@ - (void)willDeleteSections:(NSIndexSet *)sections
127124

128125
- (void)prepareForReloadSections:(NSIndexSet *)sections
129126
{
130-
NSArray *kinds = [self supplementaryKinds];
131-
for (NSString *kind in kinds) {
127+
for (NSString *kind in [self supplementaryKinds]) {
132128
NSMutableArray *nodes = [NSMutableArray array];
133129
NSMutableArray *indexPaths = [NSMutableArray array];
134130
[self _populateSupplementaryNodesOfKind:kind withSections:sections mutableNodes:nodes mutableIndexPaths:indexPaths];
@@ -154,8 +150,7 @@ - (void)willReloadSections:(NSIndexSet *)sections
154150

155151
- (void)willMoveSection:(NSInteger)section toSection:(NSInteger)newSection
156152
{
157-
NSArray *kinds = [self supplementaryKinds];
158-
for (NSString *kind in kinds) {
153+
for (NSString *kind in [self supplementaryKinds]) {
159154
NSArray *indexPaths = ASIndexPathsForMultidimensionalArrayAtIndexSet([self editingNodesOfKind:kind], [NSIndexSet indexSetWithIndex:section]);
160155
NSArray *nodes = ASFindElementsInMultidimensionalArrayAtIndexPaths([self editingNodesOfKind:kind], indexPaths);
161156
[self deleteNodesOfKind:kind atIndexPaths:indexPaths completion:nil];

0 commit comments

Comments
 (0)