Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing instance variables in ASTextNode and warnings cleanup #trivial #984

Merged
merged 2 commits into from
Jun 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/ASDisplayNodeExtras.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,6 @@ AS_EXTERN void ASDisplayNodeDisableHierarchyNotifications(ASDisplayNode *node);
AS_EXTERN void ASDisplayNodeEnableHierarchyNotifications(ASDisplayNode *node);

// Not to be called directly.
AS_EXTERN void _ASSetDebugNames(Class owningClass, NSString *names, ASDisplayNode *object, ...);
AS_EXTERN void _ASSetDebugNames(Class owningClass, NSString *names, ASDisplayNode * _Nullable object, ...);

NS_ASSUME_NONNULL_END
5 changes: 5 additions & 0 deletions Source/ASRunLoopQueue.mm
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ - (void)releaseObjectInBackground:(id _Nullable __strong *)objectPtr
ASDisplayNodeFailAssert(@"Abstract method.");
}

- (void)drain
{
ASDisplayNodeFailAssert(@"Abstract method.");
}

@end

@implementation ASDeallocQueueV1 {
Expand Down
27 changes: 26 additions & 1 deletion Source/ASTextNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,12 @@ @implementation ASTextNode {

NSAttributedString *_attributedText;
NSAttributedString *_truncationAttributedText;
NSAttributedString *_additionalTruncationMessage;
NSAttributedString *_composedTruncationText;
NSArray<NSNumber *> *_pointSizeScaleFactors;
NSLineBreakMode _truncationMode;

NSUInteger _maximumNumberOfLines;

NSString *_highlightedLinkAttributeName;
id _highlightedLinkAttributeValue;
Expand Down Expand Up @@ -1175,32 +1180,52 @@ - (void)setAdditionalTruncationMessage:(NSAttributedString *)additionalTruncatio
}
}

- (NSAttributedString *)additionalTruncationMessage
{
return ASLockedSelf(_additionalTruncationMessage);
}

- (void)setTruncationMode:(NSLineBreakMode)truncationMode
{
if (ASLockedSelfCompareAssign(_truncationMode, truncationMode)) {
[self setNeedsDisplay];
}
}

- (NSLineBreakMode)truncationMode
{
return ASLockedSelf(_truncationMode);
}

- (BOOL)isTruncated
{
return ASLockedSelf([[self _locked_renderer] isTruncated]);
}

- (void)setPointSizeScaleFactors:(NSArray *)pointSizeScaleFactors
- (void)setPointSizeScaleFactors:(NSArray<NSNumber *> *)pointSizeScaleFactors
{
if (ASLockedSelfCompareAssignCopy(_pointSizeScaleFactors, pointSizeScaleFactors)) {
[self setNeedsDisplay];
}
}

- (NSArray<NSNumber *> *)pointSizeScaleFactors
{
return ASLockedSelf(_pointSizeScaleFactors);
}

- (void)setMaximumNumberOfLines:(NSUInteger)maximumNumberOfLines
{
if (ASLockedSelfCompareAssign(_maximumNumberOfLines, maximumNumberOfLines)) {
[self setNeedsDisplay];
}
}

- (NSUInteger)maximumNumberOfLines
{
return ASLockedSelf(_maximumNumberOfLines);
}

- (NSUInteger)lineCount
{
return ASLockedSelf([[self _locked_renderer] lineCount]);
Expand Down
2 changes: 1 addition & 1 deletion Source/ASTextNode2.mm
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ - (void)setPointSizeScaleFactors:(NSArray<NSNumber *> *)scaleFactors
}
}

- (NSArray *)pointSizeScaleFactors
- (NSArray<NSNumber *> *)pointSizeScaleFactors
{
return ASLockedSelf(_pointSizeScaleFactors);
}
Expand Down