Changeset 195559 in webkit
- Timestamp:
- Jan 25, 2016 3:12:44 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r195551 r195559 1 2016-01-25 Sam Weinig <sam@webkit.org> 2 3 Fix the ASAN build. 4 5 * WebCore.xcodeproj/project.pbxproj: 6 * editing/cocoa/DataDetection.mm: 7 * platform/cocoa/DataDetectorsCoreSoftLink.mm: Added. 8 * platform/cocoa/DataDetectorsCoreSoftLink.h: Added. 9 * platform/spi/cocoa/DataDetectorsCoreSPI.h: 10 1 11 2016-01-25 Alex Christensen <achristensen@webkit.org> 2 12 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r195530 r195559 2749 2749 7C74D43B1882400400E5ED57 /* UTextProviderUTF16.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C74D4391882400400E5ED57 /* UTextProviderUTF16.cpp */; }; 2750 2750 7C74D43C1882400400E5ED57 /* UTextProviderUTF16.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C74D43A1882400400E5ED57 /* UTextProviderUTF16.h */; }; 2751 7C7941E41C56C29300A4C58E /* DataDetectorsCoreSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C7941E21C56C29300A4C58E /* DataDetectorsCoreSoftLink.mm */; }; 2752 7C7941E51C56C29300A4C58E /* DataDetectorsCoreSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C7941E31C56C29300A4C58E /* DataDetectorsCoreSoftLink.h */; }; 2751 2753 7C91A38F1B498ABE003F9EFA /* JSNodeOrString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C91A38D1B498ABE003F9EFA /* JSNodeOrString.cpp */; }; 2752 2754 7C91A3901B498ABE003F9EFA /* JSNodeOrString.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C91A38E1B498ABE003F9EFA /* JSNodeOrString.h */; }; … … 10298 10300 7C74D4391882400400E5ED57 /* UTextProviderUTF16.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTextProviderUTF16.cpp; sourceTree = "<group>"; }; 10299 10301 7C74D43A1882400400E5ED57 /* UTextProviderUTF16.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProviderUTF16.h; sourceTree = "<group>"; }; 10302 7C7941E21C56C29300A4C58E /* DataDetectorsCoreSoftLink.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DataDetectorsCoreSoftLink.mm; sourceTree = "<group>"; }; 10303 7C7941E31C56C29300A4C58E /* DataDetectorsCoreSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataDetectorsCoreSoftLink.h; sourceTree = "<group>"; }; 10300 10304 7C91A38D1B498ABE003F9EFA /* JSNodeOrString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNodeOrString.cpp; sourceTree = "<group>"; }; 10301 10305 7C91A38E1B498ABE003F9EFA /* JSNodeOrString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNodeOrString.h; sourceTree = "<group>"; }; … … 19787 19791 children = ( 19788 19792 A14090FA1AA51E1D0091191A /* ContentFilterUnblockHandlerCocoa.mm */, 19793 7C7941E21C56C29300A4C58E /* DataDetectorsCoreSoftLink.mm */, 19794 7C7941E31C56C29300A4C58E /* DataDetectorsCoreSoftLink.h */, 19789 19795 5D8C4DBD1428222C0026CE72 /* DisplaySleepDisablerCocoa.cpp */, 19790 19796 5D8C4DBE1428222C0026CE72 /* DisplaySleepDisablerCocoa.h */, … … 19811 19817 310D71941B335C9D009C7B73 /* ThemeCocoa.h */, 19812 19818 46DB7D561B20FE3C005651B2 /* VNodeTrackerCocoa.cpp */, 19819 CDC979F31C498C0900DB50D4 /* WebCoreNSErrorExtras.h */, 19813 19820 CDC979F21C498C0900DB50D4 /* WebCoreNSErrorExtras.mm */, 19814 CDC979F31C498C0900DB50D4 /* WebCoreNSErrorExtras.h */,19815 19821 52131E581C4F15220033F802 /* WebVideoFullscreenInterface.h */, 19816 19822 ); … … 24909 24915 8348BFAC1B85729800912F36 /* ClassCollection.h in Headers */, 24910 24916 BCC0657E0F3CE1B700CD2D87 /* ClientRect.h in Headers */, 24917 7C7941E51C56C29300A4C58E /* DataDetectorsCoreSoftLink.h in Headers */, 24911 24918 BCC065810F3CE1B700CD2D87 /* ClientRectList.h in Headers */, 24912 24919 85031B400A44EFC700F992E0 /* ClipboardEvent.h in Headers */, … … 30831 30838 508CCA5013CF106B003151F3 /* RenderFlowThread.cpp in Sources */, 30832 30839 A871DED40A1530C700B12A68 /* RenderFrame.cpp in Sources */, 30840 7C7941E41C56C29300A4C58E /* DataDetectorsCoreSoftLink.mm in Sources */, 30833 30841 0FD3080E117CF7E700A791F7 /* RenderFrameBase.cpp in Sources */, 30834 30842 A871DED20A1530C700B12A68 /* RenderFrameSet.cpp in Sources */, -
trunk/Source/WebCore/editing/cocoa/DataDetection.mm
r195494 r195559 29 29 #import "Attr.h" 30 30 #import "CSSStyleDeclaration.h" 31 #import "DataDetectorsCoreSoftLink.h" 31 32 #import "DataDetectorsSPI.h" 32 33 #import "FrameView.h" … … 153 154 return NO; 154 155 155 static NSSet *urlTypes = [[NSSet setWithObjects: (NSString *)get DDBinderHttpURLKey(), (NSString *)getDDBinderWebURLKey(), (NSString *)getDDBinderMailURLKey(), (NSString *)getDDBinderGenericURLKey(), (NSString *)getDDBinderEmailKey(), nil] retain];156 return [urlTypes containsObject:(NSString *) DDResultGetType(result)];156 static NSSet *urlTypes = [[NSSet setWithObjects: (NSString *)get_DataDetectorsCore_DDBinderHttpURLKey(), (NSString *)get_DataDetectorsCore_DDBinderWebURLKey(), (NSString *)get_DataDetectorsCore_DDBinderMailURLKey(), (NSString *)get_DataDetectorsCore_DDBinderGenericURLKey(), (NSString *)get_DataDetectorsCore_DDBinderEmailKey(), nil] retain]; 157 return [urlTypes containsObject:(NSString *)softLink_DataDetectorsCore_DDResultGetType(result)]; 157 158 } 158 159 159 160 static NSString *constructURLStringForResult(DDResultRef currentResult, NSString *resultIdentifier, NSDate *referenceDate, NSTimeZone *referenceTimeZone, DataDetectorTypes detectionTypes) 160 161 { 161 if (! DDResultHasProperties(currentResult, DDResultPropertyPassiveDisplay))162 if (!softLink_DataDetectorsCore_DDResultHasProperties(currentResult, DDResultPropertyPassiveDisplay)) 162 163 return nil; 163 164 164 165 DDURLifierPhoneNumberDetectionTypes phoneTypes = (detectionTypes & DataDetectorTypePhoneNumber) ? DDURLifierPhoneNumberDetectionRegular : DDURLifierPhoneNumberDetectionNone; 165 DDResultCategory category = DDResultGetCategory(currentResult);166 CFStringRef type = DDResultGetType(currentResult);166 DDResultCategory category = softLink_DataDetectorsCore_DDResultGetCategory(currentResult); 167 CFStringRef type = softLink_DataDetectorsCore_DDResultGetType(currentResult); 167 168 168 169 if (((detectionTypes & DataDetectorTypeAddress) && (DDResultCategoryAddress == category)) 169 || ((detectionTypes & DataDetectorTypeTrackingNumber) && (CFStringCompare(get DDBinderTrackingNumberKey(), type, 0) == kCFCompareEqualTo))170 || ((detectionTypes & DataDetectorTypeFlight) && (CFStringCompare(get DDBinderFlightInformationKey(), type, 0) == kCFCompareEqualTo))170 || ((detectionTypes & DataDetectorTypeTrackingNumber) && (CFStringCompare(get_DataDetectorsCore_DDBinderTrackingNumberKey(), type, 0) == kCFCompareEqualTo)) 171 || ((detectionTypes & DataDetectorTypeFlight) && (CFStringCompare(get_DataDetectorsCore_DDBinderFlightInformationKey(), type, 0) == kCFCompareEqualTo)) 171 172 || ((detectionTypes & DataDetectorTypePhoneNumber) && (DDResultCategoryPhoneNumber == category)) 172 173 || ((detectionTypes & DataDetectorTypeLink) && resultIsURL(currentResult))) { 173 174 174 return DDURLStringForResult(currentResult, resultIdentifier, phoneTypes, referenceDate, referenceTimeZone);175 return softLink_DataDetectorsCore_DDURLStringForResult(currentResult, resultIdentifier, phoneTypes, referenceDate, referenceTimeZone); 175 176 } 176 177 if ((detectionTypes & DataDetectorTypeCalendarEvent) && (DDResultCategoryCalendarEvent == category)) { 177 if (! DDResultIsPastDate(currentResult, (CFDateRef)referenceDate, (CFTimeZoneRef)referenceTimeZone))178 return DDURLStringForResult(currentResult, resultIdentifier, phoneTypes, referenceDate, referenceTimeZone);178 if (!softLink_DataDetectorsCore_DDResultIsPastDate(currentResult, (CFDateRef)referenceDate, (CFTimeZoneRef)referenceTimeZone)) 179 return softLink_DataDetectorsCore_DDURLStringForResult(currentResult, resultIdentifier, phoneTypes, referenceDate, referenceTimeZone); 179 180 } 180 181 return nil; … … 190 191 return; 191 192 192 BOOL nodeIsDDAnchor = is<HTMLAnchorElement>(*node) && downcast<Element>(*node).getAttribute(get DDURLScheme()) == "true";193 BOOL nodeIsDDAnchor = is<HTMLAnchorElement>(*node) && downcast<Element>(*node).getAttribute(get_DataDetectorsCore_DDURLScheme()) == "true"; 193 194 194 195 RefPtr<NodeList> children = node->childNodes(); … … 219 220 while (node) { 220 221 if (is<HTMLAnchorElement>(*node)) { 221 if (downcast<Element>(*node).getAttribute(get DDURLScheme()) != "true")222 if (downcast<Element>(*node).getAttribute(get_DataDetectorsCore_DDURLScheme()) != "true") 222 223 return true; 223 224 removeResultLinksFromAnchor(node, node->parentElement()); … … 230 231 while (node) { 231 232 if (is<HTMLAnchorElement>(*node)) { 232 if (downcast<Element>(*node).getAttribute(get DDURLScheme()) != "true")233 if (downcast<Element>(*node).getAttribute(get_DataDetectorsCore_DDURLScheme()) != "true") 233 234 return true; 234 235 removeResultLinksFromAnchor(node, node->parentElement()); … … 323 324 size_t currentTextLength = iterator.text().length(); 324 325 if (!currentTextLength) { 325 DDScanQueryAddSeparator(scanQuery, DDTextCoalescingTypeHardBreak);326 softLink_DataDetectorsCore_DDScanQueryAddSeparator(scanQuery, DDTextCoalescingTypeHardBreak); 326 327 if (iteratorCount > maxFragmentWithHardBreak) 327 328 break; … … 357 358 if (containsOnlyWhiteSpace) { 358 359 if (hasNewline) { 359 DDScanQueryAddLineBreak(scanQuery);360 softLink_DataDetectorsCore_DDScanQueryAddLineBreak(scanQuery); 360 361 if (iteratorCount > maxFragmentWithLinebreak) 361 362 break; 362 363 } else { 363 DDScanQueryAddSeparator(scanQuery, hasTab ? DDTextCoalescingTypeTab : DDTextCoalescingTypeSpace);364 softLink_DataDetectorsCore_DDScanQueryAddSeparator(scanQuery, hasTab ? DDTextCoalescingTypeTab : DDTextCoalescingTypeSpace); 364 365 if (iteratorCount > maxFragmentSpace) 365 366 break; … … 369 370 370 371 RetainPtr<CFStringRef> currentText = adoptCF(CFStringCreateWithCharacters(kCFAllocatorDefault, iterator.text().upconvertedCharacters(), iterator.text().length())); 371 DDScanQueryAddTextFragment(scanQuery, currentText.get(), CFRangeMake(0, currentTextLength), (void *)iteratorCount, (DDTextFragmentMode)0, DDTextCoalescingTypeNone);372 softLink_DataDetectorsCore_DDScanQueryAddTextFragment(scanQuery, currentText.get(), CFRangeMake(0, currentTextLength), (void *)iteratorCount, (DDTextFragmentMode)0, DDTextCoalescingTypeNone); 372 373 fragmentCount++; 373 374 } … … 389 390 NSArray *DataDetection::detectContentInRange(RefPtr<Range>& contextRange, DataDetectorTypes types) 390 391 { 391 RetainPtr<DDScannerRef> scanner = adoptCF( DDScannerCreate(DDScannerTypeStandard, 0, nullptr));392 RetainPtr<DDScanQueryRef> scanQuery = adoptCF( DDScanQueryCreate(NULL));392 RetainPtr<DDScannerRef> scanner = adoptCF(softLink_DataDetectorsCore_DDScannerCreate(DDScannerTypeStandard, 0, nullptr)); 393 RetainPtr<DDScanQueryRef> scanQuery = adoptCF(softLink_DataDetectorsCore_DDScanQueryCreate(NULL)); 393 394 buildQuery(scanQuery.get(), contextRange.get()); 394 395 395 396 // FIXME: we should add a timeout to this call to make sure it doesn't take too much time. 396 if (! DDScannerScanQuery(scanner.get(), scanQuery.get()))397 if (!softLink_DataDetectorsCore_DDScannerScanQuery(scanner.get(), scanQuery.get())) 397 398 return nil; 398 399 399 RetainPtr<CFArrayRef> scannerResults = adoptCF( DDScannerCopyResultsWithOptions(scanner.get(), getDDScannerCopyResultsOptionsForPassiveUse() | DDScannerCopyResultsOptionsCoalesceSignatures));400 RetainPtr<CFArrayRef> scannerResults = adoptCF(softLink_DataDetectorsCore_DDScannerCopyResultsWithOptions(scanner.get(), get_DataDetectorsCore_DDScannerCopyResultsOptionsForPassiveUse() | DDScannerCopyResultsOptionsCoalesceSignatures)); 400 401 if (!scannerResults) 401 402 return nil; … … 414 415 DDResultRef result = (DDResultRef)resultObject; 415 416 NSIndexPath *indexPath = [NSIndexPath indexPathWithIndex:currentTopLevelIndex]; 416 if (CFStringCompare( DDResultGetType(result), getDDBinderSignatureBlockKey(), 0) == kCFCompareEqualTo) {417 NSArray *subresults = (NSArray *) DDResultGetSubResults(result);417 if (CFStringCompare(softLink_DataDetectorsCore_DDResultGetType(result), get_DataDetectorsCore_DDBinderSignatureBlockKey(), 0) == kCFCompareEqualTo) { 418 NSArray *subresults = (NSArray *)softLink_DataDetectorsCore_DDResultGetSubResults(result); 418 419 419 420 for (NSUInteger subResultIndex = 0 ; subResultIndex < [subresults count] ; subResultIndex++) { … … 436 437 // Each result can be contained all in one text node or can span multiple text nodes. 437 438 for (auto& result : allResults) { 438 DDQueryRange queryRange = DDResultGetQueryRangeForURLification(result.get());439 CFIndex iteratorTargetAdvanceCount = (CFIndex) DDScanQueryGetFragmentMetaData(scanQuery.get(), queryRange.start.queryIndex);439 DDQueryRange queryRange = softLink_DataDetectorsCore_DDResultGetQueryRangeForURLification(result.get()); 440 CFIndex iteratorTargetAdvanceCount = (CFIndex)softLink_DataDetectorsCore_DDScanQueryGetFragmentMetaData(scanQuery.get(), queryRange.start.queryIndex); 440 441 while (iteratorCount < iteratorTargetAdvanceCount) { 441 442 iterator.advance(); … … 453 454 while (fragmentIndex < queryRange.end.queryIndex) { 454 455 fragmentIndex++; 455 iteratorTargetAdvanceCount = (CFIndex) DDScanQueryGetFragmentMetaData(scanQuery.get(), fragmentIndex);456 iteratorTargetAdvanceCount = (CFIndex)softLink_DataDetectorsCore_DDScanQueryGetFragmentMetaData(scanQuery.get(), fragmentIndex); 456 457 while (iteratorCount < iteratorTargetAdvanceCount) { 457 458 iterator.advance(); … … 478 479 for (CFIndex resultIndex = 0; resultIndex < resultCount; resultIndex++) { 479 480 DDResultRef coreResult = allResults[resultIndex].get(); 480 DDQueryRange queryRange = DDResultGetQueryRangeForURLification(coreResult);481 DDQueryRange queryRange = softLink_DataDetectorsCore_DDResultGetQueryRangeForURLification(coreResult); 481 482 Vector<RefPtr<Range>> resultRanges = allResultRanges[resultIndex]; 482 483 … … 533 534 // Add a special attribute to mark this URLification as the result of data detectors. 534 535 anchorElement->setAttribute(QualifiedName(nullAtom, dataDetectorsURLScheme, nullAtom), "true"); 535 anchorElement->setAttribute(QualifiedName(nullAtom, dataDetectorsAttributeTypeKey, nullAtom), dataDetectorTypeForCategory( DDResultGetCategory(coreResult)));536 anchorElement->setAttribute(QualifiedName(nullAtom, dataDetectorsAttributeTypeKey, nullAtom), dataDetectorTypeForCategory(softLink_DataDetectorsCore_DDResultGetCategory(coreResult))); 536 537 anchorElement->setAttribute(QualifiedName(nullAtom, dataDetectorsAttributeResultKey, nullAtom), identifier); 537 538 contentOffset = range->endOffset(); … … 544 545 lastTextNodeToUpdate->setData(lastNodeContent); 545 546 546 return [get DDScannerResultClass() resultsFromCoreResults:scannerResults.get()];547 return [get_DataDetectorsCore_DDScannerResultClass() resultsFromCoreResults:scannerResults.get()]; 547 548 } 548 549 -
trunk/Source/WebCore/platform/spi/cocoa/DataDetectorsCoreSPI.h
r195494 r195559 23 23 * THE POSSIBILITY OF SUCH DAMAGE. 24 24 */ 25 26 #import "SoftLinking.h"27 25 28 26 #if USE(APPLE_INTERNAL_SDK) … … 133 131 DDQueryRange DDResultGetQueryRangeForURLification(DDResultRef); 134 132 135 #if PLATFORM(IOS)136 SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(DataDetectorsCore)137 SOFT_LINK_CLASS(DataDetectorsCore, DDScannerResult)138 SOFT_LINK(DataDetectorsCore, DDScannerCreate, DDScannerRef, (DDScannerType type, DDScannerOptions options, CFErrorRef * errorRef), (type, options, errorRef))139 SOFT_LINK(DataDetectorsCore, DDScannerScanQuery, Boolean, (DDScannerRef scanner, DDScanQueryRef query), (scanner, query))140 SOFT_LINK(DataDetectorsCore, DDScanQueryCreate, DDScanQueryRef, (CFAllocatorRef allocator), (allocator))141 SOFT_LINK(DataDetectorsCore, DDScannerCopyResultsWithOptions, CFArrayRef, (DDScannerRef scanner, DDScannerCopyResultsOptions options), (scanner, options))142 SOFT_LINK(DataDetectorsCore, DDResultGetRange, CFRange, (DDResultRef result), (result))143 SOFT_LINK(DataDetectorsCore, DDResultGetType, CFStringRef, (DDResultRef result), (result))144 SOFT_LINK(DataDetectorsCore, DDResultGetCategory, DDResultCategory, (DDResultRef result), (result))145 SOFT_LINK(DataDetectorsCore, DDResultIsPastDate, Boolean, (DDResultRef result, CFDateRef referenceDate, CFTimeZoneRef referenceTimeZone), (result, referenceDate, referenceTimeZone))146 SOFT_LINK(DataDetectorsCore, DDScanQueryAddTextFragment, void, (DDScanQueryRef query, CFStringRef fragment, CFRange range, void *identifier, DDTextFragmentMode mode, DDTextCoalescingType type), (query, fragment, range, identifier, mode, type))147 SOFT_LINK(DataDetectorsCore, DDScanQueryAddSeparator, void, (DDScanQueryRef query, DDTextCoalescingType type), (query, type))148 SOFT_LINK(DataDetectorsCore, DDScanQueryAddLineBreak, void, (DDScanQueryRef query), (query))149 SOFT_LINK(DataDetectorsCore, DDScanQueryGetFragmentMetaData, void *, (DDScanQueryRef query, CFIndex queryIndex), (query, queryIndex))150 SOFT_LINK(DataDetectorsCore, DDResultHasProperties, bool, (DDResultRef result, CFIndex propertySet), (result, propertySet))151 SOFT_LINK(DataDetectorsCore, DDResultGetSubResults, CFArrayRef, (DDResultRef result), (result))152 SOFT_LINK(DataDetectorsCore, DDResultGetQueryRangeForURLification, DDQueryRange, (DDResultRef result), (result))153 SOFT_LINK(DataDetectorsCore, DDURLStringForResult, NSString *, (DDResultRef currentResult, NSString * resultIdentifier, DDURLifierPhoneNumberDetectionTypes includingTelGroups, NSDate * referenceDate, NSTimeZone * referenceTimeZone), (currentResult, resultIdentifier, includingTelGroups, referenceDate, referenceTimeZone))154 SOFT_LINK_POINTER(DataDetectorsCore, DDBinderHttpURLKey, CFStringRef)155 SOFT_LINK_POINTER(DataDetectorsCore, DDBinderWebURLKey, CFStringRef)156 SOFT_LINK_POINTER(DataDetectorsCore, DDBinderMailURLKey, CFStringRef)157 SOFT_LINK_POINTER(DataDetectorsCore, DDBinderGenericURLKey, CFStringRef)158 SOFT_LINK_POINTER(DataDetectorsCore, DDBinderEmailKey, CFStringRef)159 SOFT_LINK_POINTER(DataDetectorsCore, DDBinderTrackingNumberKey, CFStringRef)160 SOFT_LINK_POINTER(DataDetectorsCore, DDBinderFlightInformationKey, CFStringRef)161 SOFT_LINK_POINTER(DataDetectorsCore, DDBinderSignatureBlockKey, CFStringRef)162 SOFT_LINK_POINTER(DataDetectorsCore, DDURLScheme, NSString *)163 SOFT_LINK_CONSTANT(DataDetectorsCore, DDScannerCopyResultsOptionsForPassiveUse, DDScannerCopyResultsOptions)164 #endif165 166 133 }
Note: See TracChangeset
for help on using the changeset viewer.