WebKit Bugzilla
Attachment 346012 Details for
Bug 188140
: [Cocoa] Update more WebCore Objective-C code to be ARC compatible
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188140-20180728222101.patch (text/plain), 97.19 KB, created by
Darin Adler
on 2018-07-28 22:21:03 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Darin Adler
Created:
2018-07-28 22:21:03 PDT
Size:
97.19 KB
patch
obsolete
>Subversion Revision: 234345 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 2775997bf44aca302fc91872ed2a5bed4044d9ef..c56d6894df5fbd6aff03641649f515d9e005c4bd 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,207 @@ >+2018-07-28 Darin Adler <darin@apple.com> >+ >+ [Cocoa] Update more WebCore Objective-C code to be ARC compatible >+ https://bugs.webkit.org/show_bug.cgi?id=188140 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This make sure we don't put any Objective-C objects into HashMap/Set >+ data structures, which doesn't work under ARC at this time. We could >+ fix that some day, but it's pretty simple to change code not to rely >+ on it, for now, and not as simple to support it in HashMap/Set. >+ >+ * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: >+ (-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]): >+ Use CFRetain/CFAutorelease instead of retain/autorelease. >+ >+ * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: >+ (createAccessibilityRoleMap): Use CFStringRef in a HashMap rather than >+ NSString * for string constants. >+ (roleValueToNSString): Updated for above change. >+ >+ * bridge/objc/WebScriptObject.mm: >+ (-[WebScriptObject stringRepresentation]): Updated since objectValue >+ is now CFTypeRef rather than NSObject *. >+ >+ * bridge/objc/objc_instance.mm: >+ (ObjcInstance::create): Use CFTypeRef instead of id for the key types >+ in a HashMap. >+ (ObjcInstance::~ObjcInstance): Updated for the above change. >+ (ObjcInstance::invokeObjcMethod): Updated since objectValue is now >+ CFTypeRef. >+ (ObjcInstance::invokeDefaultMethod): Ditto. >+ (ObjcInstance::setValueOfUndefinedField): Ditto. >+ * bridge/objc/objc_runtime.mm: >+ (JSC::Bindings::ObjcArray::setValueAt const): Ditto. >+ >+ * bridge/objc/objc_utility.h: Use #pragma once. Use CFTypeRef instead >+ of NSObject * for objectValue, since it's in a union and ARC does not >+ support strong Objective-C object pointers in a union. >+ >+ * bridge/objc/objc_utility.mm: >+ (JSC::Bindings::convertValueToObjcValue): Updated since objectValue is >+ now CFTypeRef. >+ >+ * editing/cocoa/HTMLConverter.mm: >+ (HTMLConverter::_processElement): Use CFTypeRef rather than NSTextTable >+ for a HashMap. >+ (HTMLConverter::_exitElement): Ditto. >+ >+ * editing/cocoa/WebContentReaderCocoa.mm: >+ (WebCore::attributesForAttributedStringConversion): Use CFRetain rather >+ than -[NSObject retain] in a workaround for an overrelease. >+ >+ * editing/mac/DictionaryLookup.h: Removed code to make this usable from >+ non-Objective-C source files. Use tuples rather than out arguments >+ for the results of the various functions. >+ >+ * editing/mac/DictionaryLookup.mm: >+ (WebCore::DictionaryLookup::rangeForSelection): Return a typle rather >+ than using an out argument for options. >+ (WebCore::DictionaryLookup::rangeAtHitTestResult): Ditto. >+ (WebCore::DictionaryLookup::stringForPDFSelection): Ditto. >+ (WebCore::showPopupOrCreateAnimationController): Removed use of typedef >+ PlatformAnimationController. >+ (WebCore::DictionaryLookup::animationControllerForPopup): Ditto. >+ >+ * html/HTMLMediaElement.h: Put the videoFullscreenLayer function inside >+ an __OBJC__ ifdef since we can't do the type conversion without the >+ full Objective-C type. >+ >+ * page/mac/EventHandlerMac.mm: >+ (WebCore::selfRetainingNSScrollViewScrollWheel): Use CFRetain/CFRelease >+ instead of retain/release. >+ (WebCore::EventHandler::selectClosestWordFromHitTestResultBasedOnLookup): >+ Updated to use tuple return value from DictionaryLookup. >+ >+ * page/scrolling/ScrollingStateNode.h: Replaced direct use of PlatformLayer* >+ in a union with use of a "typless" void* pointer and added helper functions >+ to convert in both directions. >+ * page/scrolling/cocoa/ScrollingStateNode.mm: >+ (WebCore::LayerRepresentation::retainPlatformLayer): Use CFRetain instead >+ of retain. >+ (WebCore::LayerRepresentation::releasePlatformLayer): Use CFRelease instead >+ of release. >+ (WebCore::LayerRepresentation::makePlatformLayerTyped): Added. >+ (WebCore::LayerRepresentation::makePlatformLayerTypeless): Ditto. >+ * page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp: >+ (WebCore::LayerRepresentation::retainPlatformLayer): Updated argument type. >+ (WebCore::LayerRepresentation::releasePlatformLayer): Ditto. >+ (WebCore::LayerRepresentation::makePlatformLayerTyped): Added. >+ (WebCore::LayerRepresentation::makePlatformLayerTypeless): Ditto. >+ >+ * platform/gamepad/cocoa/GameControllerGamepadProvider.h: Use CFTypeRef >+ instad of GCController * for key type of HashMap. >+ * platform/gamepad/cocoa/GameControllerGamepadProvider.mm: >+ (WebCore::GameControllerGamepadProvider::controllerDidConnect): Updated >+ for the above change. >+ (WebCore::GameControllerGamepadProvider::controllerDidDisconnect): Ditto. >+ >+ * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm: >+ Use SOFT_LINK_CONSTANT_MAY_FAIL instead of SOFT_LINK_POINTER_OPTIONAL for >+ strings, since SOFT_LINK_POINTER_OPTIONAL does not work for Objective-C >+ types under ARC. >+ (WebCore::AVTrackPrivateAVFObjCImpl::audioKind const): Added checks >+ for the constants. >+ (WebCore::AVTrackPrivateAVFObjCImpl::videoKind const): Ditto. >+ (WebCore::AVTrackPrivateAVFObjCImpl::label const): Ditto. >+ >+ * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h: >+ Use #pragma once and use CFTypeRef instead of AVMediaSelectionOption * >+ in the key to a HashMap. >+ * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm: >+ (WebCore::MediaSelectionGroupAVFObjC::updateOptions): Updated for >+ the above change. >+ >+ * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: >+ Use SOFT_LINK_CONSTANT_MAY_FAIL instead of SOFT_LINK_POINTER_OPTIONAL for >+ strings, since SOFT_LINK_POINTER_OPTIONAL does not work for Objective-C >+ types under ARC. >+ (WebCore::customSchemeURL): Removed unnecessary use of >+ NeverDestroyed<RetainPtr>. Can just use a straight pointer without calling >+ release, and that works with or without ARC. >+ (WebCore::imageDecoderAssetOptions): Ditto. Here, had to add a retain, >+ which we'll remove when we turn on ARC. Added canLoad checks, needed >+ because of SOFT_LINK_CONSTANT_MAY_FAIL. >+ (WebCore::ImageDecoderAVFObjC::firstEnabledTrack): Added canLoad check, >+ needed because of SOFT_LINK_CONSTANT_MAY_FAIL. >+ >+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: >+ Use CFTypeRef instead of AVAssetResourceLoadingRequest in HashMap. >+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: >+ (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource): >+ Updated for above. >+ (WebCore::MediaPlayerPrivateAVFoundationObjC::didCancelLoadingRequest): Ditto. >+ (WebCore::MediaPlayerPrivateAVFoundationObjC::didStopLoadingRequest): Ditto. >+ >+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: >+ Use CFTypeRef instead of AVSampleBufferAudioRenderer in HashMap. >+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: >+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVolume): Updated for above. >+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setMuted): Ditto. >+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setPreservesPitch): Ditto. >+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableAudioSample): Ditto. >+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addAudioRenderer): Ditto. >+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeAudioRenderer): Ditto. >+ >+ * platform/graphics/metal/GPUDrawableMetal.mm: Updated include; under ARC, it's >+ not safe to call a method on a class without seeing its interface. >+ >+ * platform/mac/VideoFullscreenInterfaceMac.mm: Added an explicit >+ __unsafe_unretained for a delegate. Could consider moving to weak, but for now >+ this preserves the current behavior and compiles under ARC. >+ >+ * platform/mac/WebCoreFullScreenPlaceholderView.h: Use strong for the contents, >+ weak for the target, and changed the action to be hard-coded instead of an >+ arbitrary selector. If we find we need the flexibility again later, we can do >+ it with a block, which is more ARC-friendly than calling an arbitrary selector. >+ * platform/mac/WebCoreFullScreenPlaceholderView.mm: >+ (-[WebCoreFullScreenPlaceholderView initWithFrame:]): Call function directly >+ instead of taking advantage of "using". >+ (-[WebCoreFullScreenPlaceholderView mouseDown:]): Call cancelOperation: on the >+ target rather than performing an arbitrary selector. >+ >+ * platform/mac/WebCoreObjCExtras.mm: >+ (WebCoreObjCScheduleDeallocateOnMainThread): Use sel_registerName instead of >+ @selector, since @selector is not supported under ARC. >+ >+ * platform/network/ResourceHandle.h: Use a return value rather than using an >+ inout argument in applySniffingPoliciesAndStoragePartitionIfNeeded. >+ >+ * platform/network/cocoa/CookieStorageObserver.mm: >+ (WebCore::CookieStorageObserver::startObserving): Removed unnecessary >+ assertion of repondsToSelector since we are about to dispatch it immediately >+ after. Call the selector in the conventional way instead of using performSelector. >+ >+ * platform/network/cocoa/WebCoreNSURLSession.h: Use #pragma once and use >+ CFTypeRef instead of an Objective-C type. Also use an explicit __unsafe_unretained >+ for the session in the data task. >+ * platform/network/cocoa/WebCoreNSURLSession.mm: >+ (-[WebCoreNSURLSession dealloc]): Updated for the above. >+ (-[WebCoreNSURLSession taskCompleted:]): Ditto. >+ (-[WebCoreNSURLSession invalidateAndCancel]): Ditto. >+ (-[WebCoreNSURLSession getTasksWithCompletionHandler:]): Ditto. >+ (-[WebCoreNSURLSession getAllTasksWithCompletionHandler:]): Ditto. >+ (-[WebCoreNSURLSession dataTaskWithRequest:]): Ditto. >+ (-[WebCoreNSURLSession dataTaskWithURL:]): Ditto. >+ >+ * platform/network/mac/ResourceHandleMac.mm: >+ (WebCore::ResourceHandle::applySniffingPoliciesAndStoragePartitionIfNeeded): >+ Use a return value instead of an inout argument. Also use bridging casts. >+ (WebCore::ResourceHandle::createNSURLConnection): Updated for the change above. >+ Also use a bridging cast. >+ (WebCore::ResourceHandle::schedule): Use a bridging cast. >+ (WebCore::ResourceHandle::unschedule): Ditto. >+ >+ * platform/network/mac/WebCoreURLResponse.mm: >+ (WebCore::adjustMIMETypeIfNecessary): Use a bridging cast. >+ >+ * testing/Internals.cpp: >+ (WebCore::Internals::rangeForDictionaryLookupAtLocation): Moved the macOS >+ version of this function out of this file ... >+ * testing/Internals.mm: >+ (WebCore::Internals::rangeForDictionaryLookupAtLocation): ... to here. >+ > 2018-07-28 Simon Fraser <simon.fraser@apple.com> > > Reset CompositingPolicyOverride between tests >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index fcb37d14655b344beb93b7f690e5ea8695d051ff..2ad38d09cf784eef0c9386f5d1deb8a0fb26f516 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,22 @@ >+2018-07-28 Darin Adler <darin@apple.com> >+ >+ [Cocoa] Update more WebCore Objective-C code to be ARC compatible >+ https://bugs.webkit.org/show_bug.cgi?id=188140 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UIProcess/mac/WKFullScreenWindowController.mm: >+ (-[WKFullScreenWindowController enterFullScreen:]): Removed the call to >+ setAction: since the full screen placeholder view now always uses the >+ cancelOperation: method. >+ >+ * WebProcess/Plugins/PDF/PDFPlugin.mm: >+ (WebKit::PDFPlugin::lookupTextAtLocation): Updated to use the new >+ DictionaryLookup function that returns a tuple instead of using an out argument. >+ * WebProcess/WebPage/mac/WebPageMac.mm: >+ (WebKit::WebPage::performDictionaryLookupAtLocation): Ditto. >+ (WebKit::WebPage::performDictionaryLookupForSelection): Ditto. >+ > 2018-07-27 Chris Dumez <cdumez@apple.com> > > Fix thread-safety issues related to RealtimeMediaSource::audioSamplesAvailable() >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index 0e3375663b93d5b86e3cb5018566cab48fae5d06..1d276972f57b3aff0074e06d03ead0a82d96ef03 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,14 @@ >+2018-07-28 Darin Adler <darin@apple.com> >+ >+ [Cocoa] Update more WebCore Objective-C code to be ARC compatible >+ https://bugs.webkit.org/show_bug.cgi?id=188140 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebView/WebImmediateActionController.mm: >+ (-[WebImmediateActionController _animationControllerForText]): Updated to use the >+ new DictionaryLookup function that returns a tuple instead of using an out argument. >+ > 2018-07-26 Andy VanWagoner <andy@vanwagoner.family> > > [INTL] Remove INTL sub-feature compile flags >diff --git a/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm b/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm >index d544d422beff66b9d40277a76e926f75fb9c089f..ae66acdbe7100471f5939b68fef65774e1803ebe 100644 >--- a/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm >+++ b/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm >@@ -283,8 +283,9 @@ - (BOOL)updateObjectBackingStore > { > // Calling updateBackingStore() can invalidate this element so self must be retained. > // If it does become invalidated, m_object will be nil. >- [[self retain] autorelease]; >- >+ CFRetain((__bridge CFTypeRef)self); >+ CFAutorelease((__bridge CFTypeRef)self); >+ > if (!m_object) > return NO; > >diff --git a/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm b/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm >index 241141c0bc03a8a71c7f1166832f96066bf538b1..e3af278d3450a4cb791b3541138ef5f4882d3bb7 100644 >--- a/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm >+++ b/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm >@@ -1844,15 +1844,14 @@ - (NSValue *)position > return [NSValue valueWithPoint:NSMakePoint(cgPoint.x, cgPoint.y)]; > } > >-typedef HashMap<int, NSString*> AccessibilityRoleMap; >+using AccessibilityRoleMap = HashMap<int, CFStringRef>; > >-static const AccessibilityRoleMap& createAccessibilityRoleMap() >+static AccessibilityRoleMap createAccessibilityRoleMap() > { > struct RoleEntry { > AccessibilityRole value; > __unsafe_unretained NSString *string; > }; >- > static const RoleEntry roles[] = { > { AccessibilityRole::Unknown, NSAccessibilityUnknownRole }, > { AccessibilityRole::Button, NSAccessibilityButtonRole }, >@@ -1993,19 +1992,16 @@ static const AccessibilityRoleMap& createAccessibilityRoleMap() > { AccessibilityRole::GraphicsSymbol, NSAccessibilityImageRole }, > { AccessibilityRole::Caption, NSAccessibilityGroupRole }, > }; >- AccessibilityRoleMap& roleMap = *new AccessibilityRoleMap; >- >- const unsigned numRoles = sizeof(roles) / sizeof(roles[0]); >- for (unsigned i = 0; i < numRoles; ++i) >- roleMap.set(static_cast<int>(roles[i].value), roles[i].string); >+ AccessibilityRoleMap roleMap; >+ for (auto& role : roles) >+ roleMap.add(static_cast<int>(role.value), (__bridge CFStringRef)role.string); > return roleMap; > } > >-static NSString* roleValueToNSString(AccessibilityRole value) >+static NSString *roleValueToNSString(AccessibilityRole value) > { >- ASSERT(static_cast<int>(value)); >- static const AccessibilityRoleMap& roleMap = createAccessibilityRoleMap(); >- return roleMap.get(static_cast<int>(value)); >+ static NeverDestroyed<AccessibilityRoleMap> roleMap = createAccessibilityRoleMap(); >+ return (__bridge NSString *)roleMap.get().get(static_cast<int>(value)); > } > > - (NSString*)role >diff --git a/Source/WebCore/bridge/objc/WebScriptObject.mm b/Source/WebCore/bridge/objc/WebScriptObject.mm >index 0b5f8a9d9dfbe4f3873c6a07a8a8109d3132338e..03977940bd0d9b13913e492b84c2d89245f5d9db 100644 >--- a/Source/WebCore/bridge/objc/WebScriptObject.mm >+++ b/Source/WebCore/bridge/objc/WebScriptObject.mm >@@ -498,11 +498,7 @@ - (NSString *)stringRepresentation > ExecState* exec = [self _rootObject]->globalObject()->globalExec(); > JSLockHolder lock(exec); > >- id result = convertValueToObjcValue(exec, [self _imp], ObjcObjectType).objectValue; >- >- NSString *description = [result description]; >- >- return description; >+ return [(__bridge id)convertValueToObjcValue(exec, [self _imp], ObjcObjectType).objectValue description]; > } > > - (id)webScriptValueAtIndex:(unsigned)index >diff --git a/Source/WebCore/bridge/objc/objc_instance.mm b/Source/WebCore/bridge/objc/objc_instance.mm >index fce743d432bfe041224a46e985e73d9a1dd3c208..e8b78eb65b36488f65d7f0148be3e51d41c4c993 100644 >--- a/Source/WebCore/bridge/objc/objc_instance.mm >+++ b/Source/WebCore/bridge/objc/objc_instance.mm >@@ -57,9 +57,9 @@ using namespace JSC; > static NSString *s_exception; > static JSGlobalObject* s_exceptionEnvironment; // No need to protect this value, since we just use it for a pointer comparison. > >-static HashMap<id, ObjcInstance*>& wrapperCache() >+static HashMap<CFTypeRef, ObjcInstance*>& wrapperCache() > { >- static NeverDestroyed<HashMap<id, ObjcInstance*>> map; >+ static NeverDestroyed<HashMap<CFTypeRef, ObjcInstance*>> map; > return map; > } > >@@ -106,7 +106,7 @@ ObjcInstance::ObjcInstance(id instance, RefPtr<RootObject>&& rootObject) > > RefPtr<ObjcInstance> ObjcInstance::create(id instance, RefPtr<RootObject>&& rootObject) > { >- auto result = wrapperCache().add(instance, nullptr); >+ auto result = wrapperCache().add((__bridge CFTypeRef)instance, nullptr); > if (result.isNewEntry) { > RefPtr<ObjcInstance> wrapper = adoptRef(new ObjcInstance(instance, WTFMove(rootObject))); > result.iterator->value = wrapper.get(); >@@ -121,7 +121,7 @@ ObjcInstance::~ObjcInstance() > // Both -finalizeForWebScript and -dealloc/-finalize of _instance may require autorelease pools. > @autoreleasepool { > ASSERT(_instance); >- wrapperCache().remove(_instance.get()); >+ wrapperCache().remove((__bridge CFTypeRef)_instance.get()); > > if ([_instance.get() respondsToSelector:@selector(finalizeForWebScript)]) > [_instance.get() performSelector:@selector(finalizeForWebScript)]; >@@ -247,7 +247,7 @@ @try { > int count = exec->argumentCount(); > for (int i = 0; i < count; i++) { > ObjcValue value = convertValueToObjcValue(exec, exec->uncheckedArgument(i), ObjcObjectType); >- [objcArgs addObject:value.objectValue]; >+ [objcArgs addObject:(__bridge id)value.objectValue]; > } > [invocation setArgument:&objcArgs atIndex:3]; > } else { >@@ -361,7 +361,7 @@ @try { > unsigned count = exec->argumentCount(); > for (unsigned i = 0; i < count; i++) { > ObjcValue value = convertValueToObjcValue(exec, exec->uncheckedArgument(i), ObjcObjectType); >- [objcArgs addObject:value.objectValue]; >+ [objcArgs addObject:(__bridge id)value.objectValue]; > } > [invocation setArgument:&objcArgs atIndex:2]; > >@@ -408,7 +408,7 @@ bool ObjcInstance::setValueOfUndefinedField(ExecState* exec, PropertyName proper > ObjcValue objcValue = convertValueToObjcValue(exec, aValue, ObjcObjectType); > > @try { >- [targetObject setValue:objcValue.objectValue forUndefinedKey:[NSString stringWithCString:name.ascii().data() encoding:NSASCIIStringEncoding]]; >+ [targetObject setValue:(__bridge id)objcValue.objectValue forUndefinedKey:[NSString stringWithCString:name.ascii().data() encoding:NSASCIIStringEncoding]]; > } @catch(NSException* localException) { > // Do nothing. Class did not override valueForUndefinedKey:. > } >diff --git a/Source/WebCore/bridge/objc/objc_runtime.mm b/Source/WebCore/bridge/objc/objc_runtime.mm >index 51a21039a9260aecc0213563491f080b760fd640..29c58c591b87fde736c35f760621b91d04a3b488 100644 >--- a/Source/WebCore/bridge/objc/objc_runtime.mm >+++ b/Source/WebCore/bridge/objc/objc_runtime.mm >@@ -180,7 +180,7 @@ bool ObjcArray::setValueAt(ExecState* exec, unsigned int index, JSValue aValue) > ObjcValue oValue = convertValueToObjcValue (exec, aValue, ObjcObjectType); > > @try { >- [_array.get() insertObject:oValue.objectValue atIndex:index]; >+ [_array.get() insertObject:(__bridge id)oValue.objectValue atIndex:index]; > return true; > } @catch(NSException* localException) { > throwException(exec, scope, createError(exec, "Objective-C exception.")); >diff --git a/Source/WebCore/bridge/objc/objc_utility.h b/Source/WebCore/bridge/objc/objc_utility.h >index ab046b5ae7f0a4eaf0985d8e2d83f401018673fd..add4d9ebda63371ced5cd4c673500666e9e9b898 100644 >--- a/Source/WebCore/bridge/objc/objc_utility.h >+++ b/Source/WebCore/bridge/objc/objc_utility.h >@@ -23,8 +23,7 @@ > * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#ifndef KJS_BINDINGS_OBJC_UTILITY_H >-#define KJS_BINDINGS_OBJC_UTILITY_H >+#pragma once > > #include <CoreFoundation/CoreFoundation.h> > >@@ -38,7 +37,7 @@ namespace JSC { > namespace Bindings { > > typedef union { >- ObjectStructPtr objectValue; >+ CFTypeRef objectValue; > bool booleanValue; > char charValue; > short shortValue; >@@ -79,5 +78,3 @@ JSObject *throwError(ExecState*, ThrowScope&, NSString *message); > > } // namespace Bindings > } // namespace JSC >- >-#endif >diff --git a/Source/WebCore/bridge/objc/objc_utility.mm b/Source/WebCore/bridge/objc/objc_utility.mm >index 197043ff51daf4cb0956c8e58a4508c96a81dc3c..01cbf62fddf3e05e7525723c786613d5122131de 100644 >--- a/Source/WebCore/bridge/objc/objc_utility.mm >+++ b/Source/WebCore/bridge/objc/objc_utility.mm >@@ -101,8 +101,8 @@ ObjcValue convertValueToObjcValue(ExecState* exec, JSValue value, ObjcValueType > globalObject = originGlobalObject; > > RootObject* rootObject = findRootObject(globalObject); >- result.objectValue = rootObject >- ? [webScriptObjectClass() _convertValueToObjcValue:value originRootObject:originRootObject rootObject:rootObject] >+ result.objectValue = rootObject >+ ? (__bridge CFTypeRef)[webScriptObjectClass() _convertValueToObjcValue:value originRootObject:originRootObject rootObject:rootObject] > : nil; > } > break; >diff --git a/Source/WebCore/editing/cocoa/HTMLConverter.mm b/Source/WebCore/editing/cocoa/HTMLConverter.mm >index 527d9927411ce754e45bd72f75363d1730e01603..a3dd69ee6aeba90835189e3b2762981eb733b421 100644 >--- a/Source/WebCore/editing/cocoa/HTMLConverter.mm >+++ b/Source/WebCore/editing/cocoa/HTMLConverter.mm >@@ -369,7 +369,7 @@ private: > DocumentLoader* m_dataSource; > > HashMap<RefPtr<Element>, RetainPtr<NSDictionary>> m_attributesForElements; >- HashMap<RetainPtr<NSTextTable>, RefPtr<Element>> m_textTableFooters; >+ HashMap<RetainPtr<CFTypeRef>, RefPtr<Element>> m_textTableFooters; > HashMap<RefPtr<Element>, RetainPtr<NSDictionary>> m_aggregatedAttributesForElements; > > NSMutableAttributedString *_attrStr; >@@ -1863,7 +1863,7 @@ BOOL HTMLConverter::_processElement(Element& element, NSInteger depth) > _addTableCellForElement(nil); > _addTableForElement(tableElement); > } else if (displayValue == "table-footer-group" && [_textTables count] > 0) { >- m_textTableFooters.add([_textTables lastObject], &element); >+ m_textTableFooters.add((__bridge CFTypeRef)[_textTables lastObject], &element); > retval = NO; > } else if (displayValue == "table-row" && [_textTables count] > 0) { > PlatformColor *color = _colorForElement(element, CSSPropertyBackgroundColor); >@@ -2095,12 +2095,12 @@ void HTMLConverter::_exitElement(Element& element, NSInteger depth, NSUInteger s > range = NSMakeRange(startIndex, [_attrStr length] - startIndex); > if (displayValue == "table" && [_textTables count] > 0) { > NSTextTable *key = [_textTables lastObject]; >- Element* footer = m_textTableFooters.get(key); >+ Element* footer = m_textTableFooters.get((__bridge CFTypeRef)key); > while ([_textTables count] < [_textBlocks count] + 1) > [_textBlocks removeLastObject]; > if (footer) { > _traverseFooterNode(*footer, depth + 1); >- m_textTableFooters.remove(key); >+ m_textTableFooters.remove((__bridge CFTypeRef)key); > } > [_textTables removeLastObject]; > [_textTableSpacings removeLastObject]; >diff --git a/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm b/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm >index 6f4b3fbc5dbbdd53edd7a9c8cf7ea332cd4e5a78..97285587be206f94abba8b7011d3dd626a34a80d 100644 >--- a/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm >+++ b/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm >@@ -110,11 +110,16 @@ static NSDictionary *attributesForAttributedStringConversion() > static NSString * const NSExcludedElementsDocumentAttribute = @"ExcludedElements"; > #endif > >+ NSURL *baseURL = URL::fakeURLWithRelativePart(emptyString()); >+ >+ // The output base URL needs +1 refcount to work around the fact that NSHTMLReader over-releases it. >+ CFRetain((__bridge CFTypeRef)baseURL); >+ > return @{ > NSExcludedElementsDocumentAttribute: excludedElements.get(), > @"InterchangeNewline": @YES, > @"CoalesceTabSpans": @YES, >- @"OutputBaseURL": [(NSURL *)URL::fakeURLWithRelativePart(emptyString()) retain], // The value needs +1 refcount, as NSAttributedString over-releases it. >+ @"OutputBaseURL": baseURL, > @"WebResourceHandler": [[WebArchiveResourceWebResourceHandler new] autorelease], > }; > } >diff --git a/Source/WebCore/editing/mac/DictionaryLookup.h b/Source/WebCore/editing/mac/DictionaryLookup.h >index d7ebe185963a5f38a8bd7c22ffa65c1392ebd7dc..c461978400514a72d2bebae2c5f7d18b78744631 100644 >--- a/Source/WebCore/editing/mac/DictionaryLookup.h >+++ b/Source/WebCore/editing/mac/DictionaryLookup.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2014-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -23,25 +23,15 @@ > * THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#pragma once >- > #if PLATFORM(MAC) > > #include "DictionaryPopupInfo.h" >+#include <pal/spi/mac/NSImmediateActionGestureRecognizerSPI.h> > #include <wtf/Function.h> > >-OBJC_CLASS NSString; > OBJC_CLASS NSView; > OBJC_CLASS PDFSelection; > >-// This file is included in Internals.cpp, so we can't use ObjC outright. >-#if defined(__OBJC__) >-#include <pal/spi/mac/NSImmediateActionGestureRecognizerSPI.h> >-#define PlatformAnimationController id<NSImmediateActionAnimationController> >-#else >-#define PlatformAnimationController void* >-#endif >- > namespace WebCore { > > class HitTestResult; >@@ -50,16 +40,16 @@ class VisibleSelection; > > class DictionaryLookup { > public: >- WEBCORE_EXPORT static RefPtr<Range> rangeForSelection(const VisibleSelection&, NSDictionary **options); >- WEBCORE_EXPORT static RefPtr<Range> rangeAtHitTestResult(const HitTestResult&, NSDictionary **options); >- WEBCORE_EXPORT static NSString *stringForPDFSelection(PDFSelection *, NSDictionary **options); >+ WEBCORE_EXPORT static std::tuple<RefPtr<Range>, NSDictionary *> rangeForSelection(const VisibleSelection&); >+ WEBCORE_EXPORT static std::tuple<RefPtr<Range>, NSDictionary *> rangeAtHitTestResult(const HitTestResult&); >+ WEBCORE_EXPORT static std::tuple<NSString *, NSDictionary *> stringForPDFSelection(PDFSelection *); > > // FIXME: Should move/unify dictionaryPopupInfoForRange here too. > > WEBCORE_EXPORT static void showPopup(const DictionaryPopupInfo&, NSView *, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback = nullptr); > WEBCORE_EXPORT static void hidePopup(); > >- WEBCORE_EXPORT static PlatformAnimationController animationControllerForPopup(const DictionaryPopupInfo&, NSView *, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback = nullptr); >+ WEBCORE_EXPORT static id <NSImmediateActionAnimationController> animationControllerForPopup(const DictionaryPopupInfo&, NSView *, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback = nullptr); > }; > > } // namespace WebCore >diff --git a/Source/WebCore/editing/mac/DictionaryLookup.mm b/Source/WebCore/editing/mac/DictionaryLookup.mm >index 93e74c8401ec7775a6693bfb02b1499722e65563..55062fba38caa9c618cc45f1051d4783a10265ea 100644 >--- a/Source/WebCore/editing/mac/DictionaryLookup.mm >+++ b/Source/WebCore/editing/mac/DictionaryLookup.mm >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2014-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -78,45 +78,44 @@ static bool selectionContainsPosition(const VisiblePosition& position, const Vis > return selectedRange->contains(position); > } > >-RefPtr<Range> DictionaryLookup::rangeForSelection(const VisibleSelection& selection, NSDictionary **options) >+std::tuple<RefPtr<Range>, NSDictionary *> DictionaryLookup::rangeForSelection(const VisibleSelection& selection) > { > auto selectedRange = selection.toNormalizedRange(); > if (!selectedRange) >- return nullptr; >+ return { nullptr, nil }; > > // Since we already have the range we want, we just need to grab the returned options. >- if (options) { >- auto selectionStart = selection.visibleStart(); >- auto selectionEnd = selection.visibleEnd(); >+ auto selectionStart = selection.visibleStart(); >+ auto selectionEnd = selection.visibleEnd(); > >- // As context, we are going to use the surrounding paragraphs of text. >- auto paragraphStart = startOfParagraph(selectionStart); >- auto paragraphEnd = endOfParagraph(selectionEnd); >+ // As context, we are going to use the surrounding paragraphs of text. >+ auto paragraphStart = startOfParagraph(selectionStart); >+ auto paragraphEnd = endOfParagraph(selectionEnd); > >- int lengthToSelectionStart = TextIterator::rangeLength(makeRange(paragraphStart, selectionStart).get()); >- int lengthToSelectionEnd = TextIterator::rangeLength(makeRange(paragraphStart, selectionEnd).get()); >- NSRange rangeToPass = NSMakeRange(lengthToSelectionStart, lengthToSelectionEnd - lengthToSelectionStart); >+ int lengthToSelectionStart = TextIterator::rangeLength(makeRange(paragraphStart, selectionStart).get()); >+ int lengthToSelectionEnd = TextIterator::rangeLength(makeRange(paragraphStart, selectionEnd).get()); >+ NSRange rangeToPass = NSMakeRange(lengthToSelectionStart, lengthToSelectionEnd - lengthToSelectionStart); > >- tokenRange(plainText(makeRange(paragraphStart, paragraphEnd).get()), rangeToPass, options); >- } >+ NSDictionary *options = nil; >+ tokenRange(plainText(makeRange(paragraphStart, paragraphEnd).get()), rangeToPass, &options); > >- return selectedRange; >+ return { selectedRange, options }; > } > >-RefPtr<Range> DictionaryLookup::rangeAtHitTestResult(const HitTestResult& hitTestResult, NSDictionary **options) >+std::tuple<RefPtr<Range>, NSDictionary *> DictionaryLookup::rangeAtHitTestResult(const HitTestResult& hitTestResult) > { > auto* node = hitTestResult.innerNonSharedNode(); > if (!node || !node->renderer()) >- return nullptr; >+ return { nullptr, nil }; > > auto* frame = node->document().frame(); > if (!frame) >- return nullptr; >+ return { nullptr, nil }; > > // Don't do anything if there is no character at the point. > auto framePoint = hitTestResult.roundedPointInInnerNodeFrame(); > if (!frame->rangeForPoint(framePoint)) >- return nullptr; >+ return { nullptr, nil }; > > auto position = frame->visiblePositionForPoint(framePoint); > if (position.isNull()) >@@ -125,7 +124,7 @@ RefPtr<Range> DictionaryLookup::rangeAtHitTestResult(const HitTestResult& hitTes > // If we hit the selection, use that instead of letting Lookup decide the range. > auto selection = frame->page()->focusController().focusedOrMainFrame().selection().selection(); > if (selectionContainsPosition(position, selection)) >- return rangeForSelection(selection, options); >+ return rangeForSelection(selection); > > VisibleSelection selectionAccountingForLineRules { position }; > selectionAccountingForLineRules.expandUsingGranularity(WordGranularity); >@@ -134,17 +133,18 @@ RefPtr<Range> DictionaryLookup::rangeAtHitTestResult(const HitTestResult& hitTes > // As context, we are going to use 250 characters of text before and after the point. > auto fullCharacterRange = rangeExpandedAroundPositionByCharacters(position, 250); > if (!fullCharacterRange) >- return nullptr; >+ return { nullptr, nil }; > > NSRange rangeToPass = NSMakeRange(TextIterator::rangeLength(makeRange(fullCharacterRange->startPosition(), position).get()), 0); >- NSRange extractedRange = tokenRange(plainText(fullCharacterRange.get()), rangeToPass, options); >+ NSDictionary *options = nil; >+ NSRange extractedRange = tokenRange(plainText(fullCharacterRange.get()), rangeToPass, &options); > > // tokenRange sometimes returns {NSNotFound, 0} if it was unable to determine a good string. > // FIXME (159063): We shouldn't need to check for zero length here. > if (extractedRange.location == NSNotFound || extractedRange.length == 0) >- return nullptr; >+ return { nullptr, nil }; > >- return TextIterator::subrange(*fullCharacterRange, extractedRange.location, extractedRange.length); >+ return { TextIterator::subrange(*fullCharacterRange, extractedRange.location, extractedRange.length), options }; > } > > static void expandSelectionByCharacters(PDFSelection *selection, NSInteger numberOfCharactersToExpand, NSInteger& charactersAddedBeforeStart, NSInteger& charactersAddedAfterEnd) >@@ -162,13 +162,13 @@ static void expandSelectionByCharacters(PDFSelection *selection, NSInteger numbe > END_BLOCK_OBJC_EXCEPTIONS; > } > >-NSString *DictionaryLookup::stringForPDFSelection(PDFSelection *selection, NSDictionary **options) >+std::tuple<NSString *, NSDictionary *> DictionaryLookup::stringForPDFSelection(PDFSelection *selection) > { > BEGIN_BLOCK_OBJC_EXCEPTIONS; > > // Don't do anything if there is no character at the point. > if (!selection || !selection.string.length) >- return @""; >+ return { @"", nil }; > > RetainPtr<PDFSelection> selectionForLookup = adoptNS([selection copy]); > >@@ -181,11 +181,12 @@ NSString *DictionaryLookup::stringForPDFSelection(PDFSelection *selection, NSDic > auto fullPlainTextString = [selectionForLookup string]; > auto rangeToPass = NSMakeRange(charactersAddedBeforeStart, 0); > >- auto extractedRange = tokenRange(fullPlainTextString, rangeToPass, options); >+ NSDictionary *options = nil; >+ auto extractedRange = tokenRange(fullPlainTextString, rangeToPass, &options); > > // This function sometimes returns {NSNotFound, 0} if it was unable to determine a good string. > if (extractedRange.location == NSNotFound) >- return selection.string; >+ return { selection.string, options }; > > NSInteger lookupAddedBefore = rangeToPass.location - extractedRange.location; > NSInteger lookupAddedAfter = (extractedRange.location + extractedRange.length) - (rangeToPass.location + originalLength); >@@ -194,14 +195,14 @@ NSString *DictionaryLookup::stringForPDFSelection(PDFSelection *selection, NSDic > [selection extendSelectionAtEnd:lookupAddedAfter]; > > ASSERT([selection.string isEqualToString:[fullPlainTextString substringWithRange:extractedRange]]); >- return selection.string; >+ return { selection.string, options }; > > END_BLOCK_OBJC_EXCEPTIONS; > >- return nil; >+ return { @"", nil }; > } > >-static PlatformAnimationController showPopupOrCreateAnimationController(bool createAnimationController, const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback) >+static id <NSImmediateActionAnimationController> showPopupOrCreateAnimationController(bool createAnimationController, const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback) > { > BEGIN_BLOCK_OBJC_EXCEPTIONS; > >@@ -262,7 +263,7 @@ void DictionaryLookup::hidePopup() > END_BLOCK_OBJC_EXCEPTIONS; > } > >-PlatformAnimationController DictionaryLookup::animationControllerForPopup(const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback) >+id <NSImmediateActionAnimationController> DictionaryLookup::animationControllerForPopup(const DictionaryPopupInfo& dictionaryPopupInfo, NSView *view, const WTF::Function<void(TextIndicator&)>& textIndicatorInstallationCallback, const WTF::Function<FloatRect(FloatRect)>& rootViewToViewConversionCallback) > { > return showPopupOrCreateAnimationController(true, dictionaryPopupInfo, view, textIndicatorInstallationCallback, rootViewToViewConversionCallback); > } >@@ -270,4 +271,3 @@ PlatformAnimationController DictionaryLookup::animationControllerForPopup(const > } // namespace WebCore > > #endif // PLATFORM(MAC) >- >diff --git a/Source/WebCore/html/HTMLMediaElement.h b/Source/WebCore/html/HTMLMediaElement.h >index 768190969963f600b2f8c3c4811853327c685b22..a78ecfd3196b9fdeabc510277fca764ee3dd6a72 100644 >--- a/Source/WebCore/html/HTMLMediaElement.h >+++ b/Source/WebCore/html/HTMLMediaElement.h >@@ -177,7 +177,9 @@ public: > void waitForPreparedForInlineThen(WTF::Function<void()>&& completionHandler = [] { }); > #if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) > void setVideoFullscreenLayer(PlatformLayer*, WTF::Function<void()>&& completionHandler = [] { }); >+#ifdef __OBJC__ > PlatformLayer* videoFullscreenLayer() const { return m_videoFullscreenLayer.get(); } >+#endif > void setVideoFullscreenFrame(FloatRect); > void setVideoFullscreenGravity(MediaPlayerEnums::VideoGravity); > MediaPlayerEnums::VideoGravity videoFullscreenGravity() const { return m_videoFullscreenGravity; } >diff --git a/Source/WebCore/page/mac/EventHandlerMac.mm b/Source/WebCore/page/mac/EventHandlerMac.mm >index 830c3030cc089fffb356d8f2a72d04313c673c81..a26430cf2524ad204d61379a0ed0b0099656b91d 100644 >--- a/Source/WebCore/page/mac/EventHandlerMac.mm >+++ b/Source/WebCore/page/mac/EventHandlerMac.mm >@@ -453,10 +453,10 @@ static void selfRetainingNSScrollViewScrollWheel(NSScrollView *self, SEL selecto > bool shouldRetainSelf = isMainThread() && nsScrollViewScrollWheelShouldRetainSelf(); > > if (shouldRetainSelf) >- [self retain]; >+ CFRetain((__bridge CFTypeRef)self); > wtfCallIMP<void>(originalNSScrollViewScrollWheel, self, selector, event); > if (shouldRetainSelf) >- [self release]; >+ CFRelease((__bridge CFTypeRef)self); > } > > bool EventHandler::widgetDidHandleWheelEvent(const PlatformWheelEvent& wheelEvent, Widget& widget) >@@ -1113,10 +1113,12 @@ VisibleSelection EventHandler::selectClosestWordFromHitTestResultBasedOnLookup(c > if (!m_frame.editor().behavior().shouldSelectBasedOnDictionaryLookup()) > return VisibleSelection(); > >- if (auto range = DictionaryLookup::rangeAtHitTestResult(result, nullptr)) >- return VisibleSelection(*range); >+ RefPtr<Range> range; >+ std::tie(range, std::ignore) = DictionaryLookup::rangeAtHitTestResult(result); >+ if (!range) >+ return VisibleSelection(); > >- return VisibleSelection(); >+ return VisibleSelection(*range); > } > > static IntSize autoscrollAdjustmentFactorForScreenBoundaries(const IntPoint& screenPoint, const FloatRect& screenRect) >diff --git a/Source/WebCore/page/scrolling/ScrollingStateNode.h b/Source/WebCore/page/scrolling/ScrollingStateNode.h >index 6fbe63826a445365e1fb1fa02e8af545ccff20e7..455dc1adfae80b7a08deaaf4e3c7458a6654bf52 100644 >--- a/Source/WebCore/page/scrolling/ScrollingStateNode.h >+++ b/Source/WebCore/page/scrolling/ScrollingStateNode.h >@@ -71,11 +71,11 @@ public: > { } > > LayerRepresentation(PlatformLayer* platformLayer) >- : m_platformLayer(platformLayer) >+ : m_typelessPlatformLayer(makePlatformLayerTypeless(platformLayer)) > , m_layerID(0) > , m_representation(PlatformLayerRepresentation) > { >- retainPlatformLayer(platformLayer); >+ retainPlatformLayer(m_typelessPlatformLayer); > } > > LayerRepresentation(GraphicsLayer::PlatformLayerID layerID) >@@ -86,18 +86,18 @@ public: > } > > LayerRepresentation(const LayerRepresentation& other) >- : m_platformLayer(other.m_platformLayer) >+ : m_typelessPlatformLayer(other.m_typelessPlatformLayer) > , m_layerID(other.m_layerID) > , m_representation(other.m_representation) > { > if (m_representation == PlatformLayerRepresentation) >- retainPlatformLayer(m_platformLayer); >+ retainPlatformLayer(m_typelessPlatformLayer); > } > > ~LayerRepresentation() > { > if (m_representation == PlatformLayerRepresentation) >- releasePlatformLayer(m_platformLayer); >+ releasePlatformLayer(m_typelessPlatformLayer); > } > > operator GraphicsLayer*() const >@@ -109,7 +109,7 @@ public: > operator PlatformLayer*() const > { > ASSERT(m_representation == PlatformLayerRepresentation); >- return m_platformLayer; >+ return makePlatformLayerTyped(m_typelessPlatformLayer); > } > > GraphicsLayer::PlatformLayerID layerID() const >@@ -125,12 +125,12 @@ public: > > LayerRepresentation& operator=(const LayerRepresentation& other) > { >- m_platformLayer = other.m_platformLayer; >+ m_typelessPlatformLayer = other.m_typelessPlatformLayer; > m_layerID = other.m_layerID; > m_representation = other.m_representation; > > if (m_representation == PlatformLayerRepresentation) >- retainPlatformLayer(m_platformLayer); >+ retainPlatformLayer(m_typelessPlatformLayer); > > return *this; > } >@@ -146,7 +146,7 @@ public: > return m_graphicsLayer == other.m_graphicsLayer > && m_layerID == other.m_layerID; > case PlatformLayerRepresentation: >- return m_platformLayer == other.m_platformLayer; >+ return m_typelessPlatformLayer == other.m_typelessPlatformLayer; > case PlatformLayerIDRepresentation: > return m_layerID == other.m_layerID; > } >@@ -174,12 +174,14 @@ public: > bool representsPlatformLayerID() const { return m_representation == PlatformLayerIDRepresentation; } > > private: >- WEBCORE_EXPORT void retainPlatformLayer(PlatformLayer*); >- WEBCORE_EXPORT void releasePlatformLayer(PlatformLayer*); >+ WEBCORE_EXPORT static void retainPlatformLayer(void* typelessPlatformLayer); >+ WEBCORE_EXPORT static void releasePlatformLayer(void* typelessPlatformLayer); >+ WEBCORE_EXPORT static PlatformLayer* makePlatformLayerTyped(void* typelessPlatformLayer); >+ WEBCORE_EXPORT static void* makePlatformLayerTypeless(PlatformLayer*); > > union { > GraphicsLayer* m_graphicsLayer; >- PlatformLayer *m_platformLayer; >+ void* m_typelessPlatformLayer; > }; > > GraphicsLayer::PlatformLayerID m_layerID; >diff --git a/Source/WebCore/page/scrolling/cocoa/ScrollingStateNode.mm b/Source/WebCore/page/scrolling/cocoa/ScrollingStateNode.mm >index 131ba4caa1df596fb6b400c3a1f93674a5f0688e..374879f0e6ef4cb604065b96e3472d2c7df2ca3a 100644 >--- a/Source/WebCore/page/scrolling/cocoa/ScrollingStateNode.mm >+++ b/Source/WebCore/page/scrolling/cocoa/ScrollingStateNode.mm >@@ -26,21 +26,32 @@ > #include "config.h" > #include "ScrollingStateNode.h" > >-#include "GraphicsLayer.h" >-#include "ScrollingStateTree.h" >+#include "PlatformLayer.h" > > #if ENABLE(ASYNC_SCROLLING) > > namespace WebCore { > >-void LayerRepresentation::retainPlatformLayer(PlatformLayer* layer) >+void LayerRepresentation::retainPlatformLayer(void* typelessLayer) > { >- [layer retain]; >+ if (typelessLayer) >+ CFRetain(typelessLayer); > } > >-void LayerRepresentation::releasePlatformLayer(PlatformLayer* layer) >+void LayerRepresentation::releasePlatformLayer(void* typelessLayer) > { >- [layer release]; >+ if (typelessLayer) >+ CFRelease(typelessLayer); >+} >+ >+CALayer *LayerRepresentation::makePlatformLayerTyped(void* typelessLayer) >+{ >+ return (__bridge CALayer *)typelessLayer; >+} >+ >+void* LayerRepresentation::makePlatformLayerTypeless(CALayer *layer) >+{ >+ return (__bridge void*)layer; > } > > } // namespace WebCore >diff --git a/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp b/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp >index aeb6223c1fc98dad8843f67b1b863725ca44c50b..3d68ae66a8fb6f19e859d7b9aa5080b0b1e6fc13 100644 >--- a/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp >+++ b/Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp >@@ -34,16 +34,26 @@ > > namespace WebCore { > >-void LayerRepresentation::retainPlatformLayer(PlatformLayer*) >+void LayerRepresentation::retainPlatformLayer(void*) > { > notImplemented(); > } > >-void LayerRepresentation::releasePlatformLayer(PlatformLayer*) >+void LayerRepresentation::releasePlatformLayer(void*) > { > notImplemented(); > } > >+PlatformLayer* LayerRepresentation::makePlatformLayerTyped(void* typelessLayer) >+{ >+ return static_cast<PlatformLayer*>(typelessLayer); >+} >+ >+void* LayerRepresentation::makePlatformLayerTypeless(PlatformLayer* layer) >+{ >+ return layer; >+} >+ > } // namespace WebCore > > #endif // USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.h b/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.h >index c7250745ad0d82367d85a3254c3106e746224ea3..7db0150d2269632fc0b0f0c6b6b457dea2029081 100644 >--- a/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.h >+++ b/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.h >@@ -72,7 +72,7 @@ private: > > void makeInvisibileGamepadsVisible(); > >- HashMap<GCController *, std::unique_ptr<GameControllerGamepad>> m_gamepadMap; >+ HashMap<CFTypeRef, std::unique_ptr<GameControllerGamepad>> m_gamepadMap; > Vector<PlatformGamepad*> m_gamepadVector; > HashSet<PlatformGamepad*> m_invisibleGamepads; > >diff --git a/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm b/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm >index 17109d2d2141679e0254393cfdef7185517be7a0..e24b2039fd479e41722042faff6d7255b19269d6 100644 >--- a/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm >+++ b/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm >@@ -67,7 +67,7 @@ void GameControllerGamepadProvider::controllerDidConnect(GCController *controlle > m_gamepadVector.grow(index + 1); > > m_gamepadVector[index] = gamepad.get(); >- m_gamepadMap.set(controller, WTFMove(gamepad)); >+ m_gamepadMap.set((__bridge CFTypeRef)controller, WTFMove(gamepad)); > > > if (visibility == ConnectionVisibility::Invisible) { >@@ -85,7 +85,7 @@ void GameControllerGamepadProvider::controllerDidDisconnect(GCController *contro > { > LOG(Gamepad, "GameControllerGamepadProvider controller %p removed", controller); > >- auto removedGamepad = m_gamepadMap.take(controller); >+ auto removedGamepad = m_gamepadMap.take((__bridge CFTypeRef)controller); > ASSERT(removedGamepad); > > auto i = m_gamepadVector.find(removedGamepad.get()); >diff --git a/Source/WebCore/platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm b/Source/WebCore/platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm >index 2aafa1c11f2f30dc9054e83615b502b3bb7bbed2..6e48fdaf1859070a26934bcb606fe5a40cfbde2c 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm >@@ -51,12 +51,12 @@ SOFT_LINK_CLASS(AVFoundation, AVMediaSelectionGroup) > SOFT_LINK_CLASS(AVFoundation, AVMediaSelectionOption) > SOFT_LINK_CLASS(AVFoundation, AVMetadataItem) > >-SOFT_LINK_POINTER_OPTIONAL(AVFoundation, AVMediaCharacteristicIsMainProgramContent, NSString *) >-SOFT_LINK_POINTER_OPTIONAL(AVFoundation, AVMediaCharacteristicDescribesVideoForAccessibility, NSString *) >-SOFT_LINK_POINTER_OPTIONAL(AVFoundation, AVMediaCharacteristicIsAuxiliaryContent, NSString *) >-SOFT_LINK_POINTER_OPTIONAL(AVFoundation, AVMediaCharacteristicTranscribesSpokenDialogForAccessibility, NSString *) >-SOFT_LINK_POINTER_OPTIONAL(AVFoundation, AVMetadataCommonKeyTitle, NSString *) >-SOFT_LINK_POINTER_OPTIONAL(AVFoundation, AVMetadataKeySpaceCommon, NSString *) >+SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVMediaCharacteristicIsMainProgramContent, NSString *) >+SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVMediaCharacteristicDescribesVideoForAccessibility, NSString *) >+SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVMediaCharacteristicIsAuxiliaryContent, NSString *) >+SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVMediaCharacteristicTranscribesSpokenDialogForAccessibility, NSString *) >+SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVMetadataCommonKeyTitle, NSString *) >+SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVMetadataKeySpaceCommon, NSString *) > > #define AVMetadataItem getAVMetadataItemClass() > >@@ -112,22 +112,22 @@ void AVTrackPrivateAVFObjCImpl::setEnabled(bool enabled) > AudioTrackPrivate::Kind AVTrackPrivateAVFObjCImpl::audioKind() const > { > if (m_assetTrack) { >- if ([m_assetTrack hasMediaCharacteristic:AVMediaCharacteristicIsAuxiliaryContent]) >+ if (canLoadAVMediaCharacteristicIsAuxiliaryContent() && [m_assetTrack hasMediaCharacteristic:AVMediaCharacteristicIsAuxiliaryContent]) > return AudioTrackPrivate::Alternative; >- if ([m_assetTrack hasMediaCharacteristic:AVMediaCharacteristicDescribesVideoForAccessibility]) >+ if (canLoadAVMediaCharacteristicDescribesVideoForAccessibility() && [m_assetTrack hasMediaCharacteristic:AVMediaCharacteristicDescribesVideoForAccessibility]) > return AudioTrackPrivate::Description; >- if ([m_assetTrack hasMediaCharacteristic:AVMediaCharacteristicIsMainProgramContent]) >+ if (canLoadAVMediaCharacteristicIsMainProgramContent() && [m_assetTrack hasMediaCharacteristic:AVMediaCharacteristicIsMainProgramContent]) > return AudioTrackPrivate::Main; > return AudioTrackPrivate::None; > } > > if (m_mediaSelectionOption) { > AVMediaSelectionOption *option = m_mediaSelectionOption->avMediaSelectionOption(); >- if ([option hasMediaCharacteristic:AVMediaCharacteristicIsAuxiliaryContent]) >+ if (canLoadAVMediaCharacteristicIsAuxiliaryContent() && [option hasMediaCharacteristic:AVMediaCharacteristicIsAuxiliaryContent]) > return AudioTrackPrivate::Alternative; >- if ([option hasMediaCharacteristic:AVMediaCharacteristicDescribesVideoForAccessibility]) >+ if (canLoadAVMediaCharacteristicDescribesVideoForAccessibility() && [option hasMediaCharacteristic:AVMediaCharacteristicDescribesVideoForAccessibility]) > return AudioTrackPrivate::Description; >- if ([option hasMediaCharacteristic:AVMediaCharacteristicIsMainProgramContent]) >+ if (canLoadAVMediaCharacteristicIsMainProgramContent() && [option hasMediaCharacteristic:AVMediaCharacteristicIsMainProgramContent]) > return AudioTrackPrivate::Main; > return AudioTrackPrivate::None; > } >@@ -139,26 +139,26 @@ AudioTrackPrivate::Kind AVTrackPrivateAVFObjCImpl::audioKind() const > VideoTrackPrivate::Kind AVTrackPrivateAVFObjCImpl::videoKind() const > { > if (m_assetTrack) { >- if ([m_assetTrack hasMediaCharacteristic:AVMediaCharacteristicDescribesVideoForAccessibility]) >+ if (canLoadAVMediaCharacteristicDescribesVideoForAccessibility() && [m_assetTrack hasMediaCharacteristic:AVMediaCharacteristicDescribesVideoForAccessibility]) > return VideoTrackPrivate::Sign; >- if ([m_assetTrack hasMediaCharacteristic:AVMediaCharacteristicTranscribesSpokenDialogForAccessibility]) >+ if (canLoadAVMediaCharacteristicTranscribesSpokenDialogForAccessibility() && [m_assetTrack hasMediaCharacteristic:AVMediaCharacteristicTranscribesSpokenDialogForAccessibility]) > return VideoTrackPrivate::Captions; >- if ([m_assetTrack hasMediaCharacteristic:AVMediaCharacteristicIsAuxiliaryContent]) >+ if (canLoadAVMediaCharacteristicIsAuxiliaryContent() && [m_assetTrack hasMediaCharacteristic:AVMediaCharacteristicIsAuxiliaryContent]) > return VideoTrackPrivate::Alternative; >- if ([m_assetTrack hasMediaCharacteristic:AVMediaCharacteristicIsMainProgramContent]) >+ if (canLoadAVMediaCharacteristicIsMainProgramContent() && [m_assetTrack hasMediaCharacteristic:AVMediaCharacteristicIsMainProgramContent]) > return VideoTrackPrivate::Main; > return VideoTrackPrivate::None; > } > > if (m_mediaSelectionOption) { > AVMediaSelectionOption *option = m_mediaSelectionOption->avMediaSelectionOption(); >- if ([option hasMediaCharacteristic:AVMediaCharacteristicDescribesVideoForAccessibility]) >+ if (canLoadAVMediaCharacteristicDescribesVideoForAccessibility() && [option hasMediaCharacteristic:AVMediaCharacteristicDescribesVideoForAccessibility]) > return VideoTrackPrivate::Sign; >- if ([option hasMediaCharacteristic:AVMediaCharacteristicTranscribesSpokenDialogForAccessibility]) >+ if (canLoadAVMediaCharacteristicTranscribesSpokenDialogForAccessibility() && [option hasMediaCharacteristic:AVMediaCharacteristicTranscribesSpokenDialogForAccessibility]) > return VideoTrackPrivate::Captions; >- if ([option hasMediaCharacteristic:AVMediaCharacteristicIsAuxiliaryContent]) >+ if (canLoadAVMediaCharacteristicIsAuxiliaryContent() && [option hasMediaCharacteristic:AVMediaCharacteristicIsAuxiliaryContent]) > return VideoTrackPrivate::Alternative; >- if ([option hasMediaCharacteristic:AVMediaCharacteristicIsMainProgramContent]) >+ if (canLoadAVMediaCharacteristicIsMainProgramContent() && [option hasMediaCharacteristic:AVMediaCharacteristicIsMainProgramContent]) > return VideoTrackPrivate::Main; > return VideoTrackPrivate::None; > } >@@ -189,6 +189,9 @@ AtomicString AVTrackPrivateAVFObjCImpl::id() const > > AtomicString AVTrackPrivateAVFObjCImpl::label() const > { >+ if (!canLoadAVMetadataCommonKeyTitle() || !canLoadAVMetadataKeySpaceCommon()) >+ return emptyAtom(); >+ > NSArray *commonMetadata = nil; > if (m_assetTrack) > commonMetadata = [m_assetTrack commonMetadata]; >diff --git a/Source/WebCore/platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h b/Source/WebCore/platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h >index ae9e1a5b161fe5538e2eb1512c596d0ae22bddf8..8d502667e586acf1a07b1977b244c3c25f67513d 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h >+++ b/Source/WebCore/platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h >@@ -23,8 +23,7 @@ > * THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#ifndef MediaSelectionGroupAVFObjC_h >-#define MediaSelectionGroupAVFObjC_h >+#pragma once > > #if ENABLE(VIDEO_TRACK) > >@@ -76,7 +75,7 @@ public: > > void updateOptions(const Vector<String>& characteristics); > >- using OptionContainer = HashMap<AVMediaSelectionOption*, RefPtr<MediaSelectionOptionAVFObjC>>; >+ using OptionContainer = HashMap<CFTypeRef, RefPtr<MediaSelectionOptionAVFObjC>>; > typename OptionContainer::ValuesIteratorRange options() { return m_options.values(); } > > AVMediaSelectionGroup *avMediaSelectionGroup() const { return m_mediaSelectionGroup.get(); } >@@ -97,5 +96,3 @@ private: > } > > #endif // ENABLE(VIDEO_TRACK) >- >-#endif // MediaSelectionGroupAVFObjC_h >diff --git a/Source/WebCore/platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm b/Source/WebCore/platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm >index a23d809d3a5ddfaf371162df1fcb60422b73dc78..b2c1e96634b3f564ffc0c5bd16b29ee42d84fa2c 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm >@@ -109,7 +109,7 @@ void MediaSelectionGroupAVFObjC::updateOptions(const Vector<String>& characteris > RetainPtr<NSSet> newAVOptions = adoptNS([[NSSet alloc] initWithArray:[getAVMediaSelectionGroupClass() playableMediaSelectionOptionsFromArray:[m_mediaSelectionGroup options]]]); > RetainPtr<NSMutableSet> oldAVOptions = adoptNS([[NSMutableSet alloc] initWithCapacity:m_options.size()]); > for (auto& avOption : m_options.keys()) >- [oldAVOptions addObject:avOption]; >+ [oldAVOptions addObject:(__bridge AVMediaSelectionOption *)avOption]; > > RetainPtr<NSMutableSet> addedAVOptions = adoptNS([newAVOptions mutableCopy]); > [addedAVOptions minusSet:oldAVOptions.get()]; >@@ -121,7 +121,7 @@ void MediaSelectionGroupAVFObjC::updateOptions(const Vector<String>& characteris > if (m_selectedOption && removedAVOption == m_selectedOption->avMediaSelectionOption()) > m_selectedOption = nullptr; > >- m_options.remove(removedAVOption); >+ m_options.remove((__bridge CFTypeRef)removedAVOption); > } > #pragma clang diagnostic push > #pragma clang diagnostic ignored "-Wdeprecated-declarations" >@@ -131,7 +131,7 @@ void MediaSelectionGroupAVFObjC::updateOptions(const Vector<String>& characteris > auto addedOption = MediaSelectionOptionAVFObjC::create(*this, addedAVOption); > if (addedAVOption == selectedOption) > m_selectedOption = addedOption.ptr(); >- m_options.set(addedAVOption, WTFMove(addedOption)); >+ m_options.set((__bridge CFTypeRef)addedAVOption, WTFMove(addedOption)); > } > > if (!m_shouldSelectOptionAutomatically) >@@ -164,8 +164,8 @@ void MediaSelectionGroupAVFObjC::updateOptions(const Vector<String>& characteris > if (m_selectedOption && m_selectedOption->avMediaSelectionOption() == preferredOption) > return; > >- ASSERT(m_options.contains(preferredOption)); >- m_selectedOption = m_options.get(preferredOption); >+ ASSERT(m_options.contains((__bridge CFTypeRef)preferredOption)); >+ m_selectedOption = m_options.get((__bridge CFTypeRef)preferredOption); > m_selectionTimer.startOneShot(0_s); > } > >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm >index 683c5c4b8a0f73482095c4b28025624998f077e7..d6d1486748013e93cf07e3d621ef9174528dd74f 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm >@@ -64,9 +64,9 @@ SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation) > SOFT_LINK_CLASS_OPTIONAL(AVFoundation, AVURLAsset) > SOFT_LINK_CLASS_OPTIONAL(AVFoundation, AVAssetReader) > SOFT_LINK_CLASS_OPTIONAL(AVFoundation, AVAssetReaderTrackOutput) >-SOFT_LINK_POINTER_OPTIONAL(AVFoundation, AVMediaCharacteristicVisual, NSString *) >-SOFT_LINK_POINTER_OPTIONAL(AVFoundation, AVURLAssetReferenceRestrictionsKey, NSString *) >-SOFT_LINK_POINTER_OPTIONAL(AVFoundation, AVURLAssetUsesNoPersistentCacheKey, NSString *) >+SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVMediaCharacteristicVisual, NSString *) >+SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVURLAssetReferenceRestrictionsKey, NSString *) >+SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVURLAssetUsesNoPersistentCacheKey, NSString *) > #define AVMediaCharacteristicVisual getAVMediaCharacteristicVisual() > #define AVURLAssetReferenceRestrictionsKey getAVURLAssetReferenceRestrictionsKey() > #define AVURLAssetUsesNoPersistentCacheKey getAVURLAssetUsesNoPersistentCacheKey() >@@ -224,24 +224,22 @@ namespace WebCore { > > static NSURL *customSchemeURL() > { >- static NeverDestroyed<RetainPtr<NSURL>> url; >- if (!url.get()) >- url.get() = adoptNS([[NSURL alloc] initWithString:@"custom-imagedecoderavfobjc://resource"]); >- >- return url.get().get(); >+ static NSURL *url = [[NSURL alloc] initWithString:@"custom-imagedecoderavfobjc://resource"]; >+ return url; > } > > static NSDictionary *imageDecoderAssetOptions() > { >- static NeverDestroyed<RetainPtr<NSDictionary>> options; >- if (!options.get()) { >- options.get() = @{ >+ static NSDictionary *options = [] { >+ // FIXME: Are these keys really optional? >+ if (!canLoadAVURLAssetReferenceRestrictionsKey() || !canLoadAVURLAssetUsesNoPersistentCacheKey()) >+ return [@{ } retain]; >+ return [@{ > AVURLAssetReferenceRestrictionsKey: @(AVAssetReferenceRestrictionForbidAll), > AVURLAssetUsesNoPersistentCacheKey: @YES, >- }; >- } >- >- return options.get().get(); >+ } retain]; >+ }(); >+ return options; > } > > static ImageDecoderAVFObjC::RotationProperties transformToRotationProperties(AffineTransform inTransform) >@@ -364,6 +362,12 @@ bool ImageDecoderAVFObjC::canDecodeType(const String& mimeType) > > AVAssetTrack *ImageDecoderAVFObjC::firstEnabledTrack() > { >+ // FIXME: Is AVMediaCharacteristicVisual truly optional? >+ if (!canLoadAVMediaCharacteristicVisual()) { >+ LOG(Images, "ImageDecoderAVFObjC::firstEnabledTrack(%p) - AVMediaCharacteristicVisual is not supported", this); >+ return nil; >+ } >+ > NSArray<AVAssetTrack *> *videoTracks = [m_asset tracksWithMediaCharacteristic:AVMediaCharacteristicVisual]; > NSUInteger firstEnabledIndex = [videoTracks indexOfObjectPassingTest:^(AVAssetTrack *track, NSUInteger, BOOL*) { > return track.enabled; >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h >index ab2f24699f68e775f4cf3b5453a0475acf3a36d5..99be9fb8ea27de7505d816987dda9afa6199a466 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h >@@ -357,7 +357,7 @@ private: > > #if HAVE(AVFOUNDATION_LOADER_DELEGATE) > friend class WebCoreAVFResourceLoader; >- HashMap<RetainPtr<AVAssetResourceLoadingRequest>, RefPtr<WebCoreAVFResourceLoader>> m_resourceLoaderMap; >+ HashMap<RetainPtr<CFTypeRef>, RefPtr<WebCoreAVFResourceLoader>> m_resourceLoaderMap; > RetainPtr<WebCoreAVFLoaderDelegate> m_loaderDelegate; > HashMap<String, RetainPtr<AVAssetResourceLoadingRequest>> m_keyURIToRequestMap; > HashMap<String, RetainPtr<AVAssetResourceLoadingRequest>> m_sessionIDToRequestMap; >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >index f907c7f4871d85ce6714e2865d0ed57e229c5a74..dc3deeb3f792090fb06727ef44734ad083d50f82 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >@@ -271,7 +271,7 @@ SOFT_LINK_CONSTANT(AVFoundation, AVMediaCharacteristicIsAuxiliaryContent, NSStri > #if ENABLE(DATACUE_VALUE) > > SOFT_LINK_CONSTANT(AVFoundation, AVMetadataKeySpaceQuickTimeUserData, NSString *) >-SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVMetadataKeySpaceISOUserData, NSString*) >+SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVMetadataKeySpaceISOUserData, NSString *) > SOFT_LINK_CONSTANT(AVFoundation, AVMetadataKeySpaceQuickTimeMetadata, NSString *) > SOFT_LINK_CONSTANT(AVFoundation, AVMetadataKeySpaceiTunes, NSString *) > SOFT_LINK_CONSTANT(AVFoundation, AVMetadataKeySpaceID3, NSString *) >@@ -288,7 +288,7 @@ SOFT_LINK_CONSTANT(AVFoundation, AVMetadataKeySpaceID3, NSString *) > > SOFT_LINK_CONSTANT(AVFoundation, AVURLAssetBoundNetworkInterfaceName, NSString *) > SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVURLAssetClientBundleIdentifierKey, NSString *) >-SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVURLAssetHTTPCookiesKey, NSString*) >+SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVURLAssetHTTPCookiesKey, NSString *) > SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVURLAssetRequiresCustomURLLoadingKey, NSString *) > > #define AVURLAssetBoundNetworkInterfaceName getAVURLAssetBoundNetworkInterfaceName() >@@ -1816,7 +1816,7 @@ bool MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource(AVAssetR > #endif > > RefPtr<WebCoreAVFResourceLoader> resourceLoader = WebCoreAVFResourceLoader::create(this, avRequest); >- m_resourceLoaderMap.add(avRequest, resourceLoader); >+ m_resourceLoaderMap.add((__bridge CFTypeRef)avRequest, resourceLoader); > resourceLoader->startLoading(); > return true; > } >@@ -1825,7 +1825,7 @@ void MediaPlayerPrivateAVFoundationObjC::didCancelLoadingRequest(AVAssetResource > { > String scheme = [[[avRequest request] URL] scheme]; > >- WebCoreAVFResourceLoader* resourceLoader = m_resourceLoaderMap.get(avRequest); >+ WebCoreAVFResourceLoader* resourceLoader = m_resourceLoaderMap.get((__bridge CFTypeRef)avRequest); > > if (resourceLoader) > resourceLoader->stopLoading(); >@@ -1833,7 +1833,7 @@ void MediaPlayerPrivateAVFoundationObjC::didCancelLoadingRequest(AVAssetResource > > void MediaPlayerPrivateAVFoundationObjC::didStopLoadingRequest(AVAssetResourceLoadingRequest *avRequest) > { >- m_resourceLoaderMap.remove(avRequest); >+ m_resourceLoaderMap.remove((__bridge CFTypeRef)avRequest); > } > #endif > >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h >index 1e55190df3d41619fdaf7d9de27dee16f209fdc1..0444d9af0573f5b727a6359db5de471da827aee3 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h >@@ -270,7 +270,7 @@ private: > #pragma clang diagnostic push > #pragma clang diagnostic ignored "-Wunknown-pragmas" > #pragma clang diagnostic ignored "-Wunguarded-availability-new" >- HashMap<RetainPtr<AVSampleBufferAudioRenderer>, AudioRendererProperties> m_sampleBufferAudioRendererMap; >+ HashMap<RetainPtr<CFTypeRef>, AudioRendererProperties> m_sampleBufferAudioRendererMap; > RetainPtr<AVSampleBufferRenderSynchronizer> m_synchronizer; > #pragma clang diagnostic pop > RetainPtr<id> m_timeJumpedObserver; >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm >index 25a0d860f042f918aa40151eb4435b3e7d641987..d402eaae6f4f6faf26bc919b1d6f8df50bcf87a6 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm >@@ -321,8 +321,8 @@ bool MediaPlayerPrivateMediaSourceAVFObjC::paused() const > > void MediaPlayerPrivateMediaSourceAVFObjC::setVolume(float volume) > { >- for (auto pair : m_sampleBufferAudioRendererMap) >- [pair.key setVolume:volume]; >+ for (auto key : m_sampleBufferAudioRendererMap.keys()) >+ [(__bridge AVSampleBufferAudioRenderer *)key.get() setVolume:volume]; > } > > bool MediaPlayerPrivateMediaSourceAVFObjC::supportsScanning() const >@@ -332,8 +332,8 @@ bool MediaPlayerPrivateMediaSourceAVFObjC::supportsScanning() const > > void MediaPlayerPrivateMediaSourceAVFObjC::setMuted(bool muted) > { >- for (auto pair : m_sampleBufferAudioRendererMap) >- [pair.key setMuted:muted]; >+ for (auto key : m_sampleBufferAudioRendererMap.keys()) >+ [(__bridge AVSampleBufferAudioRenderer *)key.get() setMuted:muted]; > } > > FloatSize MediaPlayerPrivateMediaSourceAVFObjC::naturalSize() const >@@ -477,8 +477,8 @@ void MediaPlayerPrivateMediaSourceAVFObjC::setRateDouble(double rate) > void MediaPlayerPrivateMediaSourceAVFObjC::setPreservesPitch(bool preservesPitch) > { > NSString *algorithm = preservesPitch ? AVAudioTimePitchAlgorithmSpectral : AVAudioTimePitchAlgorithmVarispeed; >- for (auto pair : m_sampleBufferAudioRendererMap) >- [pair.key setAudioTimePitchAlgorithm:algorithm]; >+ for (auto key : m_sampleBufferAudioRendererMap.keys()) >+ [(__bridge AVSampleBufferAudioRenderer *)key.get() setAudioTimePitchAlgorithm:algorithm]; > } > > MediaPlayer::NetworkState MediaPlayerPrivateMediaSourceAVFObjC::networkState() const >@@ -776,7 +776,7 @@ void MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame(bool flag) > void MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableAudioSample(AVSampleBufferAudioRenderer* renderer, bool flag) > #pragma clang diagnostic pop > { >- auto iter = m_sampleBufferAudioRendererMap.find(renderer); >+ auto iter = m_sampleBufferAudioRendererMap.find((__bridge CFTypeRef)renderer); > if (iter == m_sampleBufferAudioRendererMap.end()) > return; > >@@ -1020,11 +1020,9 @@ void MediaPlayerPrivateMediaSourceAVFObjC::setNetworkState(MediaPlayer::NetworkS > void MediaPlayerPrivateMediaSourceAVFObjC::addAudioRenderer(AVSampleBufferAudioRenderer* audioRenderer) > #pragma clang diagnostic pop > { >- if (m_sampleBufferAudioRendererMap.contains(audioRenderer)) >+ if (!m_sampleBufferAudioRendererMap.add((__bridge CFTypeRef)audioRenderer, AudioRendererProperties()).isNewEntry) > return; > >- m_sampleBufferAudioRendererMap.add(audioRenderer, AudioRendererProperties()); >- > [audioRenderer setMuted:m_player->muted()]; > [audioRenderer setVolume:m_player->volume()]; > [audioRenderer setAudioTimePitchAlgorithm:(m_player->preservesPitch() ? AVAudioTimePitchAlgorithmSpectral : AVAudioTimePitchAlgorithmVarispeed)]; >@@ -1039,7 +1037,7 @@ void MediaPlayerPrivateMediaSourceAVFObjC::addAudioRenderer(AVSampleBufferAudioR > void MediaPlayerPrivateMediaSourceAVFObjC::removeAudioRenderer(AVSampleBufferAudioRenderer* audioRenderer) > #pragma clang diagnostic pop > { >- auto iter = m_sampleBufferAudioRendererMap.find(audioRenderer); >+ auto iter = m_sampleBufferAudioRendererMap.find((__bridge CFTypeRef)audioRenderer); > if (iter == m_sampleBufferAudioRendererMap.end()) > return; > >diff --git a/Source/WebCore/platform/graphics/metal/GPUDrawableMetal.mm b/Source/WebCore/platform/graphics/metal/GPUDrawableMetal.mm >index 2b09ffd05f10aa9852b07bc67637c4ddd2c72c5c..fb3268c84a7e7ea940281d7099e7ee3be845867e 100644 >--- a/Source/WebCore/platform/graphics/metal/GPUDrawableMetal.mm >+++ b/Source/WebCore/platform/graphics/metal/GPUDrawableMetal.mm >@@ -30,8 +30,7 @@ > > #import "GPUDevice.h" > #import "Logging.h" >-#import <Metal/Metal.h> >-#import <QuartzCore/QuartzCore.h> >+#import "WebGPULayer.h" > > namespace WebCore { > >diff --git a/Source/WebCore/platform/mac/VideoFullscreenInterfaceMac.mm b/Source/WebCore/platform/mac/VideoFullscreenInterfaceMac.mm >index 8a0d02053df134b2f5aeb0e8db49e5cdbb798e3c..0ae6afeade313175d2e3685cd7a2b54e8506b07b 100644 >--- a/Source/WebCore/platform/mac/VideoFullscreenInterfaceMac.mm >+++ b/Source/WebCore/platform/mac/VideoFullscreenInterfaceMac.mm >@@ -64,7 +64,7 @@ using WebCore::VideoFullscreenChangeObserver; > using WebCore::PlaybackSessionModel; > > @interface WebVideoViewContainer : NSView { >- id <WebVideoViewContainerDelegate> _videoViewContainerDelegate; >+ __unsafe_unretained id <WebVideoViewContainerDelegate> _videoViewContainerDelegate; > } > > @property (nonatomic, assign) id <WebVideoViewContainerDelegate> videoViewContainerDelegate; >diff --git a/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.h b/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.h >index 0a7ac53d644fa0aecd6154672a6dc9fee163bcbd..e695af0bf255f1c630060652cca0f3d43105e55d 100644 >--- a/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.h >+++ b/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2012 Apple Inc. All rights reserved. >+ * Copyright (C) 2012-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -23,10 +23,7 @@ > * THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#if !PLATFORM(IOS) >- >-#ifndef WebCoreFullScreenPlaceholderView_h >-#define WebCoreFullScreenPlaceholderView_h >+#if PLATFORM(MAC) > > #import <wtf/RetainPtr.h> > >@@ -34,15 +31,11 @@ WEBCORE_EXPORT @interface WebCoreFullScreenPlaceholderView : NSView { > @private > RetainPtr<NSVisualEffectView> _effectView; > RetainPtr<NSTextField> _exitWarning; >- NSObject* _target; >- SEL _action; >+ __weak NSResponder *_target; > } >-@property(retain) id contents; >-@property(assign) NSObject* target; >-@property(assign) SEL action; >+@property (nullable, strong) id contents; >+@property (nullable, weak) NSResponder *target; > - (void)setExitWarningVisible:(BOOL)visible; > @end > >-#endif // WebCoreFullScreenPlaceholderView_h >- >-#endif // !PLATFORM(IOS) >+#endif >diff --git a/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.mm b/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.mm >index 760f58ee29031000c1f411670e04c405291a6e96..8561aa074710f9d3b02a5e5c09e936e622f602b2 100644 >--- a/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.mm >+++ b/Source/WebCore/platform/mac/WebCoreFullScreenPlaceholderView.mm >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2012 Apple Inc. All rights reserved. >+ * Copyright (C) 2012-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -24,20 +24,16 @@ > */ > > #include "config.h" >-#if !PLATFORM(IOS) >- > #include "WebCoreFullScreenPlaceholderView.h" > >+#if PLATFORM(MAC) >+ > #include "LocalizedStrings.h" > #include "WebCoreFullScreenWarningView.h" > #include <wtf/text/WTFString.h> > >-using WebCore::clickToExitFullScreenText; >-@interface CAFilter : NSObject >-+ (CAFilter *)filterWithType:(NSString *)type; >-@end >- > @implementation WebCoreFullScreenPlaceholderView >+ > - (id)initWithFrame:(NSRect)frameRect > { > self = [super initWithFrame:frameRect]; >@@ -73,7 +69,7 @@ - (id)initWithFrame:(NSRect)frameRect > _exitWarning.get().editable = NO; > _exitWarning.get().font = [NSFont systemFontOfSize:27]; > _exitWarning.get().selectable = NO; >- _exitWarning.get().stringValue = clickToExitFullScreenText(); >+ _exitWarning.get().stringValue = WebCore::clickToExitFullScreenText(); > _exitWarning.get().textColor = [NSColor tertiaryLabelColor]; > [_exitWarning sizeToFit]; > >@@ -86,9 +82,9 @@ - (id)initWithFrame:(NSRect)frameRect > } > > @synthesize target = _target; >-@synthesize action = _action; > > @dynamic contents; >+ > - (void)setContents:(id)contents > { > [[self layer] setContents:contents]; >@@ -104,13 +100,10 @@ - (void)setExitWarningVisible:(BOOL)visible > [_effectView setHidden:!visible]; > } > >-- (void)mouseDown:(NSEvent *)theEvent >+- (void)mouseDown:(NSEvent *)event > { >- UNUSED_PARAM(theEvent); >- >- if (!_target || !_action) >- return; >- [_target performSelector:_action]; >+ UNUSED_PARAM(event); >+ [_target cancelOperation:self]; > } > > @end >diff --git a/Source/WebCore/platform/mac/WebCoreObjCExtras.mm b/Source/WebCore/platform/mac/WebCoreObjCExtras.mm >index c5d9f9163babf5b05ad88ea7cedd68702ad4a691..53f02d43b8c2b1c41726743c79f3cddd9521fed0 100644 >--- a/Source/WebCore/platform/mac/WebCoreObjCExtras.mm >+++ b/Source/WebCore/platform/mac/WebCoreObjCExtras.mm >@@ -43,9 +43,8 @@ bool WebCoreObjCScheduleDeallocateOnMainThread(Class cls, id object) > return false; > > callOnMainThread([cls, object] { >- Method method = class_getInstanceMethod(cls, @selector(dealloc)); >- IMP imp = method_getImplementation(method); >- wtfCallIMP<void>(imp, object, @selector(dealloc)); >+ auto deallocSelector = sel_registerName("dealloc"); >+ wtfCallIMP<void>(method_getImplementation(class_getInstanceMethod(cls, deallocSelector)), object, deallocSelector); > }); > > return true; >diff --git a/Source/WebCore/platform/network/ResourceHandle.h b/Source/WebCore/platform/network/ResourceHandle.h >index fce796cadadc8a94b731368692c13c96ea2e680a..127286271d8ab7f8649efad5aa01fa0292c1eca4 100644 >--- a/Source/WebCore/platform/network/ResourceHandle.h >+++ b/Source/WebCore/platform/network/ResourceHandle.h >@@ -249,7 +249,7 @@ private: > #endif > > #if PLATFORM(COCOA) >- void applySniffingPoliciesAndStoragePartitionIfNeeded(NSURLRequest*&, bool shouldContentSniff, bool shouldContentEncodingSniff); >+ NSURLRequest *applySniffingPoliciesAndStoragePartitionIfNeeded(NSURLRequest *, bool shouldContentSniff, bool shouldContentEncodingSniff); > #endif > > #if USE(CURL) >diff --git a/Source/WebCore/platform/network/cocoa/CookieStorageObserver.mm b/Source/WebCore/platform/network/cocoa/CookieStorageObserver.mm >index bbc1beb32f39ed41f857217b231f876ffb8a00a6..918171c6b0707aa0800e9b8df294b41e1cf789d0 100644 >--- a/Source/WebCore/platform/network/cocoa/CookieStorageObserver.mm >+++ b/Source/WebCore/platform/network/cocoa/CookieStorageObserver.mm >@@ -30,13 +30,17 @@ > #import <wtf/MainThread.h> > #import <wtf/ProcessPrivilege.h> > >-@interface WebNSHTTPCookieStorageInternal : NSObject { >+@interface WebNSHTTPCookieStorageDummyForInternalAccess : NSObject { > @public >- id internal; >+ NSHTTPCookieStorageInternal *_internal; > } > @end > >-@implementation WebNSHTTPCookieStorageInternal >+@implementation WebNSHTTPCookieStorageDummyForInternalAccess >+@end >+ >+@interface NSHTTPCookieStorageInternal : NSObject >+- (void)registerForPostingNotificationsWithContext:(NSHTTPCookieStorage *)context; > @end > > @interface WebCookieObserverAdapter : NSObject { >@@ -105,10 +109,8 @@ void CookieStorageObserver::startObserving(WTF::Function<void()>&& callback) > > if (!m_hasRegisteredInternalsForNotifications) { > if (m_cookieStorage.get() != [NSHTTPCookieStorage sharedHTTPCookieStorage]) { >- auto selector = NSSelectorFromString(@"registerForPostingNotificationsWithContext:"); >- id internalObject = (static_cast<WebNSHTTPCookieStorageInternal *>(m_cookieStorage.get()))->internal; >- RELEASE_ASSERT([internalObject respondsToSelector:selector]); >- [internalObject performSelector:selector withObject:m_cookieStorage.get()]; >+ auto internalObject = (static_cast<WebNSHTTPCookieStorageDummyForInternalAccess *>(m_cookieStorage.get()))->_internal; >+ [internalObject registerForPostingNotificationsWithContext:m_cookieStorage.get()]; > } > > m_hasRegisteredInternalsForNotifications = true; >diff --git a/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.h b/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.h >index f42ac039661daffb2aaceaef6cec9254acba565d..56d87994ed7f6b081efb56c9ba6982ac8c57748e 100644 >--- a/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.h >+++ b/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.h >@@ -23,8 +23,7 @@ > * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#ifndef WebCoreNSURLSession_h >-#define WebCoreNSURLSession_h >+#pragma once > > #import "SecurityOrigin.h" > #import <Foundation/NSURLSession.h> >@@ -62,7 +61,7 @@ WEBCORE_EXPORT @interface WebCoreNSURLSession : NSObject { > RetainPtr<id<NSURLSessionDelegate>> _delegate; > RetainPtr<NSOperationQueue> _queue; > NSString *_sessionDescription; >- HashSet<RetainPtr<WebCoreNSURLSessionDataTask>> _dataTasks; >+ HashSet<RetainPtr<CFTypeRef>> _dataTasks; > HashSet<RefPtr<WebCore::SecurityOrigin>> _origins; > Lock _dataTasksLock; > BOOL _invalidated; >@@ -108,7 +107,7 @@ WEBCORE_EXPORT @interface WebCoreNSURLSession : NSObject { > @end > > @interface WebCoreNSURLSessionDataTask : NSObject { >- WebCoreNSURLSession *_session; >+ __unsafe_unretained WebCoreNSURLSession *_session; > RefPtr<WebCore::PlatformMediaResource> _resource; > RetainPtr<NSURLResponse> _response; > NSUInteger _taskIdentifier; >@@ -142,5 +141,3 @@ WEBCORE_EXPORT @interface WebCoreNSURLSession : NSObject { > @end > > NS_ASSUME_NONNULL_END >- >-#endif >diff --git a/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm b/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm >index de921f17c83ddb9cc52c1d7ca82351311ffced41..83a05dad172964eda50b4ce5cb5d80e85d460c74 100644 >--- a/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm >+++ b/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm >@@ -93,7 +93,7 @@ - (void)dealloc > { > Locker<Lock> locker(_dataTasksLock); > for (auto& task : _dataTasks) >- task.get().session = nil; >+ ((__bridge WebCoreNSURLSessionDataTask *)task.get()).session = nil; > } > > callOnMainThread([loader = WTFMove(_loader)] { >@@ -116,8 +116,8 @@ - (void)taskCompleted:(WebCoreNSURLSessionDataTask *)task > { > Locker<Lock> locker(_dataTasksLock); > >- ASSERT(_dataTasks.contains(task)); >- _dataTasks.remove(task); >+ ASSERT(_dataTasks.contains((__bridge CFTypeRef)task)); >+ _dataTasks.remove((__bridge CFTypeRef)task); > if (!_dataTasks.isEmpty() || !_invalidated) > return; > } >@@ -218,14 +218,14 @@ - (void)finishTasksAndInvalidate > > - (void)invalidateAndCancel > { >- Vector<RetainPtr<WebCoreNSURLSessionDataTask>> tasksCopy; >+ Vector<RetainPtr<CFTypeRef>> tasksCopy; > { > Locker<Lock> locker(_dataTasksLock); > tasksCopy = copyToVector(_dataTasks); > } > > for (auto& task : tasksCopy) >- [task cancel]; >+ [(__bridge WebCoreNSURLSessionDataTask *)task.get() cancel]; > > [self finishTasksAndInvalidate]; > } >@@ -253,7 +253,7 @@ - (void)getTasksWithCompletionHandler:(void (^)(NSArray<NSURLSessionDataTask *> > Locker<Lock> locker(_dataTasksLock); > array = [NSMutableArray arrayWithCapacity:_dataTasks.size()]; > for (auto& task : _dataTasks) >- [array addObject:task.get()]; >+ [array addObject:(__bridge WebCoreNSURLSessionDataTask *)task.get()]; > } > [self addDelegateOperation:^{ > completionHandler(array, nil, nil); >@@ -267,7 +267,7 @@ - (void)getAllTasksWithCompletionHandler:(void (^)(NSArray<__kindof NSURLSession > Locker<Lock> locker(_dataTasksLock); > array = [NSMutableArray arrayWithCapacity:_dataTasks.size()]; > for (auto& task : _dataTasks) >- [array addObject:task.get()]; >+ [array addObject:(__bridge WebCoreNSURLSessionDataTask *)task.get()]; > } > [self addDelegateOperation:^{ > completionHandler(array); >@@ -282,7 +282,7 @@ - (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request > WebCoreNSURLSessionDataTask *task = [[WebCoreNSURLSessionDataTask alloc] initWithSession:self identifier:_nextTaskIdentifier++ request:request]; > { > Locker<Lock> locker(_dataTasksLock); >- _dataTasks.add(task); >+ _dataTasks.add((__bridge CFTypeRef)task); > } > return (NSURLSessionDataTask *)[task autorelease]; > } >@@ -295,7 +295,7 @@ - (NSURLSessionDataTask *)dataTaskWithURL:(NSURL *)url > WebCoreNSURLSessionDataTask *task = [[WebCoreNSURLSessionDataTask alloc] initWithSession:self identifier:_nextTaskIdentifier++ URL:url]; > { > Locker<Lock> locker(_dataTasksLock); >- _dataTasks.add(task); >+ _dataTasks.add((__bridge CFTypeRef)task); > } > return (NSURLSessionDataTask *)[task autorelease]; > } >diff --git a/Source/WebCore/platform/network/mac/ResourceHandleMac.mm b/Source/WebCore/platform/network/mac/ResourceHandleMac.mm >index 8bac7412d063ef0392dd997db921c6432916a6e2..1b73407dadac350e33cbbfcc43dc53a798f35bca 100644 >--- a/Source/WebCore/platform/network/mac/ResourceHandleMac.mm >+++ b/Source/WebCore/platform/network/mac/ResourceHandleMac.mm >@@ -100,47 +100,51 @@ ResourceHandle::~ResourceHandle() > } > > #if PLATFORM(IOS) >+ > static bool synchronousWillSendRequestEnabled() > { > static bool disabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitDisableSynchronousWillSendRequestPreferenceKey"] || IOSApplication::isIBooks(); > return !disabled; > } >+ > #endif > > #if PLATFORM(COCOA) >-void ResourceHandle::applySniffingPoliciesAndStoragePartitionIfNeeded(NSURLRequest*& nsRequest, bool shouldContentSniff, bool shouldContentEncodingSniff) >+ >+NSURLRequest *ResourceHandle::applySniffingPoliciesAndStoragePartitionIfNeeded(NSURLRequest *request, bool shouldContentSniff, bool shouldContentEncodingSniff) > { > #if !PLATFORM(MAC) > UNUSED_PARAM(shouldContentEncodingSniff); > #elif __MAC_OS_X_VERSION_MIN_REQUIRED < 101302 > shouldContentEncodingSniff = true; > #endif >+ > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) > String storagePartition = d->m_context->storageSession().cookieStoragePartition(firstRequest(), std::nullopt, std::nullopt); > #else > String storagePartition; > #endif > if (shouldContentSniff && shouldContentEncodingSniff && storagePartition.isEmpty()) >- return; >+ return request; > >- auto mutableRequest = adoptNS([nsRequest mutableCopy]); >+ auto mutableRequest = adoptNS([request mutableCopy]); > > #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101302 > if (!shouldContentEncodingSniff) >- [mutableRequest _setProperty:@(YES) forKey:(NSString *)kCFURLRequestContentDecoderSkipURLCheck]; >+ [mutableRequest _setProperty:@(YES) forKey:(__bridge NSString *)kCFURLRequestContentDecoderSkipURLCheck]; > #endif > > if (!shouldContentSniff) >- [mutableRequest _setProperty:@(NO) forKey:(NSString *)_kCFURLConnectionPropertyShouldSniff]; >+ [mutableRequest _setProperty:@(NO) forKey:(__bridge NSString *)_kCFURLConnectionPropertyShouldSniff]; > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) > if (!storagePartition.isEmpty()) > [mutableRequest _setProperty:storagePartition forKey:@"__STORAGE_PARTITION_IDENTIFIER"]; > #endif > >- nsRequest = mutableRequest.autorelease(); >- >+ return mutableRequest.autorelease(); > } >+ > #endif > > #if !PLATFORM(IOS) >@@ -180,7 +184,7 @@ void ResourceHandle::createNSURLConnection(id delegate, bool shouldUseCredential > } > > NSURLRequest *nsRequest = firstRequest().nsURLRequest(HTTPBodyUpdatePolicy::UpdateHTTPBody); >- applySniffingPoliciesAndStoragePartitionIfNeeded(nsRequest, shouldContentSniff, shouldContentEncodingSniff); >+ nsRequest = applySniffingPoliciesAndStoragePartitionIfNeeded(nsRequest, shouldContentSniff, shouldContentEncodingSniff); > > if (d->m_storageSession) > nsRequest = [copyRequestWithStorageSession(d->m_storageSession.get(), nsRequest) autorelease]; >@@ -211,7 +215,7 @@ void ResourceHandle::createNSURLConnection(id delegate, bool shouldUseCredential > > RetainPtr<CFDataRef> sourceApplicationAuditData = d->m_context->sourceApplicationAuditData(); > if (sourceApplicationAuditData) >- [streamProperties setObject:(NSData *)sourceApplicationAuditData.get() forKey:@"kCFStreamPropertySourceApplication"]; >+ [streamProperties setObject:(__bridge NSData *)sourceApplicationAuditData.get() forKey:@"kCFStreamPropertySourceApplication"]; > > #if PLATFORM(IOS) > NSMutableDictionary *propertyDictionary = [NSMutableDictionary dictionaryWithDictionary:connectionProperties]; >@@ -309,13 +313,13 @@ void ResourceHandle::schedule(SchedulePair& pair) > NSRunLoop *runLoop = pair.nsRunLoop(); > if (!runLoop) > return; >- [d->m_connection.get() scheduleInRunLoop:runLoop forMode:(NSString *)pair.mode()]; >+ [d->m_connection.get() scheduleInRunLoop:runLoop forMode:(__bridge NSString *)pair.mode()]; > } > > void ResourceHandle::unschedule(SchedulePair& pair) > { > if (NSRunLoop *runLoop = pair.nsRunLoop()) >- [d->m_connection.get() unscheduleFromRunLoop:runLoop forMode:(NSString *)pair.mode()]; >+ [d->m_connection.get() unscheduleFromRunLoop:runLoop forMode:(__bridge NSString *)pair.mode()]; > } > > id ResourceHandle::makeDelegate(bool shouldUseCredentialStorage, MessageQueue<Function<void()>>* queue) >diff --git a/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm b/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm >index f265465f2adbc20f34c424083d1e02573c4aff86..1dc6df7f839417a9436b533d9c0d4ead79e99f82 100644 >--- a/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm >+++ b/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm >@@ -294,7 +294,7 @@ void adjustMIMETypeIfNecessary(CFURLResponseRef cfResponse, bool isMainResourceL > > if (!result) { > auto url = CFURLResponseGetURL(cfResponse); >- if ([(NSURL *)url isFileURL]) { >+ if ([(__bridge NSURL *)url isFileURL]) { > RetainPtr<CFStringRef> extension = adoptCF(CFURLCopyPathExtension(url)); > if (extension) { > // <rdar://problem/7007389> CoreTypes UTI map is missing 100+ file extensions that GateKeeper knew about >diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp >index 03ae9fc83ea0a88692970cc47fb1f3168d585a93..a3e96ed9651dda7baa559ed139f76de335a9b8d5 100644 >--- a/Source/WebCore/testing/Internals.cpp >+++ b/Source/WebCore/testing/Internals.cpp >@@ -232,10 +232,6 @@ > #include "MockMediaPlayerMediaSource.h" > #endif > >-#if PLATFORM(MAC) >-#include "DictionaryLookup.h" >-#endif >- > #if ENABLE(CONTENT_FILTERING) > #include "MockContentFilterSettings.h" > #endif >@@ -1858,23 +1854,12 @@ RefPtr<Range> Internals::rangeOfStringNearLocation(const Range& searchRange, con > return findClosestPlainText(searchRange, text, { }, targetOffset); > } > >-ExceptionOr<RefPtr<Range>> Internals::rangeForDictionaryLookupAtLocation(int x, int y) >+#if !PLATFORM(MAC) >+ExceptionOr<RefPtr<Range>> Internals::rangeForDictionaryLookupAtLocation(int, int) > { >-#if PLATFORM(MAC) >- auto* document = contextDocument(); >- if (!document || !document->frame()) >- return Exception { InvalidAccessError }; >- >- document->updateLayoutIgnorePendingStylesheets(); >- >- HitTestResult result = document->frame()->mainFrame().eventHandler().hitTestResultAtPoint(IntPoint(x, y)); >- return DictionaryLookup::rangeAtHitTestResult(result, nullptr); >-#else >- UNUSED_PARAM(x); >- UNUSED_PARAM(y); > return Exception { InvalidAccessError }; >-#endif > } >+#endif > > ExceptionOr<void> Internals::setDelegatesScrolling(bool enabled) > { >diff --git a/Source/WebCore/testing/Internals.mm b/Source/WebCore/testing/Internals.mm >index dde70b3914c1740290d3fda46585ecf4ba754c6e..6fcdcbedd3f7da4cc5420a9367342941a5c11497 100644 >--- a/Source/WebCore/testing/Internals.mm >+++ b/Source/WebCore/testing/Internals.mm >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2015 Apple Inc. All rights reserved. >+ * Copyright (C) 2015-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -23,12 +23,17 @@ > * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#include "config.h" >-#include "Internals.h" >+#import "config.h" >+#import "Internals.h" > >-#include "DOMURL.h" >-#include "WebCoreNSURLExtras.h" >-#include <wtf/SoftLinking.h> >+#import "DOMURL.h" >+#import "DictionaryLookup.h" >+#import "Document.h" >+#import "EventHandler.h" >+#import "HitTestResult.h" >+#import "Range.h" >+#import "WebCoreNSURLExtras.h" >+#import <wtf/SoftLinking.h> > > #if PLATFORM(IOS) > SOFT_LINK_FRAMEWORK(UIKit) >@@ -42,7 +47,6 @@ String Internals::userVisibleString(const DOMURL& url) > return WebCore::userVisibleString(url.href()); > } > >-#if PLATFORM(COCOA) > bool Internals::userPrefersReducedMotion() const > { > #if PLATFORM(IOS) >@@ -51,6 +55,23 @@ bool Internals::userPrefersReducedMotion() const > return [[NSWorkspace sharedWorkspace] accessibilityDisplayShouldReduceMotion]; > #endif > } >+ >+#if PLATFORM(MAC) >+ >+ExceptionOr<RefPtr<Range>> Internals::rangeForDictionaryLookupAtLocation(int x, int y) >+{ >+ auto* document = contextDocument(); >+ if (!document || !document->frame()) >+ return Exception { InvalidAccessError }; >+ >+ document->updateLayoutIgnorePendingStylesheets(); >+ >+ HitTestResult result = document->frame()->mainFrame().eventHandler().hitTestResultAtPoint(IntPoint(x, y)); >+ RefPtr<Range> range; >+ std::tie(range, std::ignore) = DictionaryLookup::rangeAtHitTestResult(result); >+ return WTFMove(range); >+} >+ > #endif > > } >diff --git a/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm b/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm >index 66b072fb4ee7e762fa1144e58e55f5c0077d06e4..47251d82fb33984d7f7f2a2f6c248ef857f2cc90 100644 >--- a/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm >+++ b/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm >@@ -288,10 +288,8 @@ - (void)enterFullScreen:(NSScreen *)screen > _page->setSuppressVisibilityUpdates(true); > > // Swap the webView placeholder into place. >- if (!_webViewPlaceholder) { >+ if (!_webViewPlaceholder) > _webViewPlaceholder = adoptNS([[WebCoreFullScreenPlaceholderView alloc] initWithFrame:[_webView frame]]); >- [_webViewPlaceholder setAction:@selector(cancelOperation:)]; >- } > [_webViewPlaceholder setTarget:nil]; > [_webViewPlaceholder setContents:(__bridge id)webViewContents.get()]; > self.savedConstraints = _webView.superview.constraints; >diff --git a/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm b/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm >index 5cc54249f3293cea16735662bbda4ffae9452763..9f0d9484cdda0836b6ec309bfb58ea2b73f954c8 100644 >--- a/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm >+++ b/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm >@@ -2088,8 +2088,9 @@ std::tuple<String, PDFSelection *, NSDictionary *> PDFPlugin::lookupTextAtLocati > return { selection.string, selection, nil }; > } > >- NSDictionary *options = nil; >- NSString *lookupText = DictionaryLookup::stringForPDFSelection(selection, &options); >+ NSString *lookupText; >+ NSDictionary *options; >+ std::tie(lookupText, options) = DictionaryLookup::stringForPDFSelection(selection); > if (!lookupText.length) > return { emptyString(), selection, nil }; > >diff --git a/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm b/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm >index 8e2b50af5dc4ed31458e9987ea3957dcf2a46e3d..76279f8dab75d2a3ccdd1ce5709aaf652556a851 100644 >--- a/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm >+++ b/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm >@@ -399,8 +399,9 @@ void WebPage::performDictionaryLookupAtLocation(const FloatPoint& floatPoint) > > // Find the frame the point is over. > HitTestResult result = m_page->mainFrame().eventHandler().hitTestResultAtPoint(m_page->mainFrame().view()->windowToContents(roundedIntPoint(floatPoint))); >- NSDictionary *options = nil; >- auto range = DictionaryLookup::rangeAtHitTestResult(result, &options); >+ RefPtr<Range> range; >+ NSDictionary *options; >+ std::tie(range, options) = DictionaryLookup::rangeAtHitTestResult(result); > if (!range) > return; > >@@ -413,8 +414,10 @@ void WebPage::performDictionaryLookupAtLocation(const FloatPoint& floatPoint) > > void WebPage::performDictionaryLookupForSelection(Frame& frame, const VisibleSelection& selection, TextIndicatorPresentationTransition presentationTransition) > { >- NSDictionary *options = nil; >- if (auto selectedRange = DictionaryLookup::rangeForSelection(selection, &options)) >+ RefPtr<Range> selectedRange; >+ NSDictionary *options; >+ std::tie(selectedRange, options) = DictionaryLookup::rangeForSelection(selection); >+ if (selectedRange) > performDictionaryLookupForRange(frame, *selectedRange, options, presentationTransition); > } > >@@ -1052,9 +1055,7 @@ std::tuple<RefPtr<WebCore::Range>, NSDictionary *> WebPage::lookupTextAtLocation > > auto point = roundedIntPoint(locationInViewCoordinates); > auto result = mainFrame.eventHandler().hitTestResultAtPoint(m_page->mainFrame().view()->windowToContents(point)); >- NSDictionary *options = nil; >- auto range = DictionaryLookup::rangeAtHitTestResult(result, &options); >- return { WTFMove(range), WTFMove(options) }; >+ return DictionaryLookup::rangeAtHitTestResult(result); > } > > void WebPage::immediateActionDidUpdate() >diff --git a/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm b/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm >index a868575cf194be6e3388f7c59eb023f82f53f973..926d4e4264e92e2e2a07d398568e5d31a3166dc3 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm >@@ -565,8 +565,9 @@ - (id<NSImmediateActionAnimationController>)_animationControllerForText > if (!frame) > return nil; > >- NSDictionary *options = nil; >- auto dictionaryRange = DictionaryLookup::rangeAtHitTestResult(_hitTestResult, &options); >+ RefPtr<Range> dictionaryRange; >+ NSDictionary *options; >+ std::tie(dictionaryRange, options) = DictionaryLookup::rangeAtHitTestResult(_hitTestResult); > if (!dictionaryRange) > return nil; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
sam
:
review+
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188140
:
346001
| 346012 |
346022