86
86
int setLayoutMargins:1 ;
87
87
int setPreservesSuperviewLayoutMargins:1 ;
88
88
int setInsetsLayoutMarginsFromSafeArea:1 ;
89
+ int setActions:1 ;
89
90
} ASPendingStateFlags;
90
91
92
+
93
+ static constexpr ASPendingStateFlags kZeroFlags = {0 };
94
+
91
95
@implementation _ASPendingState
92
96
{
93
97
@package // Expose all ivars for ASDisplayNode to bypass getters for efficiency
@@ -140,6 +144,7 @@ @implementation _ASPendingState
140
144
CGPoint accessibilityActivationPoint;
141
145
UIBezierPath *accessibilityPath;
142
146
UISemanticContentAttribute semanticContentAttribute API_AVAILABLE (ios (9.0 ), tvos (9.0 ));
147
+ NSDictionary <NSString *, id <CAAction >> *actions;
143
148
144
149
ASPendingStateFlags _flags;
145
150
}
@@ -209,6 +214,7 @@ ASDISPLAYNODE_INLINE void ASPendingStateApplyMetricsToLayer(_ASPendingState *sta
209
214
@synthesize layoutMargins=layoutMargins;
210
215
@synthesize preservesSuperviewLayoutMargins=preservesSuperviewLayoutMargins;
211
216
@synthesize insetsLayoutMarginsFromSafeArea=insetsLayoutMarginsFromSafeArea;
217
+ @synthesize actions=actions;
212
218
213
219
static CGColorRef blackColorRef = NULL ;
214
220
static UIColor *defaultTintColor = nil ;
@@ -586,6 +592,12 @@ - (void)setSemanticContentAttribute:(UISemanticContentAttribute)attribute API_AV
586
592
_flags.setSemanticContentAttribute = YES ;
587
593
}
588
594
595
+ - (void )setActions : (NSDictionary <NSString *,id<CAAction >> *)actionsArg
596
+ {
597
+ actions = [actionsArg copy ];
598
+ _flags.setActions = YES ;
599
+ }
600
+
589
601
- (BOOL )isAccessibilityElement
590
602
{
591
603
return isAccessibilityElement;
@@ -917,6 +929,9 @@ - (void)applyToLayer:(CALayer *)layer
917
929
if (flags.setOpaque )
918
930
ASDisplayNodeAssert (layer.opaque == opaque, @" Didn't set opaque as desired" );
919
931
932
+ if (flags.setActions )
933
+ layer.actions = actions;
934
+
920
935
ASPendingStateApplyMetricsToLayer (self, layer);
921
936
922
937
if (flags.needsLayout )
@@ -936,7 +951,7 @@ - (void)applyToView:(UIView *)view withSpecialPropertiesHandling:(BOOL)specialPr
936
951
because a different setter would be called.
937
952
*/
938
953
939
- CALayer *layer = view.layer ;
954
+ unowned CALayer *layer = view.layer ;
940
955
941
956
ASPendingStateFlags flags = _flags;
942
957
if (__shouldSetNeedsDisplay (layer)) {
@@ -979,6 +994,9 @@ - (void)applyToView:(UIView *)view withSpecialPropertiesHandling:(BOOL)specialPr
979
994
if (flags.setRasterizationScale )
980
995
layer.rasterizationScale = rasterizationScale;
981
996
997
+ if (flags.setActions )
998
+ layer.actions = actions;
999
+
982
1000
if (flags.setClipsToBounds )
983
1001
view.clipsToBounds = clipsToBounds;
984
1002
@@ -1272,7 +1290,7 @@ + (_ASPendingState *)pendingViewStateFromView:(UIView *)view
1272
1290
1273
1291
- (void )clearChanges
1274
1292
{
1275
- _flags = (ASPendingStateFlags){ 0 } ;
1293
+ _flags = kZeroFlags ;
1276
1294
}
1277
1295
1278
1296
- (BOOL )hasSetNeedsLayout
@@ -1287,69 +1305,7 @@ - (BOOL)hasSetNeedsDisplay
1287
1305
1288
1306
- (BOOL )hasChanges
1289
1307
{
1290
- ASPendingStateFlags flags = _flags;
1291
-
1292
- return (flags.setAnchorPoint
1293
- || flags.setPosition
1294
- || flags.setZPosition
1295
- || flags.setFrame
1296
- || flags.setBounds
1297
- || flags.setPosition
1298
- || flags.setTransform
1299
- || flags.setSublayerTransform
1300
- || flags.setContents
1301
- || flags.setContentsGravity
1302
- || flags.setContentsRect
1303
- || flags.setContentsCenter
1304
- || flags.setContentsScale
1305
- || flags.setRasterizationScale
1306
- || flags.setClipsToBounds
1307
- || flags.setBackgroundColor
1308
- || flags.setTintColor
1309
- || flags.setHidden
1310
- || flags.setAlpha
1311
- || flags.setCornerRadius
1312
- || flags.setContentMode
1313
- || flags.setUserInteractionEnabled
1314
- || flags.setExclusiveTouch
1315
- || flags.setShadowOpacity
1316
- || flags.setShadowOffset
1317
- || flags.setShadowRadius
1318
- || flags.setShadowColor
1319
- || flags.setBorderWidth
1320
- || flags.setBorderColor
1321
- || flags.setAutoresizingMask
1322
- || flags.setAutoresizesSubviews
1323
- || flags.setNeedsDisplayOnBoundsChange
1324
- || flags.setAllowsGroupOpacity
1325
- || flags.setAllowsEdgeAntialiasing
1326
- || flags.setEdgeAntialiasingMask
1327
- || flags.needsDisplay
1328
- || flags.needsLayout
1329
- || flags.setAsyncTransactionContainer
1330
- || flags.setOpaque
1331
- || flags.setSemanticContentAttribute
1332
- || flags.setLayoutMargins
1333
- || flags.setPreservesSuperviewLayoutMargins
1334
- || flags.setInsetsLayoutMarginsFromSafeArea
1335
- || flags.setIsAccessibilityElement
1336
- || flags.setAccessibilityLabel
1337
- || flags.setAccessibilityAttributedLabel
1338
- || flags.setAccessibilityHint
1339
- || flags.setAccessibilityAttributedHint
1340
- || flags.setAccessibilityValue
1341
- || flags.setAccessibilityAttributedValue
1342
- || flags.setAccessibilityTraits
1343
- || flags.setAccessibilityFrame
1344
- || flags.setAccessibilityLanguage
1345
- || flags.setAccessibilityElementsHidden
1346
- || flags.setAccessibilityViewIsModal
1347
- || flags.setShouldGroupAccessibilityChildren
1348
- || flags.setAccessibilityIdentifier
1349
- || flags.setAccessibilityNavigationStyle
1350
- || flags.setAccessibilityHeaderElements
1351
- || flags.setAccessibilityActivationPoint
1352
- || flags.setAccessibilityPath );
1308
+ return memcmp (&_flags, &kZeroFlags , sizeof (ASPendingStateFlags));
1353
1309
}
1354
1310
1355
1311
- (void )dealloc
0 commit comments