diff options
Diffstat (limited to 'platform/darwin/src/MGLAttributionInfo.mm')
-rw-r--r-- | platform/darwin/src/MGLAttributionInfo.mm | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/platform/darwin/src/MGLAttributionInfo.mm b/platform/darwin/src/MGLAttributionInfo.mm index 2546808b34..fa2ae787a5 100644 --- a/platform/darwin/src/MGLAttributionInfo.mm +++ b/platform/darwin/src/MGLAttributionInfo.mm @@ -18,7 +18,7 @@ if (!htmlString) { return @[]; } - + NSDictionary *options = @{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: @(NSUTF8StringEncoding), @@ -56,7 +56,7 @@ } NSString *styledHTML = [NSString stringWithFormat:@"<style type='text/css'>%@</style>%@", css, htmlString]; NSData *htmlData = [styledHTML dataUsingEncoding:NSUTF8StringEncoding]; - + #if TARGET_OS_IPHONE NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithData:htmlData options:options @@ -67,7 +67,7 @@ options:options documentAttributes:nil]; #endif - + NSMutableArray *infos = [NSMutableArray array]; [attributedString enumerateAttribute:NSLinkAttributeName inRange:attributedString.mgl_wholeRange @@ -75,7 +75,7 @@ usingBlock: ^(id _Nullable value, NSRange range, BOOL * _Nonnull stop) { NSCAssert(!value || [value isKindOfClass:[NSURL class]], @"If present, URL attribute must be an NSURL."); - + // Detect feedback links by the bogus style rule applied above. NSNumber *strokeWidth = [attributedString attribute:NSStrokeWidthAttributeName atIndex:range.location @@ -85,14 +85,14 @@ isFeedbackLink = YES; [attributedString removeAttribute:NSStrokeWidthAttributeName range:range]; } - + // Omit whitespace-only strings. NSAttributedString *title = [[attributedString attributedSubstringFromRange:range] mgl_attributedStringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; if (!title.length) { return; } - + MGLAttributionInfo *info = [[MGLAttributionInfo alloc] initWithTitle:title URL:value]; info.feedbackLink = isFeedbackLink; [infos addObject:info]; @@ -124,7 +124,7 @@ if (!self.feedbackLink) { return nil; } - + NSURLComponents *components = [NSURLComponents componentsWithURL:self.URL resolvingAgainstBaseURL:NO]; components.fragment = [NSString stringWithFormat:@"/%.5f/%.5f/%i", centerCoordinate.longitude, centerCoordinate.latitude, (int)round(zoomLevel + 1)]; @@ -142,7 +142,7 @@ /** Returns whether the given attribution info object overlaps with the receiver by its plain text title. - + @return `NSOrderedAscending` if the given object is a superset of the receiver, `NSOrderedDescending` if it is a subset of the receiver, or `NSOrderedSame` if there is no overlap. @@ -179,14 +179,14 @@ didInsertInfo = YES; } break; - + case NSOrderedAscending: // The info object we’re adding is a subset of the existing one. // Don’t add the object and stop looking. shouldAddInfo = NO; *stop = YES; break; - + default: break; } |