[Cocoa] More tweaks and refactoring to prepare for ARC
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Aug 2018 02:39:12 +0000 (02:39 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Aug 2018 02:39:12 +0000 (02:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188245

Reviewed by Dan Bernstein.

Source/JavaScriptCore:

* API/JSValue.mm: Use __unsafe_unretained.
(JSContainerConvertor::convert): Use auto for compatibility with the above.
* API/JSWrapperMap.mm:
(allocateConstructorForCustomClass): Use CFTypeRef instead of Protocol *.
(-[JSWrapperMap initWithGlobalContextRef:]): Use __unsafe_unretained.

* heap/Heap.cpp: Updated include for rename: FoundationSPI.h -> objcSPI.h.

Source/WebCore:

* bridge/objc/objc_instance.mm: Updated include for rename: FoundationSPI.h -> objcSPI.h.
* platform/ios/wak/WebCoreThread.mm: Ditto.

Source/WebKit:

* Platform/cocoa/WKCrashReporter.mm:
(WebKit::setCrashLogMessage): Refactor into a separate function for clarity.
(WebKit::setCrashReportApplicationSpecificInformation): Use a bridging cast.

* Shared/mac/PasteboardTypes.mm:
(WebKit::PasteboardTypes::forEditing): Use a bridging cast.

* WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
(WebKit::convertToNPNNString): Added. Uses CFStringRef rather than NSString so we can
manually manage the autoreleasing.
(WebKit::initializeKeyboardEvent): Use convertToNPNNString.
(WebKit::NetscapePlugin::sendComplexTextInput): Ditto.

* WebProcess/Plugins/PDF/PDFPlugin.mm: Use __unsafe_unretained explicitly
for a parent pointer. We could consider moving to __weak after switching to ARC.

Source/WebKitLegacy/mac:

* Carbon/CarbonUtils.m: Updated include for rename: FoundationSPI.h -> objcSPI.h.

* Carbon/CarbonWindowFrame.m:
(-[CarbonWindowFrame dealloc]): Deleted. It was empty.

* DOM/DOM.mm:
(-[DOMElement _imageTIFFRepresentation]): Use a bridging cast.
(-[DOMNodeFilter finalize]): Deleted. WebKit no longer supports Objective-C
garbage collection so this method isn't useful.

* DOM/DOMXPath.mm:
(-[DOMNativeXPathNSResolver finalize]): Deleted. WebKit no longer supports
Objective-C garbage collection so this method isn't useful.

* History/WebHistory.mm:
(-[WebHistoryPrivate data]): Allocate an NSData instead of casting from a CFData.

* Misc/WebElementDictionary.mm:
(addLookupKey): Use a bridging cast.
(cacheValueForKey): Ditto.
(-[WebElementDictionary _fillCache]): Ditto.
(-[WebElementDictionary objectForKey:]): Ditto.

* Misc/WebKitNSStringExtras.mm:
(-[NSString _web_drawAtPoint:font:textColor:]): Use a bridging cast.
(-[NSString _web_widthWithFont:]): Ditto.
(-[NSString _webkit_stringByTrimmingWhitespace]): Ditto.

* Misc/WebLocalizableStrings.mm:
(WebLocalizedString): Use a bridging cast.

* Misc/WebNSDataExtras.mm:
(-[NSString _web_capitalizeRFC822HeaderFieldName]): Use a bridging cast
and use CFBridgingRelease instead of calling autorelease directly.
(-[NSData _webkit_parseRFC822HeaderFields]): Use NSString methods instead
of a mix of CFString and NSString. Also simplified logic a bit, and cut down
on the amount of explicit release and autorelease.

* Misc/WebNSDictionaryExtras.h: Deleted unused methods.
* Misc/WebNSDictionaryExtras.m:
(-[NSDictionary _webkit_intForKey:]): Deleted.
(-[NSMutableDictionary _webkit_setInt:forKey:]): Deleted.
(-[NSMutableDictionary _webkit_setFloat:forKey:]): Deleted.
(-[NSMutableDictionary _webkit_setBool:forKey:]): Deleted.
(-[NSMutableDictionary _webkit_setLongLong:forKey:]): Deleted.
(-[NSMutableDictionary _webkit_setUnsignedLongLong:forKey:]): Deleted.
(-[NSMutableDictionary _webkit_setUnsignedInt:forKey:]): Deleted.

* Misc/WebStringTruncator.mm:
(fontFromNSFont): Use a bridging cast.

* Plugins/Hosted/NetscapePluginHostManager.mm:
(WebKit::preferredBundleLocalizationName): Use a bridging cast and CFBridgingRelease.

* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::cleanup): Use a bridging cast.
(WebKit::NetscapePluginInstanceProxy::status): Ditto.
(WebKit::NetscapePluginInstanceProxy::loadURL): Ditto.
(WebKit::NetscapePluginInstanceProxy::demarshalValueFromArray): Ditto.
* Plugins/Hosted/ProxyInstance.mm:
(WebKit::ProxyInstance::getPropertyNames): Ditto.
* Plugins/WebBasePluginPackage.mm:
(-[WebBasePluginPackage _objectForInfoDictionaryKey:]): Ditto.
* Plugins/WebNetscapePluginEventHandlerCocoa.mm:
(WebNetscapePluginEventHandlerCocoa::platformWindow): Ditto.
* Plugins/WebNetscapePluginPackage.mm:
(-[WebNetscapePluginPackage _initWithPath:]): Ditto.

* Plugins/WebNetscapePluginView.mm:
(-[WebNetscapePluginView _postURL:target:len:buf:file:notifyData:sendNotification:allowHeaders:]):
Use bridging casts and use RetainPtr insteead of an explicit CFRelease.
(-[WebNetscapePluginView status:]): Use a bridging cast.
(-[WebNetscapePluginView popUpContextMenu:]): Ditto.

* Plugins/WebPluginController.mm:
(-[WebPluginController _cancelOutstandingChecks]): Use a bridging cast.

* Plugins/WebPluginDatabase.mm:
(checkCandidate): Use explicit __strong for out argument types.

* Plugins/npapi.mm:
(pluginViewForInstance): Use a bridging cast.

* Storage/WebDatabaseManager.mm:
(-[WebDatabaseManager detailsForDatabase:withOrigin:]): Use modern boxing instead of
explicit NSNumber and NSDictionary calls.

* WebCoreSupport/WebContextMenuClient.mm:
(WebContextMenuClient::speak): Remove an unnecessary copy/autorelease pair.

* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::handleKeyboardEvent): Added a missing typecast.
(WebEditorClient::handleInputMethodKeydown): Ditto.

* WebCoreSupport/WebFrameNetworkingContext.mm:
(WebFrameNetworkingContext::sourceApplicationAuditData const): Use a bridging cast.

* WebCoreSupport/WebSecurityOriginPrivate.h: Forward declare WebSecurityOriginPrivate
as a struct rather than an Objective-C class, since that's how it's defined.

* WebInspector/WebNodeHighlighter.mm: Added missing includes.

* WebView/WebFullScreenController.mm:
(-[WebFullScreenController enterFullScreen:]): Use a bridging cast.
* WebView/WebHTMLView.mm:
(-[WebHTMLView _writeSelectionWithPasteboardTypes:toPasteboard:cachedAttributedString:]):
Ditto.
(-[WebHTMLView pasteboard:provideDataForType:]): Ditto.

* WebView/WebImmediateActionController.mm:
(-[WebImmediateActionController performHitTestAtPoint:]): Removed redundant code to
go down to the document and then back to the frame.
(-[WebImmediateActionController immediateActionRecognizerDidUpdateAnimation:]): Ditto.
(-[WebImmediateActionController immediateActionRecognizerDidCancelAnimation:]): Ditto.
(-[WebImmediateActionController immediateActionRecognizerDidCompleteAnimation:]): Ditto.

* WebView/WebJSPDFDoc.mm:
(jsPDFDocInitialize): Removed some unneeded type casting.
(jsPDFDocFinalize): Ditto.
(jsPDFDocPrint): Use a bridging cast.

* WebView/WebPDFView.mm:
(_applicationInfoForMIMEType): Use bridging casts.

* WebView/WebPreferences.mm:
(-[WebPreferences _setIntegerValue:forKey:]): Use boxing and setObject directly
instead of methods from WebNSDictionaryExtras.
(-[WebPreferences _setUnsignedIntValue:forKey:]): Ditto.
(-[WebPreferences _setFloatValue:forKey:]): Ditto.
(-[WebPreferences _setBoolValue:forKey:]): Ditto.
(-[WebPreferences _setLongLongValue:forKey:]): Ditto.
(-[WebPreferences _setUnsignedLongLongValue:forKey:]): Ditto.

* WebView/WebView.mm:
(-[WebView _removeFromAllWebViewsSet]): Use bridging cast.
(-[WebView _addToAllWebViewsSet]): Ditto.
(+[WebView closeAllWebViews]): Use a modern for loop instead of NSEnumerator.
(-[WebView _windowVisibilityChanged:]): Moved this into the internal category
so it can be called from WebViewData methods.

* WebView/WebViewData.mm: Added an import so we can call an internal WebView
method, _windowVisibilityChanged:.

* WebView/WebViewInternal.h: Declared _windowVisibilityChanged: so it can be
called from WebViewData methods.

Source/WTF:

* WTF.xcodeproj/project.pbxproj: Updated for rename: FoundationSPI.h -> objcSPI.h.

* wtf/BlockPtr.h: Added missing include of "StdLibExtras.h".
Also re-sorted includes.

* wtf/HashFunctions.h: Add function for "__unsafe_unretained id".
* wtf/HashTraits.h: Add traits for "__unsafe_unretained id".

* wtf/PlatformMac.cmake: Updated for rename: FoundationSPI.h -> objcSPI.h.

* wtf/WeakObjCPtr.h: Use mutable instead of const_cast, and write a version
that uses __weak explicitly under ARC. Also moved function declarations from
here to objcSPI.h.

* wtf/cocoa/AutodrainedPool.cpp: Updated include for rename: FoundationSPI.h -> objcSPI.h.

* wtf/spi/cocoa/objcSPI.h: Renamed from FoundationSPI.h and added the
additional functions used by WeakObjCPtr.h. Also changed to both include the
internal header and the function definitions when compiling with
USE(APPLE_INTERNAL_SDK), helping us check that function definitions match.

Tools:

* DumpRenderTree/TestNetscapePlugIn/PluginObject.h: Use const void* for a
CFTypeRef instead of void*.

* DumpRenderTree/TestNetscapePlugIn/PluginObjectMac.mm:
(createCoreAnimationLayer): Use CFBridgingRetain.

* DumpRenderTree/mac/AccessibilityUIElementMac.mm:
(AccessibilityUIElement::lineTextMarkerRangeForTextMarker): Use bridging casts.
(AccessibilityUIElement::textMarkerRangeForElement): Ditto.
(AccessibilityUIElement::selectedTextMarkerRange): Ditto.
(AccessibilityUIElement::textMarkerRangeLength): Ditto.
(AccessibilityUIElement::attributedStringForTextMarkerRangeContainsAttribute): Ditto.
(AccessibilityUIElement::indexForTextMarker): Ditto.
(AccessibilityUIElement::textMarkerForIndex): Ditto.
(AccessibilityUIElement::isTextMarkerValid): Ditto.
(AccessibilityUIElement::previousTextMarker): Ditto.
(AccessibilityUIElement::nextTextMarker): Ditto.
(AccessibilityUIElement::stringForTextMarkerRange): Ditto.
(createJSStringRef): Ditto.
(AccessibilityUIElement::attributedStringForTextMarkerRange): Ditto.
(AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions): Ditto.
(AccessibilityUIElement::textMarkerRangeForMarkers): Ditto.
(AccessibilityUIElement::startTextMarkerForTextMarkerRange): Ditto.
(AccessibilityUIElement::endTextMarkerForTextMarkerRange): Ditto.
(AccessibilityUIElement::endTextMarkerForBounds): Ditto.
(AccessibilityUIElement::startTextMarkerForBounds): Ditto.
(AccessibilityUIElement::textMarkerForPoint): Ditto.
(AccessibilityUIElement::accessibilityElementForTextMarker): Ditto.
(AccessibilityUIElement::startTextMarker): Ditto.
(AccessibilityUIElement::endTextMarker): Ditto.
(AccessibilityUIElement::setSelectedVisibleTextRange): Ditto.
(AccessibilityUIElement::leftWordTextMarkerRangeForTextMarker): Ditto.
(AccessibilityUIElement::rightWordTextMarkerRangeForTextMarker): Ditto.
(AccessibilityUIElement::previousWordStartTextMarkerForTextMarker): Ditto.
(AccessibilityUIElement::nextWordEndTextMarkerForTextMarker): Ditto.
(AccessibilityUIElement::paragraphTextMarkerRangeForTextMarker): Ditto.
(AccessibilityUIElement::previousParagraphStartTextMarkerForTextMarker): Ditto.
(AccessibilityUIElement::nextParagraphEndTextMarkerForTextMarker): Ditto.
(AccessibilityUIElement::sentenceTextMarkerRangeForTextMarker): Ditto.
(AccessibilityUIElement::previousSentenceStartTextMarkerForTextMarker): Ditto.
(AccessibilityUIElement::nextSentenceEndTextMarkerForTextMarker): Ditto.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues): Use bridging cast.
(dumpFramesAsText): Ditto.
(dumpBackForwardListForAllWindows): Use a modern for loop instead of
CFArray functions to iterate the array.
(dump): Use bridging cast.
(runTest): Ditto.

* DumpRenderTree/mac/DumpRenderTreePasteboard.mm:
(+[LocalPasteboard alloc]): Use class_createInstance instead of NSAllocateObject.
(toUTI): Return a RetainPtr<CFStringRef>.
(-[LocalPasteboard types]): Use the above and bridging casts.
(-[LocalPasteboard availableTypeFromArray:]): Ditto.
(-[LocalPasteboard setData:forType:]): Ditto.
(-[LocalPasteboard dataForType:]): Ditto.
(-[LocalPasteboard setPropertyList:forType:]): Use NSPropertyListSerialization
instead of CFPropertyList.
(-[LocalPasteboard setString:forType:]): Use NSString method instead of
CFStringCreateExternalRepresentation.

* DumpRenderTree/mac/MockGeolocationProvider.h: Put CFTypeRef in a HashSet
instead of an Objective-C object pointer type.
* DumpRenderTree/mac/MockGeolocationProvider.mm:
(-[MockGeolocationProvider registerWebView:]): Update for above.
(-[MockGeolocationProvider unregisterWebView:]): Ditto.
(-[MockGeolocationProvider timerFired]): Ditto.

* DumpRenderTree/mac/MockWebNotificationProvider.h: Use CFTypeRef in
HashMap and HashSet instead of an Objective-C object pointer type.
* DumpRenderTree/mac/MockWebNotificationProvider.mm:
(-[MockWebNotificationProvider registerWebView:]): Update for above.
(-[MockWebNotificationProvider unregisterWebView:]): Ditto.
(-[MockWebNotificationProvider showNotification:fromWebView:]): Ditto.
(-[MockWebNotificationProvider cancelNotification:]): Ditto.
(-[MockWebNotificationProvider simulateWebNotificationClick:]): Ditto.

* DumpRenderTree/mac/ObjCPlugin.m:
(-[JSObjC retainObject:]): Use CFRetain instead of -[NSObject retain].

* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::addDisallowedURL): Use bridging cast.
(TestRunner::applicationCacheDiskUsageForOrigin): Ditto.
(TestRunner::clearApplicationCacheForOrigin): Ditto.
(originsArrayToJS): Ditto.
(TestRunner::copyDecodedHostName): Ditto.
(TestRunner::copyEncodedHostName): Ditto.
(TestRunner::queueLoad): Ditto.
(TestRunner::setDomainRelaxationForbiddenForURLScheme): Ditto.
(TestRunner::setMockGeolocationPositionUnavailableError): Ditto.
(TestRunner::setUserStyleSheetLocation): Ditto.
(TestRunner::setValueForUser): Ditto.
(TestRunner::overridePreference): Ditto.
(TestRunner::execCommand): Ditto.
(TestRunner::findString): Ditto.
(TestRunner::isCommandEnabled): Ditto.
(TestRunner::addOriginAccessWhitelistEntry): Ditto.
(TestRunner::removeOriginAccessWhitelistEntry): Ditto.
(TestRunner::addUserScript): Ditto.
(TestRunner::addUserStyleSheet): Ditto.
(TestRunner::evaluateInWebInspector): Ditto.
(TestRunner::evaluateScriptInIsolatedWorld): Ditto.
(TestRunner::authenticateSession): Ditto.
(TestRunner::grantWebNotificationPermission): Ditto.
(TestRunner::denyWebNotificationPermission): Ditto.
* TestRunnerShared/cocoa/LayoutTestSpellChecker.mm:
(-[LayoutTestSpellChecker setResultsFromJSObject:inContext:]): Ditto.

* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::lineTextMarkerRangeForTextMarker): Use bridging cast.
(WTR::AccessibilityUIElement::textMarkerRangeForElement): Ditto.
(WTR::AccessibilityUIElement::previousTextMarker): Ditto.
(WTR::AccessibilityUIElement::nextTextMarker): Ditto.
(WTR::AccessibilityUIElement::textMarkerRangeForMarkers): Ditto.
(WTR::AccessibilityUIElement::selectedTextMarkerRange): Ditto.
(WTR::AccessibilityUIElement::startTextMarkerForTextMarkerRange): Ditto.
(WTR::AccessibilityUIElement::endTextMarkerForTextMarkerRange): Ditto.
(WTR::AccessibilityUIElement::endTextMarkerForBounds): Ditto.
(WTR::AccessibilityUIElement::startTextMarkerForBounds): Ditto.
(WTR::AccessibilityUIElement::textMarkerForPoint): Ditto.
(WTR::AccessibilityUIElement::textMarkerForIndex): Ditto.
(WTR::AccessibilityUIElement::startTextMarker): Ditto.
(WTR::AccessibilityUIElement::endTextMarker): Ditto.
(WTR::AccessibilityUIElement::leftWordTextMarkerRangeForTextMarker): Ditto.
(WTR::AccessibilityUIElement::rightWordTextMarkerRangeForTextMarker): Ditto.
(WTR::AccessibilityUIElement::previousWordStartTextMarkerForTextMarker): Ditto.
(WTR::AccessibilityUIElement::nextWordEndTextMarkerForTextMarker): Ditto.
(WTR::AccessibilityUIElement::paragraphTextMarkerRangeForTextMarker): Ditto.
(WTR::AccessibilityUIElement::previousParagraphStartTextMarkerForTextMarker): Ditto.
(WTR::AccessibilityUIElement::nextParagraphEndTextMarkerForTextMarker): Ditto.
(WTR::AccessibilityUIElement::sentenceTextMarkerRangeForTextMarker): Ditto.
(WTR::AccessibilityUIElement::previousSentenceStartTextMarkerForTextMarker): Ditto.
(WTR::AccessibilityUIElement::nextSentenceEndTextMarkerForTextMarker): Ditto.

* WebKitTestRunner/PlatformMac.cmake: Added WebKitTestRunnerWindow.h and .mm files.
* WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: Ditto.

* WebKitTestRunner/mac/EventSenderProxy.mm: Add include of WebKitTestRunnerWindow.h
so we can use the type and know it inherits from NSWindow.

* WebKitTestRunner/mac/PlatformWebViewMac.mm: Add include of WebKitTestRunnerWindow.h
so we can use the type and know it inherits from NSWindow. Moved WebKitTestRunnerWindow
class into a separate file.
(WTR::PlatformWebView::keyWindow): Call +[WebKitTestRunnerWindow _WTR_keyWindow]
instead of have a second copy of the implementation.

* WebKitTestRunner/mac/WebKitTestRunnerEvent.mm: Add include of WebKitTestRunnerWindow.h
so we can use the type and know it inherits from NSWindow. Also removed "using namespace".
(+[WebKitTestRunnerEvent mouseLocation]): Updated for above.

* WebKitTestRunner/mac/WebKitTestRunnerPasteboard.mm:
(+[LocalPasteboard alloc]): Use class_createInstance instead of NSAllocateObject.
(-[LocalPasteboard availableTypeFromArray:]): Use modern for loop.
(-[LocalPasteboard setData:forType:]): Reordered method to be a tiny bit more efficient.
(-[LocalPasteboard setPropertyList:forType:]): Use NSPropertyListSerialization
instead of CFPropertyList.
(-[LocalPasteboard setString:forType:]): Use NSString method instead of
CFStringCreateExternalRepresentation.

* WebKitTestRunner/mac/WebKitTestRunnerWindow.h: Moved declaration of
WebKitTestRunnerWindow here so it can be included by files that need to know
what the type is and that it inherits from NSWindow.

* WebKitTestRunner/mac/WebKitTestRunnerWindow.mm: Added. Moved implementation here.
(+[WebKitTestRunnerWindow _WTR_keyWindow]): Use modern for loop instead of the old,
messier implementation.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@234685 268f45cc-cd09-0410-ab3c-d52691b4dbfc

82 files changed:
Source/JavaScriptCore/API/JSValue.mm
Source/JavaScriptCore/API/JSWrapperMap.mm
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/heap/Heap.cpp
Source/WTF/ChangeLog
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/BlockPtr.h
Source/WTF/wtf/HashFunctions.h
Source/WTF/wtf/HashTraits.h
Source/WTF/wtf/PlatformMac.cmake
Source/WTF/wtf/WeakObjCPtr.h
Source/WTF/wtf/cocoa/AutodrainedPool.cpp
Source/WTF/wtf/spi/cocoa/objcSPI.h [moved from Source/WTF/wtf/spi/cocoa/FoundationSPI.h with 90% similarity]
Source/WebCore/ChangeLog
Source/WebCore/bridge/objc/objc_instance.mm
Source/WebCore/platform/ios/wak/WebCoreThread.mm
Source/WebKit/ChangeLog
Source/WebKit/Platform/cocoa/WKCrashReporter.mm
Source/WebKit/Shared/mac/PasteboardTypes.mm
Source/WebKit/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm
Source/WebKitLegacy/mac/Carbon/CarbonUtils.m
Source/WebKitLegacy/mac/Carbon/CarbonWindowFrame.m
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/DOM/DOM.mm
Source/WebKitLegacy/mac/DOM/DOMXPath.mm
Source/WebKitLegacy/mac/History/WebHistory.mm
Source/WebKitLegacy/mac/Misc/WebElementDictionary.mm
Source/WebKitLegacy/mac/Misc/WebKitNSStringExtras.mm
Source/WebKitLegacy/mac/Misc/WebLocalizableStrings.mm
Source/WebKitLegacy/mac/Misc/WebNSDataExtras.mm
Source/WebKitLegacy/mac/Misc/WebNSDictionaryExtras.h
Source/WebKitLegacy/mac/Misc/WebNSDictionaryExtras.m
Source/WebKitLegacy/mac/Misc/WebStringTruncator.mm
Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginHostManager.mm
Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
Source/WebKitLegacy/mac/Plugins/Hosted/ProxyInstance.mm
Source/WebKitLegacy/mac/Plugins/WebBasePluginPackage.mm
Source/WebKitLegacy/mac/Plugins/WebNetscapePluginEventHandlerCocoa.mm
Source/WebKitLegacy/mac/Plugins/WebNetscapePluginPackage.mm
Source/WebKitLegacy/mac/Plugins/WebNetscapePluginView.mm
Source/WebKitLegacy/mac/Plugins/WebPluginController.mm
Source/WebKitLegacy/mac/Plugins/WebPluginDatabase.mm
Source/WebKitLegacy/mac/Plugins/npapi.mm
Source/WebKitLegacy/mac/Storage/WebDatabaseManager.mm
Source/WebKitLegacy/mac/WebCoreSupport/WebContextMenuClient.mm
Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm
Source/WebKitLegacy/mac/WebCoreSupport/WebFrameNetworkingContext.mm
Source/WebKitLegacy/mac/WebCoreSupport/WebSecurityOriginPrivate.h
Source/WebKitLegacy/mac/WebInspector/WebNodeHighlighter.mm
Source/WebKitLegacy/mac/WebView/WebFullScreenController.mm
Source/WebKitLegacy/mac/WebView/WebHTMLView.mm
Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm
Source/WebKitLegacy/mac/WebView/WebJSPDFDoc.mm
Source/WebKitLegacy/mac/WebView/WebPDFView.mm
Source/WebKitLegacy/mac/WebView/WebPreferences.mm
Source/WebKitLegacy/mac/WebView/WebView.mm
Source/WebKitLegacy/mac/WebView/WebViewData.mm
Source/WebKitLegacy/mac/WebView/WebViewInternal.h
Tools/ChangeLog
Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h
Tools/DumpRenderTree/TestNetscapePlugIn/PluginObjectMac.mm
Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/DumpRenderTree/mac/DumpRenderTreePasteboard.mm
Tools/DumpRenderTree/mac/MockGeolocationProvider.h
Tools/DumpRenderTree/mac/MockGeolocationProvider.mm
Tools/DumpRenderTree/mac/MockWebNotificationProvider.h
Tools/DumpRenderTree/mac/MockWebNotificationProvider.mm
Tools/DumpRenderTree/mac/ObjCPlugin.m
Tools/DumpRenderTree/mac/TestRunnerMac.mm
Tools/TestRunnerShared/cocoa/LayoutTestSpellChecker.mm
Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm
Tools/WebKitTestRunner/PlatformMac.cmake
Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm
Tools/WebKitTestRunner/mac/EventSenderProxy.mm
Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm
Tools/WebKitTestRunner/mac/WebKitTestRunnerEvent.mm
Tools/WebKitTestRunner/mac/WebKitTestRunnerPasteboard.mm
Tools/WebKitTestRunner/mac/WebKitTestRunnerWindow.h [new file with mode: 0644]
Tools/WebKitTestRunner/mac/WebKitTestRunnerWindow.mm [new file with mode: 0644]

index 543531b..417cc9d 100644 (file)
@@ -636,14 +636,14 @@ public:
 
 private:
     JSGlobalContextRef m_context;
-    HashMap<JSValueRef, id> m_objectMap;
+    HashMap<JSValueRef, __unsafe_unretained id> m_objectMap;
     Vector<Task> m_worklist;
     Vector<JSC::Strong<JSC::Unknown>> m_jsValues;
 };
 
 inline id JSContainerConvertor::convert(JSValueRef value)
 {
-    HashMap<JSValueRef, id>::iterator iter = m_objectMap.find(value);
+    auto iter = m_objectMap.find(value);
     if (iter != m_objectMap.end())
         return iter->value;
 
@@ -887,7 +887,7 @@ public:
 
 private:
     JSContext *m_context;
-    HashMap<id, JSValueRef> m_objectMap;
+    HashMap<__unsafe_unretained id, JSValueRef> m_objectMap;
     Vector<Task> m_worklist;
     Vector<JSC::Strong<JSC::Unknown>> m_jsValues;
 };
index 91a2129..d5461dd 100644 (file)
@@ -408,7 +408,7 @@ static JSC::JSObject* allocateConstructorForCustomClass(JSContext *context, cons
         return constructorWithCustomBrand(context, [NSString stringWithFormat:@"%sConstructor", className], cls);
 
     // For each protocol that the class implements, gather all of the init family methods into a hash table.
-    __block HashMap<String, Protocol *> initTable;
+    __block HashMap<String, CFTypeRef> initTable;
     Protocol *exportProtocol = getJSExportProtocol();
     for (Class currentClass = cls; currentClass; currentClass = class_getSuperclass(currentClass)) {
         forEachProtocolImplementingProtocol(currentClass, exportProtocol, ^(Protocol *protocol, bool&) {
@@ -416,7 +416,7 @@ static JSC::JSObject* allocateConstructorForCustomClass(JSContext *context, cons
                 const char* name = sel_getName(selector);
                 if (!isInitFamilyMethod(@(name)))
                     return;
-                initTable.set(name, protocol);
+                initTable.set(name, (__bridge CFTypeRef)protocol);
             });
         });
     }
@@ -436,7 +436,7 @@ static JSC::JSObject* allocateConstructorForCustomClass(JSContext *context, cons
 
             numberOfInitsFound++;
             initMethod = selector;
-            initProtocol = iter->value;
+            initProtocol = (__bridge Protocol *)iter->value;
             types = method_getTypeEncoding(method);
         });
 
@@ -565,7 +565,7 @@ typedef std::pair<JSC::JSObject*, JSC::JSObject*> ConstructorPrototypePair;
 
 @implementation JSWrapperMap {
     NSMutableDictionary *m_classMap;
-    std::unique_ptr<JSC::WeakGCMap<id, JSC::JSObject>> m_cachedJSWrappers;
+    std::unique_ptr<JSC::WeakGCMap<__unsafe_unretained id, JSC::JSObject>> m_cachedJSWrappers;
     NSMapTable *m_cachedObjCWrappers;
 }
 
@@ -579,7 +579,7 @@ typedef std::pair<JSC::JSObject*, JSC::JSObject*> ConstructorPrototypePair;
     NSPointerFunctionsOptions valueOptions = NSPointerFunctionsWeakMemory | NSPointerFunctionsObjectPersonality;
     m_cachedObjCWrappers = [[NSMapTable alloc] initWithKeyOptions:keyOptions valueOptions:valueOptions capacity:0];
 
-    m_cachedJSWrappers = std::make_unique<JSC::WeakGCMap<id, JSC::JSObject>>(toJS(context)->vm());
+    m_cachedJSWrappers = std::make_unique<JSC::WeakGCMap<__unsafe_unretained id, JSC::JSObject>>(toJS(context)->vm());
 
     ASSERT(!toJSGlobalObject(context)->wrapperMap());
     toJSGlobalObject(context)->setWrapperMap(self);
index 7d7186a..b4c8aad 100644 (file)
@@ -1,3 +1,18 @@
+2018-08-05  Darin Adler  <darin@apple.com>
+
+        [Cocoa] More tweaks and refactoring to prepare for ARC
+        https://bugs.webkit.org/show_bug.cgi?id=188245
+
+        Reviewed by Dan Bernstein.
+
+        * API/JSValue.mm: Use __unsafe_unretained.
+        (JSContainerConvertor::convert): Use auto for compatibility with the above.
+        * API/JSWrapperMap.mm:
+        (allocateConstructorForCustomClass): Use CFTypeRef instead of Protocol *.
+        (-[JSWrapperMap initWithGlobalContextRef:]): Use __unsafe_unretained.
+
+        * heap/Heap.cpp: Updated include for rename: FoundationSPI.h -> objcSPI.h.
+
 2018-08-07  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
 
         Shrink size of PropertyCondition by packing UniquedStringImpl* and Kind
index ea3a0fc..c782fcb 100644 (file)
@@ -90,7 +90,7 @@
 #endif
 
 #if USE(FOUNDATION)
-#include <wtf/spi/cocoa/FoundationSPI.h>
+#include <wtf/spi/cocoa/objcSPI.h>
 #endif
 
 #if USE(GLIB)
index e5985be..216e4ba 100644 (file)
@@ -1,3 +1,31 @@
+2018-08-05  Darin Adler  <darin@apple.com>
+
+        [Cocoa] More tweaks and refactoring to prepare for ARC
+        https://bugs.webkit.org/show_bug.cgi?id=188245
+
+        Reviewed by Dan Bernstein.
+
+        * WTF.xcodeproj/project.pbxproj: Updated for rename: FoundationSPI.h -> objcSPI.h.
+
+        * wtf/BlockPtr.h: Added missing include of "StdLibExtras.h".
+        Also re-sorted includes.
+
+        * wtf/HashFunctions.h: Add function for "__unsafe_unretained id".
+        * wtf/HashTraits.h: Add traits for "__unsafe_unretained id".
+
+        * wtf/PlatformMac.cmake: Updated for rename: FoundationSPI.h -> objcSPI.h.
+
+        * wtf/WeakObjCPtr.h: Use mutable instead of const_cast, and write a version
+        that uses __weak explicitly under ARC. Also moved function declarations from
+        here to objcSPI.h.
+
+        * wtf/cocoa/AutodrainedPool.cpp: Updated include for rename: FoundationSPI.h -> objcSPI.h.
+
+        * wtf/spi/cocoa/objcSPI.h: Renamed from FoundationSPI.h and added the
+        additional functions used by WeakObjCPtr.h. Also changed to both include the
+        internal header and the function definitions when compiling with
+        USE(APPLE_INTERNAL_SDK), helping us check that function definitions match.
+
 2018-08-07  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
 
         Shrink size of PropertyCondition by packing UniquedStringImpl* and Kind
index 2f3d53f..704338a 100644 (file)
                93934BD218A1E8C300D0D6A1 /* StringViewCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringViewCocoa.mm; sourceTree = "<group>"; };
                93934BD418A1F16900D0D6A1 /* StringViewCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringViewCF.cpp; sourceTree = "<group>"; };
                93AC91A718942FC400244939 /* LChar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LChar.h; sourceTree = "<group>"; };
-               93D191CF20CAECE800C51B8E /* FoundationSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FoundationSPI.h; sourceTree = "<group>"; };
+               93D191CF20CAECE800C51B8E /* objcSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = objcSPI.h; sourceTree = "<group>"; };
                93DDE9311CDC052D00FD3491 /* dyldSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dyldSPI.h; sourceTree = "<group>"; };
                93F1993D19D7958D00C2390B /* StringView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringView.cpp; sourceTree = "<group>"; };
                974CFC8D16A4F327006D5404 /* WeakPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakPtr.h; sourceTree = "<group>"; };
                        isa = PBXGroup;
                        children = (
                                9384B73E20DEA284005B73B2 /* CFXPCBridgeSPI.h */,
-                               93D191CF20CAECE800C51B8E /* FoundationSPI.h */,
                                CE46516D19DB1FB4003ECA05 /* NSMapTableSPI.h */,
+                               93D191CF20CAECE800C51B8E /* objcSPI.h */,
                                A5098B011C16A4F900087797 /* SecuritySPI.h */,
                        );
                        path = cocoa;
index ac3e12c..a011195 100644 (file)
 #pragma once
 
 #include <Block.h>
+#include <utility>
+#include <wtf/Assertions.h>
+#include <wtf/StdLibExtras.h>
+
 #if CPU(ARM64E)
 #include <WebKitAdditions/BlockQualifiers.h>
 #else
@@ -33,8 +37,6 @@
 #define WTF_DISPOSE_FUNCTION_POINTER_QUALIFIER
 #define WTF_INVOKE_FUNCTION_POINTER_QUALIFIER
 #endif
-#include <utility>
-#include <wtf/Assertions.h>
 
 namespace WTF {
 
index 9db913a..12b5443 100644 (file)
@@ -243,6 +243,10 @@ namespace WTF {
 
     template<typename P, typename Deleter> struct DefaultHash<std::unique_ptr<P, Deleter>> { typedef PtrHash<std::unique_ptr<P, Deleter>> Hash; };
 
+#ifdef __OBJC__
+    template<> struct DefaultHash<__unsafe_unretained id> { using Hash = PtrHash<__unsafe_unretained id>; };
+#endif
+
     // make IntPairHash the default hash function for pairs of (at most) 32-bit integers.
 
     template<> struct DefaultHash<std::pair<short, short>> { typedef IntPairHash<short, short> Hash; };
index bcd8d7b..ebf3905 100644 (file)
 #include <wtf/Optional.h>
 #include <wtf/StdLibExtras.h>
 
+#ifdef __OBJC__
+#include <CoreFoundation/CoreFoundation.h>
+#endif
+
 namespace WTF {
 
 template<bool isInteger, typename T> struct GenericHashTraitsBase;
@@ -115,6 +119,16 @@ template<typename P> struct HashTraits<P*> : GenericHashTraits<P*> {
     static bool isDeletedValue(P* value) { return value == reinterpret_cast<P*>(-1); }
 };
 
+#ifdef __OBJC__
+
+template<> struct HashTraits<__unsafe_unretained id> : GenericHashTraits<__unsafe_unretained id> {
+    static const bool emptyValueIsZero = true;
+    static void constructDeletedValue(__unsafe_unretained id& slot) { slot = (__bridge __unsafe_unretained id)reinterpret_cast<CFTypeRef>(-1); }
+    static bool isDeletedValue(__unsafe_unretained id value) { return (__bridge CFTypeRef)value == reinterpret_cast<CFTypeRef>(-1); }
+};
+
+#endif
+
 template<typename T> struct SimpleClassHashTraits : GenericHashTraits<T> {
     static const bool emptyValueIsZero = true;
     static void constructDeletedValue(T& slot) { new (NotNull, std::addressof(slot)) T(HashTableDeletedValue); }
index f9b1144..7837236 100644 (file)
@@ -21,9 +21,9 @@ list(APPEND WTF_PUBLIC_HEADERS
     spi/cf/CFBundleSPI.h
     spi/cf/CFStringSPI.h
 
-    spi/cocoa/FoundationSPI.h
     spi/cocoa/NSMapTableSPI.h
     spi/cocoa/SecuritySPI.h
+    spi/cocoa/objcSPI.h
 
     spi/darwin/SandboxSPI.h
     spi/darwin/XPCSPI.h
index f910830..0e7a4ec 100644 (file)
 #include <objc/runtime.h>
 #include <type_traits>
 #include <wtf/RetainPtr.h>
-
-#if __has_include(<objc/objc-internal.h>)
-#include <objc/objc-internal.h>
-#else
-extern "C" {
-id objc_loadWeakRetained(id*);
-id objc_initWeak(id*, id);
-void objc_destroyWeak(id*);
-void objc_copyWeak(id*, id*);
-void objc_moveWeak(id*, id*);
-}
-#endif
+#include <wtf/spi/cocoa/objcSPI.h>
 
 namespace WTF {
 
 template<typename T> class WeakObjCPtr {
 public:
-    typedef typename std::remove_pointer<T>::type ValueType;
+    using ValueType = typename std::remove_pointer<T>::type;
 
-    WeakObjCPtr()
-        : m_weakReference(nullptr)
-    {
-    }
+    WeakObjCPtr() = default;
 
     WeakObjCPtr(ValueType *ptr)
+#if __has_feature(objc_arc)
+        : m_weakReference(ptr)
+#endif
     {
+#if !__has_feature(objc_arc)
         objc_initWeak(&m_weakReference, ptr);
+#endif
     }
 
+#if !__has_feature(objc_arc)
     WeakObjCPtr(const WeakObjCPtr& other)
     {
-        objc_copyWeak(&m_weakReference, const_cast<id*>(&other.m_weakReference));
+        objc_copyWeak(&m_weakReference, &other.m_weakReference);
     }
 
     WeakObjCPtr(WeakObjCPtr&& other)
@@ -71,10 +63,15 @@ public:
     {
         objc_destroyWeak(&m_weakReference);
     }
+#endif
 
     WeakObjCPtr& operator=(ValueType *ptr)
     {
+#if __has_feature(objc_arc)
+        m_weakReference = ptr;
+#else
         objc_storeWeak(&m_weakReference, ptr);
+#endif
 
         return *this;
     }
@@ -86,18 +83,31 @@ public:
 
     RetainPtr<ValueType> get() const
     {
-        return adoptNS(objc_loadWeakRetained(const_cast<id*>(&m_weakReference)));
+#if __has_feature(objc_arc)
+        return static_cast<ValueType *>(m_weakReference);
+#else
+        return adoptNS(objc_loadWeakRetained(&m_weakReference));
+#endif
     }
 
     ValueType *getAutoreleased() const
     {
-        return static_cast<ValueType *>(objc_loadWeak(const_cast<id*>(&m_weakReference)));
+#if __has_feature(objc_arc)
+        return static_cast<ValueType *>(m_weakReference);
+#else
+        return static_cast<ValueType *>(objc_loadWeak(&m_weakReference));
+#endif
+
     }
 
     explicit operator ValueType *() const { return getAutoreleased(); }
 
 private:
-    id m_weakReference;
+#if __has_feature(objc_arc)
+    mutable __weak id m_weakReference { nullptr };
+#else
+    mutable id m_weakReference { nullptr };
+#endif
 };
 
 } // namespace WTF
index b0d7c82..6c781a1 100644 (file)
@@ -29,7 +29,7 @@
 #import "config.h"
 #import "AutodrainedPool.h"
 
-#import <wtf/spi/cocoa/FoundationSPI.h>
+#import <wtf/spi/cocoa/objcSPI.h>
 
 namespace WTF {
 
similarity index 90%
rename from Source/WTF/wtf/spi/cocoa/FoundationSPI.h
rename to Source/WTF/wtf/spi/cocoa/objcSPI.h
index 2691044..a9e89de 100644 (file)
 
 #include <objc/objc-internal.h>
 
-#else
+#endif
 
 WTF_EXTERN_C_BEGIN
 
 void* objc_autoreleasePoolPush(void);
 void objc_autoreleasePoolPop(void* context);
 
-WTF_EXTERN_C_END
-
+#ifdef __OBJC__
+id objc_loadWeakRetained(id*);
+id objc_initWeak(id*, id);
+void objc_destroyWeak(id*);
+void objc_copyWeak(id*, id*);
+void objc_moveWeak(id*, id*);
 #endif
+
+WTF_EXTERN_C_END
index b7f9358..d14f331 100644 (file)
@@ -1,3 +1,13 @@
+2018-08-05  Darin Adler  <darin@apple.com>
+
+        [Cocoa] More tweaks and refactoring to prepare for ARC
+        https://bugs.webkit.org/show_bug.cgi?id=188245
+
+        Reviewed by Dan Bernstein.
+
+        * bridge/objc/objc_instance.mm: Updated include for rename: FoundationSPI.h -> objcSPI.h.
+        * platform/ios/wak/WebCoreThread.mm: Ditto.
+
 2018-08-07  Chris Dumez  <cdumez@apple.com>
 
         navigator.sendBeacon does not work in pagehide callbacks
index e8b78eb..b81068a 100644 (file)
@@ -40,7 +40,7 @@
 #import <wtf/MainThread.h>
 #import <wtf/NeverDestroyed.h>
 #import <wtf/ThreadSpecific.h>
-#import <wtf/spi/cocoa/FoundationSPI.h>
+#import <wtf/spi/cocoa/objcSPI.h>
 
 #ifdef NDEBUG
 #define OBJC_LOG(formatAndArgs...) ((void)0)
index 43bb32a..1faf8d5 100644 (file)
@@ -48,7 +48,7 @@
 #import <wtf/RecursiveLockAdapter.h>
 #import <wtf/RunLoop.h>
 #import <wtf/Threading.h>
-#import <wtf/spi/cocoa/FoundationSPI.h>
+#import <wtf/spi/cocoa/objcSPI.h>
 #import <wtf/text/AtomicString.h>
 
 #define LOG_MESSAGES 0
index 01513c3..a8463f5 100644 (file)
@@ -1,3 +1,26 @@
+2018-08-05  Darin Adler  <darin@apple.com>
+
+        [Cocoa] More tweaks and refactoring to prepare for ARC
+        https://bugs.webkit.org/show_bug.cgi?id=188245
+
+        Reviewed by Dan Bernstein.
+
+        * Platform/cocoa/WKCrashReporter.mm:
+        (WebKit::setCrashLogMessage): Refactor into a separate function for clarity.
+        (WebKit::setCrashReportApplicationSpecificInformation): Use a bridging cast.
+
+        * Shared/mac/PasteboardTypes.mm:
+        (WebKit::PasteboardTypes::forEditing): Use a bridging cast.
+
+        * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+        (WebKit::convertToNPNNString): Added. Uses CFStringRef rather than NSString so we can
+        manually manage the autoreleasing.
+        (WebKit::initializeKeyboardEvent): Use convertToNPNNString.
+        (WebKit::NetscapePlugin::sendComplexTextInput): Ditto.
+
+        * WebProcess/Plugins/PDF/PDFPlugin.mm: Use __unsafe_unretained explicitly
+        for a parent pointer. We could consider moving to __weak after switching to ARC.
+
 2018-08-07  Ben Richards  <benton_richards@apple.com>
 
         Add SPI for launching WebContent process with pre-linked injected bundle
index a4e6dee..923d3ba 100644 (file)
@@ -26,6 +26,7 @@
 #import "config.h"
 #import "WKCrashReporter.h"
 
+#import <cstdlib>
 #import "CrashReporterClientSPI.h"
 
 // Avoid having to link with libCrashReporterClient.a
@@ -36,19 +37,21 @@ __attribute__((section("__DATA," CRASHREPORTER_ANNOTATIONS_SECTION)))
 
 namespace WebKit {
 
-void setCrashReportApplicationSpecificInformation(CFStringRef infoString)
+static void setCrashLogMessage(const char* message)
 {
-    if (char* oldMessage = const_cast<char*>(CRGetCrashLogMessage()))
-        free(oldMessage);
+    // We have to copy the string because CRSetCrashLogMessage doesn't.
+    char* copiedMessage = message ? strdup(message) : nullptr;
+
+    CRSetCrashLogMessage(copiedMessage);
 
-    if (!infoString) {
-        CRSetCrashLogMessage(nullptr);
-        return;
-    }
+    // Delete the message from last time, so we don't keep leaking messages.
+    static char* previousCopiedCrashLogMessage;
+    std::free(std::exchange(previousCopiedCrashLogMessage, copiedMessage));
+}
 
-    // We have to copy the string, because CRSetCrashLogMessage doesn't copy the data.
-    char* lastInfoChars = strdup([(NSString *)infoString UTF8String]);
-    CRSetCrashLogMessage(lastInfoChars);
+void setCrashReportApplicationSpecificInformation(CFStringRef infoString)
+{
+    setCrashLogMessage([(__bridge NSString *)infoString UTF8String]);
 }
 
 }
index d47b12d..712f9d7 100644 (file)
@@ -47,7 +47,7 @@ static inline NSArray *retain(NSArray *array)
 NSArray* PasteboardTypes::forEditing()
 {
     static NSArray *types = retain([NSArray arrayWithObjects:WebArchivePboardType, WebCore::legacyHTMLPasteboardType(), WebCore::legacyFilenamesPasteboardType(), WebCore::legacyTIFFPasteboardType(), WebCore::legacyPDFPasteboardType(),
-        WebCore::legacyURLPasteboardType(), WebCore::legacyRTFDPasteboardType(), WebCore::legacyRTFPasteboardType(), WebCore::legacyStringPasteboardType(), WebCore::legacyColorPasteboardType(), kUTTypePNG, nil]);
+        WebCore::legacyURLPasteboardType(), WebCore::legacyRTFDPasteboardType(), WebCore::legacyRTFPasteboardType(), WebCore::legacyStringPasteboardType(), WebCore::legacyColorPasteboardType(), (__bridge NSString *)kUTTypePNG, nil]);
     return types;
 }
 
index 8bbed6b..55590c1 100644 (file)
@@ -741,6 +741,12 @@ static bool isFlagsChangedEvent(const WebKeyboardEvent& keyboardEvent)
     return false;
 }
 
+static NPNSString *convertToNPNNString(const String& string)
+{
+    CFTypeRef releasedString = string.createCFString().autorelease();
+    return static_cast<NPNSString*>(const_cast<void*>(releasedString));
+}
+
 static NPCocoaEvent initializeKeyboardEvent(const WebKeyboardEvent& keyboardEvent)
 {
     NPCocoaEventType eventType;
@@ -763,8 +769,8 @@ static NPCocoaEvent initializeKeyboardEvent(const WebKeyboardEvent& keyboardEven
 
     NPCocoaEvent event = initializeEvent(eventType);
     event.data.key.modifierFlags = modifierFlags(keyboardEvent);
-    event.data.key.characters = reinterpret_cast<NPNSString*>(static_cast<NSString*>(keyboardEvent.text()));
-    event.data.key.charactersIgnoringModifiers = reinterpret_cast<NPNSString*>(static_cast<NSString*>(keyboardEvent.unmodifiedText()));
+    event.data.key.characters = convertToNPNNString(keyboardEvent.text());
+    event.data.key.charactersIgnoringModifiers = convertToNPNNString(keyboardEvent.unmodifiedText());
     event.data.key.isARepeat = keyboardEvent.isAutoRepeat();
     event.data.key.keyCode = keyboardEvent.nativeVirtualKeyCode();
 
@@ -1020,7 +1026,7 @@ void NetscapePlugin::sendComplexTextInput(const String& textInput)
     switch (m_eventModel) {
     case NPEventModelCocoa: {
         NPCocoaEvent event = initializeEvent(NPCocoaEventTextInput);
-        event.data.text.text = reinterpret_cast<NPNSString*>(static_cast<NSString*>(textInput));
+        event.data.text.text = convertToNPNNString(textInput);
         NPP_HandleEvent(&event);
         break;
     }
index 3c895bc..a2eb402 100644 (file)
@@ -127,7 +127,7 @@ static const int defaultScrollMagnitudeThresholdForPageFlip = 20;
 
 @interface WKPDFPluginAccessibilityObject : NSObject {
     PDFLayerController *_pdfLayerController;
-    NSObject *_parent;
+    __unsafe_unretained NSObject *_parent;
     WebKit::PDFPlugin* _pdfPlugin;
 }
 
index ff14b3c..b795e9b 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef __LP64__
 
 #include "CarbonUtils.h"
-#import <wtf/spi/cocoa/FoundationSPI.h>
+#import <wtf/spi/cocoa/objcSPI.h>
 
 extern CGImageRef _NSCreateImageRef( unsigned char *const bitmapData[5], int pixelsWide, int pixelsHigh, int bitsPerSample, int samplesPerPixel, int bitsPerPixel, int bytesPerRow, BOOL isPlanar, BOOL hasAlpha, NSString *colorSpaceName, CGColorSpaceRef customColorSpace, id sourceObj);
 
index ac2a5f7..e926eb6 100644 (file)
 }
 
 
-// Deallocate.
-- (void)dealloc {
-
-    // Simple.
-    [super dealloc];
-    
-}
-
-
 // Sink a method invocation.
 - (void)_setFrameNeedsDisplay:(BOOL)needsDisplay {
     
index f0cb43b..4bb35a6 100644 (file)
@@ -1,3 +1,156 @@
+2018-08-05  Darin Adler  <darin@apple.com>
+
+        [Cocoa] More tweaks and refactoring to prepare for ARC
+        https://bugs.webkit.org/show_bug.cgi?id=188245
+
+        Reviewed by Dan Bernstein.
+
+        * Carbon/CarbonUtils.m: Updated include for rename: FoundationSPI.h -> objcSPI.h.
+
+        * Carbon/CarbonWindowFrame.m:
+        (-[CarbonWindowFrame dealloc]): Deleted. It was empty.
+
+        * DOM/DOM.mm:
+        (-[DOMElement _imageTIFFRepresentation]): Use a bridging cast.
+        (-[DOMNodeFilter finalize]): Deleted. WebKit no longer supports Objective-C
+        garbage collection so this method isn't useful.
+
+        * DOM/DOMXPath.mm:
+        (-[DOMNativeXPathNSResolver finalize]): Deleted. WebKit no longer supports
+        Objective-C garbage collection so this method isn't useful.
+
+        * History/WebHistory.mm:
+        (-[WebHistoryPrivate data]): Allocate an NSData instead of casting from a CFData.
+
+        * Misc/WebElementDictionary.mm:
+        (addLookupKey): Use a bridging cast.
+        (cacheValueForKey): Ditto.
+        (-[WebElementDictionary _fillCache]): Ditto.
+        (-[WebElementDictionary objectForKey:]): Ditto.
+
+        * Misc/WebKitNSStringExtras.mm:
+        (-[NSString _web_drawAtPoint:font:textColor:]): Use a bridging cast.
+        (-[NSString _web_widthWithFont:]): Ditto.
+        (-[NSString _webkit_stringByTrimmingWhitespace]): Ditto.
+
+        * Misc/WebLocalizableStrings.mm:
+        (WebLocalizedString): Use a bridging cast.
+
+        * Misc/WebNSDataExtras.mm:
+        (-[NSString _web_capitalizeRFC822HeaderFieldName]): Use a bridging cast
+        and use CFBridgingRelease instead of calling autorelease directly.
+        (-[NSData _webkit_parseRFC822HeaderFields]): Use NSString methods instead
+        of a mix of CFString and NSString. Also simplified logic a bit, and cut down
+        on the amount of explicit release and autorelease.
+
+        * Misc/WebNSDictionaryExtras.h: Deleted unused methods.
+        * Misc/WebNSDictionaryExtras.m:
+        (-[NSDictionary _webkit_intForKey:]): Deleted.
+        (-[NSMutableDictionary _webkit_setInt:forKey:]): Deleted.
+        (-[NSMutableDictionary _webkit_setFloat:forKey:]): Deleted.
+        (-[NSMutableDictionary _webkit_setBool:forKey:]): Deleted.
+        (-[NSMutableDictionary _webkit_setLongLong:forKey:]): Deleted.
+        (-[NSMutableDictionary _webkit_setUnsignedLongLong:forKey:]): Deleted.
+        (-[NSMutableDictionary _webkit_setUnsignedInt:forKey:]): Deleted.
+
+        * Misc/WebStringTruncator.mm:
+        (fontFromNSFont): Use a bridging cast.
+
+        * Plugins/Hosted/NetscapePluginHostManager.mm:
+        (WebKit::preferredBundleLocalizationName): Use a bridging cast and CFBridgingRelease.
+
+        * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+        (WebKit::NetscapePluginInstanceProxy::cleanup): Use a bridging cast.
+        (WebKit::NetscapePluginInstanceProxy::status): Ditto.
+        (WebKit::NetscapePluginInstanceProxy::loadURL): Ditto.
+        (WebKit::NetscapePluginInstanceProxy::demarshalValueFromArray): Ditto.
+        * Plugins/Hosted/ProxyInstance.mm:
+        (WebKit::ProxyInstance::getPropertyNames): Ditto.
+        * Plugins/WebBasePluginPackage.mm:
+        (-[WebBasePluginPackage _objectForInfoDictionaryKey:]): Ditto.
+        * Plugins/WebNetscapePluginEventHandlerCocoa.mm:
+        (WebNetscapePluginEventHandlerCocoa::platformWindow): Ditto.
+        * Plugins/WebNetscapePluginPackage.mm:
+        (-[WebNetscapePluginPackage _initWithPath:]): Ditto.
+
+        * Plugins/WebNetscapePluginView.mm:
+        (-[WebNetscapePluginView _postURL:target:len:buf:file:notifyData:sendNotification:allowHeaders:]):
+        Use bridging casts and use RetainPtr insteead of an explicit CFRelease.
+        (-[WebNetscapePluginView status:]): Use a bridging cast.
+        (-[WebNetscapePluginView popUpContextMenu:]): Ditto.
+
+        * Plugins/WebPluginController.mm:
+        (-[WebPluginController _cancelOutstandingChecks]): Use a bridging cast.
+
+        * Plugins/WebPluginDatabase.mm:
+        (checkCandidate): Use explicit __strong for out argument types.
+
+        * Plugins/npapi.mm:
+        (pluginViewForInstance): Use a bridging cast.
+
+        * Storage/WebDatabaseManager.mm:
+        (-[WebDatabaseManager detailsForDatabase:withOrigin:]): Use modern boxing instead of
+        explicit NSNumber and NSDictionary calls.
+
+        * WebCoreSupport/WebContextMenuClient.mm:
+        (WebContextMenuClient::speak): Remove an unnecessary copy/autorelease pair.
+
+        * WebCoreSupport/WebEditorClient.mm:
+        (WebEditorClient::handleKeyboardEvent): Added a missing typecast.
+        (WebEditorClient::handleInputMethodKeydown): Ditto.
+
+        * WebCoreSupport/WebFrameNetworkingContext.mm:
+        (WebFrameNetworkingContext::sourceApplicationAuditData const): Use a bridging cast.
+
+        * WebCoreSupport/WebSecurityOriginPrivate.h: Forward declare WebSecurityOriginPrivate
+        as a struct rather than an Objective-C class, since that's how it's defined.
+
+        * WebInspector/WebNodeHighlighter.mm: Added missing includes.
+
+        * WebView/WebFullScreenController.mm:
+        (-[WebFullScreenController enterFullScreen:]): Use a bridging cast.
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView _writeSelectionWithPasteboardTypes:toPasteboard:cachedAttributedString:]):
+        Ditto.
+        (-[WebHTMLView pasteboard:provideDataForType:]): Ditto.
+
+        * WebView/WebImmediateActionController.mm:
+        (-[WebImmediateActionController performHitTestAtPoint:]): Removed redundant code to
+        go down to the document and then back to the frame.
+        (-[WebImmediateActionController immediateActionRecognizerDidUpdateAnimation:]): Ditto.
+        (-[WebImmediateActionController immediateActionRecognizerDidCancelAnimation:]): Ditto.
+        (-[WebImmediateActionController immediateActionRecognizerDidCompleteAnimation:]): Ditto.
+
+        * WebView/WebJSPDFDoc.mm:
+        (jsPDFDocInitialize): Removed some unneeded type casting.
+        (jsPDFDocFinalize): Ditto.
+        (jsPDFDocPrint): Use a bridging cast.
+
+        * WebView/WebPDFView.mm:
+        (_applicationInfoForMIMEType): Use bridging casts.
+
+        * WebView/WebPreferences.mm:
+        (-[WebPreferences _setIntegerValue:forKey:]): Use boxing and setObject directly
+        instead of methods from WebNSDictionaryExtras.
+        (-[WebPreferences _setUnsignedIntValue:forKey:]): Ditto.
+        (-[WebPreferences _setFloatValue:forKey:]): Ditto.
+        (-[WebPreferences _setBoolValue:forKey:]): Ditto.
+        (-[WebPreferences _setLongLongValue:forKey:]): Ditto.
+        (-[WebPreferences _setUnsignedLongLongValue:forKey:]): Ditto.
+
+        * WebView/WebView.mm:
+        (-[WebView _removeFromAllWebViewsSet]): Use bridging cast.
+        (-[WebView _addToAllWebViewsSet]): Ditto.
+        (+[WebView closeAllWebViews]): Use a modern for loop instead of NSEnumerator.
+        (-[WebView _windowVisibilityChanged:]): Moved this into the internal category
+        so it can be called from WebViewData methods.
+
+        * WebView/WebViewData.mm: Added an import so we can call an internal WebView
+        method, _windowVisibilityChanged:.
+
+        * WebView/WebViewInternal.h: Declared _windowVisibilityChanged: so it can be
+        called from WebViewData methods.
+
 2018-08-06  Alex Christensen  <achristensen@webkit.org>
 
         Use enum classes and OptionSets for PaintPhase and PaintBehavior
index 83d56d0..8ebb8a0 100644 (file)
@@ -694,7 +694,7 @@ id <DOMEventTarget> kit(EventTarget* target)
     auto* cachedImage = downcast<RenderImage>(*renderer).cachedImage();
     if (!cachedImage || cachedImage->errorOccurred())
         return nil;
-    return (NSData *)cachedImage->imageForRenderer(renderer)->tiffRepresentation();
+    return (__bridge NSData *)cachedImage->imageForRenderer(renderer)->tiffRepresentation();
 }
 
 #endif
@@ -843,13 +843,6 @@ WebCore::NodeFilter* core(DOMNodeFilter *wrapper)
     [super dealloc];
 }
 
-- (void)finalize
-{
-    if (_internal)
-        reinterpret_cast<WebCore::NodeFilter*>(_internal)->deref();
-    [super finalize];
-}
-
 - (short)acceptNode:(DOMNode *)node
 {
     if (!node)
index 53dc22d..cda837a 100644 (file)
     [super dealloc];
 }
 
-- (void)finalize
-{
-    if (_internal)
-        IMPL->deref();
-    [super finalize];
-}
-
 - (NSString *)lookupNamespaceURI:(NSString *)prefix
 {
     return IMPL->lookupNamespaceURI(prefix);
index 13832e1..90496bb 100644 (file)
@@ -644,10 +644,10 @@ static inline WebHistoryDateKey dateKey(NSTimeInterval date)
 - (NSData *)data
 {
     if (_entriesByDate->isEmpty()) {
-        static NSData *emptyHistoryData = (NSData *)CFDataCreate(0, 0, 0);
+        static NSData *emptyHistoryData = [[NSData alloc] init];
         return emptyHistoryData;
     }
-    
+
     // Ignores the date and item count limits; these are respected when loading instead of when saving, so
     // that clients can learn of discarded items by listening to WebHistoryItemsDiscardedWhileLoadingNotification.
     WebHistoryWriter writer(_entriesByDate.get());
index c3cb9aa..b7f7b28 100644 (file)
@@ -53,13 +53,13 @@ static CFMutableDictionaryRef lookupTable = NULL;
 
 static void addLookupKey(NSString *key, SEL selector)
 {
-    CFDictionaryAddValue(lookupTable, key, selector);
+    CFDictionaryAddValue(lookupTable, (__bridge CFStringRef)key, selector);
 }
 
 static void cacheValueForKey(const void *key, const void *value, void *self)
 {
     // calling objectForKey will cache the value in our _cache dictionary
-    [(WebElementDictionary *)self objectForKey:(NSString *)key];
+    [(__bridge WebElementDictionary *)self objectForKey:(__bridge NSString *)key];
 }
 
 @implementation WebElementDictionary
@@ -124,7 +124,7 @@ static void cacheValueForKey(const void *key, const void *value, void *self)
 
 - (void)_fillCache
 {
-    CFDictionaryApplyFunction(lookupTable, cacheValueForKey, self);
+    CFDictionaryApplyFunction(lookupTable, cacheValueForKey, (__bridge void*)self);
     _cacheComplete = YES;
 }
 
@@ -148,7 +148,7 @@ static void cacheValueForKey(const void *key, const void *value, void *self)
     if (value || _cacheComplete || [_nilValues containsObject:key])
         return value;
 
-    SEL selector = static_cast<SEL>(const_cast<void*>(CFDictionaryGetValue(lookupTable, key)));
+    SEL selector = static_cast<SEL>(const_cast<void*>(CFDictionaryGetValue(lookupTable, (__bridge CFTypeRef)key)));
     if (!selector)
         return nil;
     value = [self performSelector:selector];
index ac43661..7f99502 100644 (file)
@@ -68,7 +68,7 @@ static bool canUseFastRenderer(const UniChar* buffer, unsigned length)
     [self getCharacters:buffer.data()];
 
     if (canUseFastRenderer(buffer.data(), length)) {
-        FontCascade webCoreFont(FontPlatformData(reinterpret_cast<CTFontRef>(font), [font pointSize]));
+        FontCascade webCoreFont(FontPlatformData((__bridge CTFontRef)font, [font pointSize]));
         TextRun run(StringView(buffer.data(), length));
 
         // The following is a half-assed attempt to match AppKit's rounding rules for drawAtPoint.
@@ -111,7 +111,7 @@ static bool canUseFastRenderer(const UniChar* buffer, unsigned length)
     [self getCharacters:buffer.data()];
 
     if (canUseFastRenderer(buffer.data(), length)) {
-        FontCascade webCoreFont(FontPlatformData(reinterpret_cast<CTFontRef>(font), [font pointSize]));
+        FontCascade webCoreFont(FontPlatformData((__bridge CTFontRef)font, [font pointSize]));
         TextRun run(StringView(buffer.data(), length));
         return webCoreFont.width(run);
     }
@@ -162,7 +162,7 @@ static bool canUseFastRenderer(const UniChar* buffer, unsigned length)
 -(NSString *)_webkit_stringByTrimmingWhitespace
 {
     NSMutableString *trimmed = [[self mutableCopy] autorelease];
-    CFStringTrimWhitespace((CFMutableStringRef)trimmed);
+    CFStringTrimWhitespace((__bridge CFMutableStringRef)trimmed);
     return trimmed;
 }
 
index 2a8a837..2c480db 100644 (file)
@@ -62,7 +62,7 @@ NSString *WebLocalizedString(WebLocalizableStringsBundle *stringsBundle, const c
     }
     NSString *notFound = @"localized string not found";
     CFStringRef keyString = CFStringCreateWithCStringNoCopy(NULL, key, kCFStringEncodingUTF8, kCFAllocatorNull);
-    NSString *result = [bundle localizedStringForKey:(NSString *)keyString value:notFound table:nil];
+    NSString *result = [bundle localizedStringForKey:(__bridge NSString *)keyString value:notFound table:nil];
     CFRelease(keyString);
     ASSERT_WITH_MESSAGE(result != notFound, "could not find localizable string %s in bundle", key);
     return result;
index b01ffb7..c694e52 100644 (file)
@@ -36,7 +36,7 @@
 
 - (NSString *)_web_capitalizeRFC822HeaderFieldName
 {
-    CFStringRef name = (CFStringRef)self;
+    CFStringRef name = (__bridge CFStringRef)self;
     NSString *result = nil;
 
     CFIndex len = CFStringGetLength(name);
     }
     if (somethingChanged) {
         if (useUniCharPtr)
-            result = (NSString *)CFStringCreateWithCharactersNoCopy(NULL, uniCharPtr, len, NULL);
+            result = CFBridgingRelease(CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, uniCharPtr, len, nullptr));
         else
-            result = (NSString *)CFStringCreateWithCStringNoCopy(NULL, charPtr, kCFStringEncodingISOLatin1, NULL);
+            result = CFBridgingRelease(CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, charPtr, kCFStringEncodingISOLatin1, nullptr));
     } else
-        result = [self retain];
+        result = self;
 
-    return [result autorelease];
+    return result;
 }
 
 @end
@@ -311,44 +311,33 @@ static const UInt8 *_findEOL(const UInt8 *bytes, CFIndex len)
             }
             // Merge the continuation of the previous header
             NSString *currentValue = [headerFields objectForKey:lastKey];
-            NSString *newValue = (NSString *)CFStringCreateWithBytes(NULL, line, lineLength, kCFStringEncodingISOLatin1, FALSE);
+            NSString *newValue = [[NSString alloc] initWithBytes:line length:lineLength encoding:NSISOLatin1StringEncoding];
             ASSERT(currentValue);
             ASSERT(newValue);
-            NSString *mergedValue = [[NSString alloc] initWithFormat:@"%@%@", currentValue, newValue];
-            [headerFields setObject:(NSString *)mergedValue forKey:lastKey];
+            [headerFields setObject:[currentValue stringByAppendingString:newValue] forKey:lastKey];
             [newValue release];
-            [mergedValue release];
-            // Note: currentValue is autoreleased
         } else {
             // Brand new header
-            const UInt8 *colon;
+            const UInt8colon;
             for (colon = line; *colon != ':' && colon != eol; colon++) { }
             if (colon == eol) {
                 // malformed header; ignore it and continue
                 continue;
             }
-            lastKey = (NSString *)CFStringCreateWithBytes(NULL, line, colon - line, kCFStringEncodingISOLatin1, FALSE);
+            lastKey = [[NSString alloc] initWithBytes:line length:colon - line encoding:NSISOLatin1StringEncoding];
             [lastKey autorelease];
-            NSString *value = [lastKey _web_capitalizeRFC822HeaderFieldName];
-            lastKey = value;
+            lastKey = [lastKey _web_capitalizeRFC822HeaderFieldName];
             for (colon++; colon != eol; colon++) {
                 if (*colon != ' ' && *colon != '\t')
                     break;
             }
-            if (colon == eol) {
-                value = [[NSString alloc] initWithString:@""];
-                [value autorelease];
-            } else {
-                value = (NSString *)CFStringCreateWithBytes(NULL, colon, eol-colon, kCFStringEncodingISOLatin1, FALSE);
+            NSString *value = [[NSString alloc] initWithBytes:colon length:eol - colon encoding:NSISOLatin1StringEncoding];
+            if (NSString *oldValue = [headerFields objectForKey:lastKey]) {
                 [value autorelease];
+                value = [[NSString alloc] initWithFormat:@"%@, %@", oldValue, value];
             }
-            NSString *oldValue = [headerFields objectForKey:lastKey];
-            if (oldValue) {
-                NSString *newValue = [[NSString alloc] initWithFormat:@"%@, %@", oldValue, value];
-                value = newValue;
-                [newValue autorelease];
-            }
-            [headerFields setObject:(NSString *)value forKey:lastKey];
+            [headerFields setObject:value forKey:lastKey];
+            [value release];
         }
     }
 
index 0573202..b4a4cec 100644 (file)
 #import <Foundation/Foundation.h>
 
 @interface NSDictionary (WebNSDictionaryExtras)
+
 - (BOOL)_webkit_boolForKey:(id)key;
-- (int)_webkit_intForKey:(id)key;
 - (NSString *)_webkit_stringForKey:(id)key; // Returns nil if the value is not an NSString.
 - (NSArray *)_webkit_arrayForKey:(id)key; // Returns nil if the value is not an NSArray.
 
 // Searches for the full MIME type, then the prefix (e.g., "text/" for "text/html")
 - (id)_webkit_objectForMIMEType:(NSString *)MIMEType;
-@end
 
-@interface NSMutableDictionary (WebNSDictionaryExtras)
-- (void)_webkit_setInt:(int)value forKey:(id)key;
-- (void)_webkit_setFloat:(float)value forKey:(id)key;
-- (void)_webkit_setBool:(BOOL)value forKey:(id)key;
-- (void)_webkit_setLongLong:(long long)value forKey:(id)key;
-- (void)_webkit_setUnsignedLongLong:(unsigned long long)value forKey:(id)key;
-- (void)_webkit_setUnsignedInt:(unsigned)value forKey:(id)key;
 @end
index f1a1b03..d8b6900 100644 (file)
 #import <wtf/Assertions.h>
 
 @implementation NSDictionary (WebNSDictionaryExtras)
+
 -(NSNumber *)_webkit_numberForKey:(id)key
 {
     id object = [self objectForKey:key];
     return [object isKindOfClass:[NSNumber class]] ? object : nil;
 }
 
--(int)_webkit_intForKey:(NSString *)key
-{
-    NSNumber *number = [self _webkit_numberForKey:key];
-    return number == nil ? 0 : [number intValue];
-}
-
 -(NSString *)_webkit_stringForKey:(id)key
 {
     id object = [self objectForKey:key];
 }
 
 @end
-
-@implementation NSMutableDictionary (WebNSDictionaryExtras)
-
--(void)_webkit_setInt:(int)value forKey:(id)key
-{
-    NSNumber *object = [[NSNumber alloc] initWithInt:value];
-    [self setObject:object forKey:key];
-    [object release];
-}
-
--(void)_webkit_setFloat:(float)value forKey:(id)key
-{
-    NSNumber *object = [[NSNumber alloc] initWithFloat:value];
-    [self setObject:object forKey:key];
-    [object release];
-}
-
--(void)_webkit_setBool:(BOOL)value forKey:(id)key
-{
-    NSNumber *object = [[NSNumber alloc] initWithBool:value];
-    [self setObject:object forKey:key];
-    [object release];
-}
-
-- (void)_webkit_setLongLong:(long long)value forKey:(id)key
-{
-    NSNumber *object = [[NSNumber alloc] initWithLongLong:value];
-    [self setObject:object forKey:key];
-    [object release];
-}
-
-- (void)_webkit_setUnsignedLongLong:(unsigned long long)value forKey:(id)key
-{
-    NSNumber *object = [[NSNumber alloc] initWithUnsignedLongLong:value];
-    [self setObject:object forKey:key];
-    [object release];
-}
-
-- (void)_webkit_setUnsignedInt:(unsigned)value forKey:(id)key
-{
-    NSNumber *object = [[NSNumber alloc] initWithUnsignedInt:value];
-    [self setObject:object forKey:key];
-    [object release];
-}
-
-@end
-
index 1baef38..2685579 100644 (file)
@@ -42,7 +42,7 @@ static WebCore::FontCascade& fontFromNSFont(NSFont *font)
     if ([font isEqual:currentNSFont.get().get()])
         return currentFont;
     currentNSFont.get() = font;
-    currentFont.get() = WebCore::FontCascade(WebCore::FontPlatformData(reinterpret_cast<CTFontRef>(font), [font pointSize]));
+    currentFont.get() = WebCore::FontCascade(WebCore::FontPlatformData((__bridge CTFontRef)font, [font pointSize]));
     return currentFont;
 }
 
index 703c546..0210b06 100644 (file)
@@ -117,11 +117,11 @@ static NSString *preferredBundleLocalizationName()
     LangCode languageCode;
     RegionCode regionCode;
 
-    Boolean success = CFLocaleGetLanguageRegionEncodingForLocaleIdentifier((CFStringRef)language, &languageCode, &regionCode, nullptr, nullptr);
+    Boolean success = CFLocaleGetLanguageRegionEncodingForLocaleIdentifier((__bridge CFStringRef)language, &languageCode, &regionCode, nullptr, nullptr);
     if (!success)
         return @"en_US";
 
-    return adoptCF(CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes(0, languageCode, regionCode)).bridgingAutorelease();
+    return CFBridgingRelease(CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes(0, languageCode, regionCode));
 }
 
 bool NetscapePluginHostManager::spawnPluginHost(const String& pluginPath, cpu_type_t pluginArchitecture, mach_port_t clientPort, mach_port_t& pluginHostPort, ProcessSerialNumber& pluginHostPSN)
index 1c8d532..e93fb50 100644 (file)
@@ -307,7 +307,7 @@ void NetscapePluginInstanceProxy::cleanup()
     m_localObjects.clear();
     
     if (Frame* frame = core([m_pluginView webFrame]))
-        frame->script().cleanupScriptObjectsForPlugin(m_pluginView);
+        frame->script().cleanupScriptObjectsForPlugin((__bridge void*)m_pluginView);
     
     ProxyInstanceSet instances;
     instances.swap(m_instances);
@@ -551,7 +551,7 @@ void NetscapePluginInstanceProxy::status(const char* message)
         return;
 
     WebView *wv = [m_pluginView webView];
-    [[wv _UIDelegateForwarder] webView:wv setStatusText:(NSString *)status.get()];
+    [[wv _UIDelegateForwarder] webView:wv setStatusText:(__bridge NSString *)status.get()];
 }
 
 NPError NetscapePluginInstanceProxy::loadURL(const char* url, const char* target, const char* postData, uint32_t postLen, LoadURLFlags flags, uint32_t& streamID)
@@ -572,12 +572,12 @@ NPError NetscapePluginInstanceProxy::loadURL(const char* url, const char* target
             if (!bufString)
                 return NPERR_INVALID_PARAM;
             
-            NSURL *fileURL = [NSURL _web_URLWithDataAsString:(NSString *)bufString.get()];
+            NSURL *fileURL = [NSURL _web_URLWithDataAsString:(__bridge NSString *)bufString.get()];
             NSString *path;
             if ([fileURL isFileURL])
                 path = [fileURL path];
             else
-                path = (NSString *)bufString.get();
+                path = (__bridge NSString *)bufString.get();
             httpBody = [NSData dataWithContentsOfFile:path];
             if (!httpBody)
                 return NPERR_FILE_NOT_FOUND;
@@ -1415,7 +1415,7 @@ bool NetscapePluginInstanceProxy::demarshalValueFromArray(ExecState* exec, NSArr
             if (!frame->script().canExecuteScripts(NotAboutToExecuteScript))
                 return false;
 
-            auto rootObject = frame->script().createRootObject(m_pluginView);
+            auto rootObject = frame->script().createRootObject((__bridge void*)m_pluginView);
             result = ProxyInstance::create(WTFMove(rootObject), this, objectID)->createRuntimeObject(exec);
             return true;
         }
index 0d326c2..fe50886 100644 (file)
@@ -317,7 +317,7 @@ void ProxyInstance::getPropertyNames(ExecState* exec, PropertyNameArray& nameArr
     if (!reply || !reply->m_returnValue)
         return;
     
-    NSArray *array = [NSPropertyListSerialization propertyListWithData:(NSData *)reply->m_result.get() options:NSPropertyListImmutable format:nullptr error:nullptr];
+    NSArray *array = [NSPropertyListSerialization propertyListWithData:(__bridge NSData *)reply->m_result.get() options:NSPropertyListImmutable format:nullptr error:nullptr];
     
     for (NSNumber *number in array) {
         IdentifierRep* identifier = reinterpret_cast<IdentifierRep*>([number longLongValue]);
index 93ecb29..dd11355 100644 (file)
@@ -131,7 +131,7 @@ using namespace WebCore;
     if (!bundleInfoDictionary)
         return nil;
 
-    return (id)CFDictionaryGetValue(bundleInfoDictionary, key);
+    return (__bridge id)CFDictionaryGetValue(bundleInfoDictionary, (__bridge CFStringRef)key);
 }
 
 - (BOOL)getPluginInfoFromPLists
index f575893..d58181a 100644 (file)
@@ -210,9 +210,9 @@ void WebNetscapePluginEventHandlerCocoa::focusChanged(bool hasFocus)
         removeKeyEventHandler();
 }
 
-void* WebNetscapePluginEventHandlerCocoa::platformWindow(NSWindowwindow)
+void* WebNetscapePluginEventHandlerCocoa::platformWindow(NSWindow *window)
 {
-    return window;
+    return (__bridge void*)window;
 }
 
 bool WebNetscapePluginEventHandlerCocoa::sendEvent(NPCocoaEvent* event)
index f6213f3..f228934 100644 (file)
@@ -76,11 +76,10 @@ using namespace WebCore;
         return NO;
 
 #if USE(PLUGIN_HOST_PROCESS)
-    RetainPtr<CFArrayRef> archs = adoptCF(CFBundleCopyExecutableArchitectures(cfBundle.get()));
-
-    if ([(NSArray *)archs.get() containsObject:[NSNumber numberWithInteger:NSBundleExecutableArchitectureX86_64]])
+    auto archs = adoptCF(CFBundleCopyExecutableArchitectures(cfBundle.get()));
+    if ([(__bridge NSArray *)archs.get() containsObject:@(NSBundleExecutableArchitectureX86_64)])
         pluginHostArchitecture = CPU_TYPE_X86_64;
-    else if ([(NSArray *)archs.get() containsObject:[NSNumber numberWithInteger:NSBundleExecutableArchitectureI386]])
+    else if ([(__bridge NSArray *)archs.get() containsObject:@(NSBundleExecutableArchitectureI386)])
         pluginHostArchitecture = CPU_TYPE_X86;
     else
         return NO;
@@ -94,7 +93,6 @@ using namespace WebCore;
 
      if (![self isNativeLibraryData:data])
          return NO;
-
 #endif
 
     if (![self getPluginInfoFromPLists])
@@ -120,6 +118,7 @@ using namespace WebCore;
 }
 
 #if USE(PLUGIN_HOST_PROCESS)
+
 - (cpu_type_t)pluginHostArchitecture
 {
     return pluginHostArchitecture;
index b2b11d3..49dc1c5 100644 (file)
@@ -1724,19 +1724,18 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
 
     if (file) {
         // If we're posting a file, buf is either a file URL or a path to the file.
-        NSString *bufString = (NSString *)CFStringCreateWithCString(kCFAllocatorDefault, buf, kCFStringEncodingWindowsLatin1);
+        auto bufString = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, buf, kCFStringEncodingWindowsLatin1));
         if (!bufString) {
             return NPERR_INVALID_PARAM;
         }
-        NSURL *fileURL = [NSURL _web_URLWithDataAsString:bufString];
+        NSURL *fileURL = [NSURL _web_URLWithDataAsString:(__bridge NSString *)bufString.get()];
         NSString *path;
         if ([fileURL isFileURL]) {
             path = [fileURL path];
         } else {
-            path = bufString;
+            path = (__bridge NSString *)bufString.get();
         }
         postData = [NSData dataWithContentsOfFile:path];
-        CFRelease(bufString);
         if (!postData) {
             return NPERR_FILE_NOT_FOUND;
         }
@@ -1866,7 +1865,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
     
     LOG(Plugins, "NPN_Status: %@", status);
     WebView *wv = [self webView];
-    [[wv _UIDelegateForwarder] webView:wv setStatusText:(NSString *)status];
+    [[wv _UIDelegateForwarder] webView:wv setStatusText:(__bridge NSString *)status];
     CFRelease(status);
 }
 
@@ -2120,7 +2119,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
     if (!currentEvent)
         return NPERR_GENERIC_ERROR;
     
-    [NSMenu popUpContextMenu:(NSMenu *)menu withEvent:currentEvent forView:self];
+    [NSMenu popUpContextMenu:(__bridge NSMenu *)menu withEvent:currentEvent forView:self];
     return NPERR_NO_ERROR;
 }
 
index df127fe..290fef6 100644 (file)
@@ -410,7 +410,7 @@ static void cancelOutstandingCheck(const void *item, void *context)
 - (void)_cancelOutstandingChecks
 {
     if (_checksInProgress) {
-        CFSetApplyFunction((CFSetRef)_checksInProgress, cancelOutstandingCheck, NULL);
+        CFSetApplyFunction((__bridge CFSetRef)_checksInProgress, cancelOutstandingCheck, NULL);
         [_checksInProgress release];
         _checksInProgress = nil;
     }
index d86f231..b7697e7 100644 (file)
@@ -86,7 +86,7 @@ static WebPluginDatabase *sharedDatabase = nil;
     [sharedDatabase close];
 }
 
-static void checkCandidate(WebBasePluginPackage **currentPlugin, WebBasePluginPackage **candidatePlugin)
+static void checkCandidate(WebBasePluginPackage * __strong *currentPlugin, WebBasePluginPackage * __strong *candidatePlugin)
 {
     if (!*currentPlugin) {
         *currentPlugin = *candidatePlugin;
index 23e4e46..c3ea74a 100644 (file)
@@ -73,7 +73,7 @@ NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
 WebNetscapePluginView *pluginViewForInstance(NPP instance)
 {
     if (instance && instance->ndata)
-        return (WebNetscapePluginView *)instance->ndata;
+        return (__bridge WebNetscapePluginView *)instance->ndata;
     else
         return [WebNetscapePluginView currentPluginView];
 }
index 0051f58..ceece13 100644 (file)
@@ -118,16 +118,15 @@ static NSString *databasesDirectoryPath();
     if (!origin)
         return nil;
 
-    DatabaseDetails details = DatabaseManager::singleton().detailsForNameAndOrigin(databaseIdentifier, *[origin _core]);
+    auto details = DatabaseManager::singleton().detailsForNameAndOrigin(databaseIdentifier, *[origin _core]);
     if (details.name().isNull())
         return nil;
-        
-    static const id keys[3] = { WebDatabaseDisplayNameKey, WebDatabaseExpectedSizeKey, WebDatabaseUsageKey };
-    id objects[3];
-    objects[0] = details.displayName().isEmpty() ? databaseIdentifier : (NSString *)details.displayName();
-    objects[1] = [NSNumber numberWithUnsignedLongLong:details.expectedUsage()];
-    objects[2] = [NSNumber numberWithUnsignedLongLong:details.currentUsage()];
-    return [[[NSDictionary alloc] initWithObjects:objects forKeys:keys count:3] autorelease];
+
+    return @{
+        WebDatabaseDisplayNameKey: details.displayName().isEmpty() ? databaseIdentifier : (NSString *)details.displayName(),
+        WebDatabaseExpectedSizeKey: @(details.expectedUsage()),
+        WebDatabaseUsageKey: @(details.currentUsage()),
+    };
 }
 
 - (void)deleteAllDatabases
index 8676240..af7814b 100644 (file)
 
 #import "WebDelegateImplementationCaching.h"
 #import "WebElementDictionary.h"
-#import "WebFrame.h"
 #import "WebFrameInternal.h"
-#import "WebHTMLView.h"
+#import "WebFrameView.h"
 #import "WebHTMLViewInternal.h"
 #import "WebKitVersionChecks.h"
 #import "WebNSPasteboardExtras.h"
 #import "WebSharingServicePickerController.h"
-#import "WebUIDelegate.h"
 #import "WebUIDelegatePrivate.h"
-#import "WebView.h"
 #import "WebViewInternal.h"
 #import <WebCore/BitmapImage.h>
 #import <WebCore/ContextMenu.h>
@@ -121,7 +118,7 @@ bool WebContextMenuClient::isSpeaking()
 
 void WebContextMenuClient::speak(const String& string)
 {
-    [NSApp speakString:[[(NSString*)string copy] autorelease]];
+    [NSApp speakString:(NSString *)string];
 }
 
 void WebContextMenuClient::stopSpeaking()
index 2eff761..d311dd6 100644 (file)
@@ -45,7 +45,7 @@
 #import "WebEditingDelegatePrivate.h"
 #import "WebFormDelegate.h"
 #import "WebFrameInternal.h"
-#import "WebHTMLView.h"
+#import "WebFrameView.h"
 #import "WebHTMLViewInternal.h"
 #import "WebKitLogging.h"
 #import "WebKitVersionChecks.h"
@@ -772,7 +772,7 @@ void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event)
 {
     auto* frame = downcast<Node>(event->target())->document().frame();
 #if !PLATFORM(IOS)
-    WebHTMLView *webHTMLView = [[kit(frame) frameView] documentView];
+    WebHTMLView *webHTMLView = (WebHTMLView *)[[kit(frame) frameView] documentView];
     if ([webHTMLView _interpretKeyEvent:event savingCommands:NO])
         event->setDefaultHandled();
 #else
@@ -787,7 +787,7 @@ void WebEditorClient::handleInputMethodKeydown(KeyboardEvent* event)
 #if !PLATFORM(IOS)
     // FIXME: Switch to WebKit2 model, interpreting the event before it's sent down to WebCore.
     auto* frame = downcast<Node>(event->target())->document().frame();
-    WebHTMLView *webHTMLView = [[kit(frame) frameView] documentView];
+    WebHTMLView *webHTMLView = (WebHTMLView *)[[kit(frame) frameView] documentView];
     if ([webHTMLView _interpretKeyEvent:event savingCommands:YES])
         event->setDefaultHandled();
 #else
index 19f51cd..661a37c 100644 (file)
@@ -77,7 +77,7 @@ RetainPtr<CFDataRef> WebFrameNetworkingContext::sourceApplicationAuditData() con
     if (!webview)
         return nullptr;
 
-    return reinterpret_cast<CFDataRef>(webview._sourceApplicationAuditData);
+    return (__bridge CFDataRef)webview._sourceApplicationAuditData;
 }
 
 String WebFrameNetworkingContext::sourceApplicationIdentifier() const
index 5fe1b0b..d6e5399 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007, 2010, 2012 Apple Inc.  All rights reserved.
+ * Copyright (C) 2007-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
@@ -26,7 +26,8 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-@class WebSecurityOriginPrivate;
+struct WebSecurityOriginPrivate;
+
 @protocol WebQuotaManager;
 
 @interface WebSecurityOrigin : NSObject {
index b4aca6f..7e907c9 100644 (file)
@@ -29,7 +29,9 @@
 #import "WebNodeHighlighter.h"
 
 #import "DOMNodeInternal.h"
+#import "WebFrameView.h"
 #import "WebNodeHighlight.h"
+#import "WebNodeHighlightView.h"
 #import "WebViewInternal.h"
 #import <WebCore/Page.h>
 
index fd3d352..753dceb 100644 (file)
@@ -224,7 +224,7 @@ static NSRect convertRectToScreen(NSWindow *window, NSRect rect)
         [_webViewPlaceholder.get() setLayer:[CALayer layer]];
         [_webViewPlaceholder.get() setWantsLayer:YES];
     }
-    [[_webViewPlaceholder.get() layer] setContents:(id)webViewContents.get()];
+    [[_webViewPlaceholder.get() layer] setContents:(__bridge id)webViewContents.get()];
     _scrollPosition = [_webView _mainCoreFrame]->view()->scrollPosition();
     [self _swapView:_webView with:_webViewPlaceholder.get()];
     
index 2ace502..6a7b140 100644 (file)
@@ -1335,7 +1335,7 @@ static NSControlStateValue kit(TriState state)
     if ([types containsObject:WebArchivePboardType]) {
         if (RefPtr<LegacyWebArchive> coreArchive = LegacyWebArchive::createFromSelection(core([self _frame]))) {
             if (RetainPtr<CFDataRef> data = coreArchive ? coreArchive->rawDataRepresentation() : 0)
-                [pasteboard setData:(NSData *)data.get() forType:WebArchivePboardType];
+                [pasteboard setData:(__bridge NSData *)data.get() forType:WebArchivePboardType];
         }
     }
 
@@ -2020,7 +2020,7 @@ static bool mouseEventIsPartOfClickOrDrag(NSEvent *event)
         [pasteboard _web_writePromisedRTFDFromArchive:archive.get() containsImage:[[pasteboard types] containsObject:legacyTIFFPasteboardType()]];
     } else if ([type isEqualToString:legacyTIFFPasteboardType()] && _private->promisedDragTIFFDataSource) {
         if (auto* image = _private->promisedDragTIFFDataSource->image())
-            [pasteboard setData:(NSData *)image->tiffRepresentation() forType:legacyTIFFPasteboardType()];
+            [pasteboard setData:(__bridge NSData *)image->tiffRepresentation() forType:legacyTIFFPasteboardType()];
         [self setPromisedDragTIFFDataSource:nullptr];
     }
 }
index 926d4e4..551589a 100644 (file)
@@ -32,7 +32,7 @@
 #import "DOMRangeInternal.h"
 #import "WebElementDictionary.h"
 #import "WebFrameInternal.h"
-#import "WebHTMLView.h"
+#import "WebFrameView.h"
 #import "WebHTMLViewInternal.h"
 #import "WebUIDelegatePrivate.h"
 #import "WebViewInternal.h"
@@ -145,11 +145,12 @@ using namespace WebCore;
 
 - (void)performHitTestAtPoint:(NSPoint)viewPoint
 {
-    Frame* coreFrame = core([[[[_webView _selectedOrMainFrame] frameView] documentView] _frame]);
+    Frame* coreFrame = core([_webView _selectedOrMainFrame]);
     if (!coreFrame)
         return;
+
     _hitTestResult = coreFrame->eventHandler().hitTestResultAtPoint(IntPoint(viewPoint));
-    coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::PerformedHitTest);
+    coreFrame->mainFrame().eventHandler().setImmediateActionStage(ImmediateActionStage::PerformedHitTest);
 
     if (Element* element = _hitTestResult.targetElement())
         _contentPreventsDefault = element->dispatchMouseForceWillBegin();
@@ -205,10 +206,9 @@ using namespace WebCore;
     if (immediateActionRecognizer != _immediateActionRecognizer)
         return;
 
-    Frame* coreFrame = core([[[[_webView _selectedOrMainFrame] frameView] documentView] _frame]);
-    if (!coreFrame)
-        return;
-    coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::ActionUpdated);
+    if (Frame* coreFrame = [_webView _mainCoreFrame])
+        coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::ActionUpdated);
+
     if (_contentPreventsDefault)
         return;
 
@@ -220,12 +220,7 @@ using namespace WebCore;
     if (immediateActionRecognizer != _immediateActionRecognizer)
         return;
 
-    NSView *documentView = [[[_webView _selectedOrMainFrame] frameView] documentView];
-    if (![documentView isKindOfClass:[WebHTMLView class]])
-        return;
-
-    Frame* coreFrame = core([(WebHTMLView *)documentView _frame]);
-    if (coreFrame) {
+    if (Frame* coreFrame = [_webView _mainCoreFrame]) {
         ImmediateActionStage lastStage = coreFrame->eventHandler().immediateActionStage();
         if (lastStage == ImmediateActionStage::ActionUpdated)
             coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::ActionCancelledAfterUpdate);
@@ -244,10 +239,8 @@ using namespace WebCore;
     if (immediateActionRecognizer != _immediateActionRecognizer)
         return;
 
-    Frame* coreFrame = core([[[[_webView _selectedOrMainFrame] frameView] documentView] _frame]);
-    if (!coreFrame)
-        return;
-    coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::ActionCompleted);
+    if (Frame* coreFrame = [_webView _mainCoreFrame])
+        coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::ActionCompleted);
 
     [_webView _setTextIndicatorAnimationProgress:1];
     [_webView _setMaintainsInactiveSelection:NO];
index 24169fe..e8bf4b5 100644 (file)
 
 static void jsPDFDocInitialize(JSContextRef ctx, JSObjectRef object)
 {
-    WebDataSource *dataSource = (WebDataSource *)JSObjectGetPrivate(object);
-    CFRetain(dataSource);
+    CFRetain(JSObjectGetPrivate(object));
 }
 
 static void jsPDFDocFinalize(JSObjectRef object)
 {
-    WebDataSource *dataSource = (WebDataSource *)JSObjectGetPrivate(object);
-    CFRelease(dataSource);
+    CFRelease(JSObjectGetPrivate(object));
 }
 
 static JSValueRef jsPDFDocPrint(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
-    WebDataSource *dataSource = (WebDataSource *)JSObjectGetPrivate(thisObject);
+    WebDataSource *dataSource = (__bridge WebDataSource *)JSObjectGetPrivate(thisObject);
 
     WebView *webView = [[dataSource webFrame] webView];
     CallUIDelegate(webView, @selector(webView:printFrameView:), [[dataSource webFrame] frameView]);
@@ -72,5 +70,5 @@ JSObjectRef makeJSPDFDoc(JSContextRef ctx, WebDataSource *dataSource)
 {
     static JSClassRef jsPDFDocClass = JSClassCreate(&jsPDFDocClassDefinition);
 
-    return JSObjectMake(ctx, jsPDFDocClass, dataSource);
+    return JSObjectMake(ctx, jsPDFDocClass, (__bridge void*)dataSource);
 }
index 26b25ed..9ab2338 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#if !PLATFORM(IOS)
-
 #import "WebPDFView.h"
 
+#if PLATFORM(MAC)
+
 #import "DOMNodeInternal.h"
 #import "DOMRangeInternal.h"
 #import "PDFViewSPI.h"
@@ -128,12 +128,12 @@ static void _applicationInfoForMIMEType(NSString *type, NSString **name, NSImage
 
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
-    OSStatus error = LSCopyApplicationForMIMEType((CFStringRef)type, kLSRolesAll, &appURL);
+    OSStatus error = LSCopyApplicationForMIMEType((__bridge CFStringRef)type, kLSRolesAll, &appURL);
 #pragma clang diagnostic pop
     if (error != noErr)
         return;
     
-    NSString *appPath = [(NSURL *)appURL path];
+    NSString *appPath = [(__bridge NSURL *)appURL path];
     CFRelease(appURL);
     
     *image = [[NSWorkspace sharedWorkspace] iconForFile:appPath];  
@@ -1594,4 +1594,4 @@ static void removeUselessMenuItemSeparators(NSMutableArray *menuItems)
 
 @end
 
-#endif // !PLATFORM(IOS)
+#endif // PLATFORM(MAC)
index 1f65df0..4afda34 100644 (file)
@@ -764,7 +764,7 @@ public:
 #if PLATFORM(IOS)
     dispatch_barrier_sync(_private->readWriteQueue, ^{
 #endif
-    [_private->values.get() _webkit_setInt:value forKey:_key];
+    [_private->values.get() setObject:@(value) forKey:_key];
 #if PLATFORM(IOS)
     });
 #endif
@@ -787,7 +787,7 @@ public:
 #if PLATFORM(IOS)
     dispatch_barrier_sync(_private->readWriteQueue, ^{
 #endif
-    [_private->values.get() _webkit_setUnsignedInt:value forKey:_key];
+    [_private->values.get() setObject:@(value) forKey:_key];
 #if PLATFORM(IOS)
     });
 #endif
@@ -810,7 +810,7 @@ public:
 #if PLATFORM(IOS)
     dispatch_barrier_sync(_private->readWriteQueue, ^{
 #endif
-    [_private->values.get() _webkit_setFloat:value forKey:_key];
+    [_private->values.get() setObject:@(value) forKey:_key];
 #if PLATFORM(IOS)
     });
 #endif
@@ -832,7 +832,7 @@ public:
 #if PLATFORM(IOS)
     dispatch_barrier_sync(_private->readWriteQueue, ^{
 #endif
-    [_private->values.get() _webkit_setBool:value forKey:_key];
+    [_private->values.get() setObject:@(value) forKey:_key];
 #if PLATFORM(IOS)
     });
 #endif
@@ -855,7 +855,7 @@ public:
 #if PLATFORM(IOS)
     dispatch_barrier_sync(_private->readWriteQueue, ^{
 #endif
-    [_private->values.get() _webkit_setLongLong:value forKey:_key];
+    [_private->values.get() setObject:@(value) forKey:_key];
 #if PLATFORM(IOS)
     });
 #endif
@@ -878,7 +878,7 @@ public:
 #if PLATFORM(IOS)
     dispatch_barrier_sync(_private->readWriteQueue, ^{
 #endif
-    [_private->values.get() _webkit_setUnsignedLongLong:value forKey:_key];
+    [_private->values.get() setObject:@(value) forKey:_key];
 #if PLATFORM(IOS)
     });
 #endif
index 9cff0bd..d4d1e6e 100644 (file)
@@ -1114,13 +1114,13 @@ static CFMutableSetRef allWebViewsSet;
     if (!allWebViewsSet)
         return;
 
-    [(NSMutableSet *)allWebViewsSet makeObjectsPerformSelector:selector];
+    [(__bridge NSMutableSet *)allWebViewsSet makeObjectsPerformSelector:selector];
 }
 
 - (void)_removeFromAllWebViewsSet
 {
     if (allWebViewsSet)
-        CFSetRemoveValue(allWebViewsSet, self);
+        CFSetRemoveValue(allWebViewsSet, (__bridge CFTypeRef)self);
 }
 
 - (void)_addToAllWebViewsSet
@@ -1128,7 +1128,7 @@ static CFMutableSetRef allWebViewsSet;
     if (!allWebViewsSet)
         allWebViewsSet = CFSetCreateMutable(NULL, 0, &NonRetainingSetCallbacks);
 
-    CFSetSetValue(allWebViewsSet, self);
+    CFSetSetValue(allWebViewsSet, (__bridge CFTypeRef)self);
 }
 
 @end
@@ -2113,10 +2113,7 @@ static NSMutableSet *knownPluginMIMETypes()
     DOMWindow::dispatchAllPendingUnloadEvents();
 
     // This will close the WebViews in a random order. Change this if close order is important.
-    // Make a new set to avoid mutating the set we are enumerating.
-    NSSet *webViewsToClose = [NSSet setWithSet:(NSSet *)allWebViewsSet]; 
-    NSEnumerator *enumerator = [webViewsToClose objectEnumerator];
-    while (WebView *webView = [enumerator nextObject])
+    for (WebView *webView in [(__bridge NSSet *)allWebViewsSet allObjects])
         [webView close];
 }
 
@@ -6174,11 +6171,6 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
     }
 }
 
-- (void)_windowVisibilityChanged:(NSNotification *)notification
-{
-    [self _updateVisibilityState];
-}
-
 - (void)_windowWillClose:(NSNotification *)notification
 {
     if ([self shouldCloseWithWindow] && ([self window] == [self hostWindow] || ([self window] && ![self hostWindow]) || (![self window] && [self hostWindow])))
@@ -10066,6 +10058,11 @@ static NSTextAlignment nsTextAlignmentFromRenderStyle(const RenderStyle* style)
 
 #endif
 
+- (void)_windowVisibilityChanged:(NSNotification *)notification
+{
+    [self _updateVisibilityState];
+}
+
 @end
 
 @implementation WebView (WebViewDeviceOrientation)
index 6825371..6492e4a 100644 (file)
@@ -33,6 +33,7 @@
 #import "WebPreferenceKeysPrivate.h"
 #import "WebSelectionServiceController.h"
 #import "WebViewGroup.h"
+#import "WebViewInternal.h"
 #import <JavaScriptCore/InitializeThreading.h>
 #import <WebCore/AlternativeTextUIController.h>
 #import <WebCore/HistoryItem.h>
index 90fa387..0e7c5d7 100644 (file)
@@ -146,6 +146,8 @@ OBJC_CLASS NSTextAlternatives;
 - (WebSelectionServiceController&)_selectionServiceController;
 #endif
 
+- (void)_windowVisibilityChanged:(NSNotification *)notification;
+
 @end
 
 #endif
index 3e9c2d1..6d5d062 100644 (file)
@@ -1,3 +1,178 @@
+2018-08-05  Darin Adler  <darin@apple.com>
+
+        [Cocoa] More tweaks and refactoring to prepare for ARC
+        https://bugs.webkit.org/show_bug.cgi?id=188245
+
+        Reviewed by Dan Bernstein.
+
+        * DumpRenderTree/TestNetscapePlugIn/PluginObject.h: Use const void* for a
+        CFTypeRef instead of void*.
+
+        * DumpRenderTree/TestNetscapePlugIn/PluginObjectMac.mm:
+        (createCoreAnimationLayer): Use CFBridgingRetain.
+
+        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+        (AccessibilityUIElement::lineTextMarkerRangeForTextMarker): Use bridging casts.
+        (AccessibilityUIElement::textMarkerRangeForElement): Ditto.
+        (AccessibilityUIElement::selectedTextMarkerRange): Ditto.
+        (AccessibilityUIElement::textMarkerRangeLength): Ditto.
+        (AccessibilityUIElement::attributedStringForTextMarkerRangeContainsAttribute): Ditto.
+        (AccessibilityUIElement::indexForTextMarker): Ditto.
+        (AccessibilityUIElement::textMarkerForIndex): Ditto.
+        (AccessibilityUIElement::isTextMarkerValid): Ditto.
+        (AccessibilityUIElement::previousTextMarker): Ditto.
+        (AccessibilityUIElement::nextTextMarker): Ditto.
+        (AccessibilityUIElement::stringForTextMarkerRange): Ditto.
+        (createJSStringRef): Ditto.
+        (AccessibilityUIElement::attributedStringForTextMarkerRange): Ditto.
+        (AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions): Ditto.
+        (AccessibilityUIElement::textMarkerRangeForMarkers): Ditto.
+        (AccessibilityUIElement::startTextMarkerForTextMarkerRange): Ditto.
+        (AccessibilityUIElement::endTextMarkerForTextMarkerRange): Ditto.
+        (AccessibilityUIElement::endTextMarkerForBounds): Ditto.
+        (AccessibilityUIElement::startTextMarkerForBounds): Ditto.
+        (AccessibilityUIElement::textMarkerForPoint): Ditto.
+        (AccessibilityUIElement::accessibilityElementForTextMarker): Ditto.
+        (AccessibilityUIElement::startTextMarker): Ditto.
+        (AccessibilityUIElement::endTextMarker): Ditto.
+        (AccessibilityUIElement::setSelectedVisibleTextRange): Ditto.
+        (AccessibilityUIElement::leftWordTextMarkerRangeForTextMarker): Ditto.
+        (AccessibilityUIElement::rightWordTextMarkerRangeForTextMarker): Ditto.
+        (AccessibilityUIElement::previousWordStartTextMarkerForTextMarker): Ditto.
+        (AccessibilityUIElement::nextWordEndTextMarkerForTextMarker): Ditto.
+        (AccessibilityUIElement::paragraphTextMarkerRangeForTextMarker): Ditto.
+        (AccessibilityUIElement::previousParagraphStartTextMarkerForTextMarker): Ditto.
+        (AccessibilityUIElement::nextParagraphEndTextMarkerForTextMarker): Ditto.
+        (AccessibilityUIElement::sentenceTextMarkerRangeForTextMarker): Ditto.
+        (AccessibilityUIElement::previousSentenceStartTextMarkerForTextMarker): Ditto.
+        (AccessibilityUIElement::nextSentenceEndTextMarkerForTextMarker): Ditto.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetWebPreferencesToConsistentValues): Use bridging cast.
+        (dumpFramesAsText): Ditto.
+        (dumpBackForwardListForAllWindows): Use a modern for loop instead of
+        CFArray functions to iterate the array.
+        (dump): Use bridging cast.
+        (runTest): Ditto.
+
+        * DumpRenderTree/mac/DumpRenderTreePasteboard.mm:
+        (+[LocalPasteboard alloc]): Use class_createInstance instead of NSAllocateObject.
+        (toUTI): Return a RetainPtr<CFStringRef>.
+        (-[LocalPasteboard types]): Use the above and bridging casts.
+        (-[LocalPasteboard availableTypeFromArray:]): Ditto.
+        (-[LocalPasteboard setData:forType:]): Ditto.
+        (-[LocalPasteboard dataForType:]): Ditto.
+        (-[LocalPasteboard setPropertyList:forType:]): Use NSPropertyListSerialization
+        instead of CFPropertyList.
+        (-[LocalPasteboard setString:forType:]): Use NSString method instead of
+        CFStringCreateExternalRepresentation.
+
+        * DumpRenderTree/mac/MockGeolocationProvider.h: Put CFTypeRef in a HashSet
+        instead of an Objective-C object pointer type.
+        * DumpRenderTree/mac/MockGeolocationProvider.mm:
+        (-[MockGeolocationProvider registerWebView:]): Update for above.
+        (-[MockGeolocationProvider unregisterWebView:]): Ditto.
+        (-[MockGeolocationProvider timerFired]): Ditto.
+
+        * DumpRenderTree/mac/MockWebNotificationProvider.h: Use CFTypeRef in
+        HashMap and HashSet instead of an Objective-C object pointer type.
+        * DumpRenderTree/mac/MockWebNotificationProvider.mm:
+        (-[MockWebNotificationProvider registerWebView:]): Update for above.
+        (-[MockWebNotificationProvider unregisterWebView:]): Ditto.
+        (-[MockWebNotificationProvider showNotification:fromWebView:]): Ditto.
+        (-[MockWebNotificationProvider cancelNotification:]): Ditto.
+        (-[MockWebNotificationProvider simulateWebNotificationClick:]): Ditto.
+
+        * DumpRenderTree/mac/ObjCPlugin.m:
+        (-[JSObjC retainObject:]): Use CFRetain instead of -[NSObject retain].
+
+        * DumpRenderTree/mac/TestRunnerMac.mm:
+        (TestRunner::addDisallowedURL): Use bridging cast.
+        (TestRunner::applicationCacheDiskUsageForOrigin): Ditto.
+        (TestRunner::clearApplicationCacheForOrigin): Ditto.
+        (originsArrayToJS): Ditto.
+        (TestRunner::copyDecodedHostName): Ditto.
+        (TestRunner::copyEncodedHostName): Ditto.
+        (TestRunner::queueLoad): Ditto.
+        (TestRunner::setDomainRelaxationForbiddenForURLScheme): Ditto.
+        (TestRunner::setMockGeolocationPositionUnavailableError): Ditto.
+        (TestRunner::setUserStyleSheetLocation): Ditto.
+        (TestRunner::setValueForUser): Ditto.
+        (TestRunner::overridePreference): Ditto.
+        (TestRunner::execCommand): Ditto.
+        (TestRunner::findString): Ditto.
+        (TestRunner::isCommandEnabled): Ditto.
+        (TestRunner::addOriginAccessWhitelistEntry): Ditto.
+        (TestRunner::removeOriginAccessWhitelistEntry): Ditto.
+        (TestRunner::addUserScript): Ditto.
+        (TestRunner::addUserStyleSheet): Ditto.
+        (TestRunner::evaluateInWebInspector): Ditto.
+        (TestRunner::evaluateScriptInIsolatedWorld): Ditto.
+        (TestRunner::authenticateSession): Ditto.
+        (TestRunner::grantWebNotificationPermission): Ditto.
+        (TestRunner::denyWebNotificationPermission): Ditto.
+        * TestRunnerShared/cocoa/LayoutTestSpellChecker.mm:
+        (-[LayoutTestSpellChecker setResultsFromJSObject:inContext:]): Ditto.
+
+        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+        (WTR::AccessibilityUIElement::lineTextMarkerRangeForTextMarker): Use bridging cast.
+        (WTR::AccessibilityUIElement::textMarkerRangeForElement): Ditto.
+        (WTR::AccessibilityUIElement::previousTextMarker): Ditto.
+        (WTR::AccessibilityUIElement::nextTextMarker): Ditto.
+        (WTR::AccessibilityUIElement::textMarkerRangeForMarkers): Ditto.
+        (WTR::AccessibilityUIElement::selectedTextMarkerRange): Ditto.
+        (WTR::AccessibilityUIElement::startTextMarkerForTextMarkerRange): Ditto.
+        (WTR::AccessibilityUIElement::endTextMarkerForTextMarkerRange): Ditto.
+        (WTR::AccessibilityUIElement::endTextMarkerForBounds): Ditto.
+        (WTR::AccessibilityUIElement::startTextMarkerForBounds): Ditto.
+        (WTR::AccessibilityUIElement::textMarkerForPoint): Ditto.
+        (WTR::AccessibilityUIElement::textMarkerForIndex): Ditto.
+        (WTR::AccessibilityUIElement::startTextMarker): Ditto.
+        (WTR::AccessibilityUIElement::endTextMarker): Ditto.
+        (WTR::AccessibilityUIElement::leftWordTextMarkerRangeForTextMarker): Ditto.
+        (WTR::AccessibilityUIElement::rightWordTextMarkerRangeForTextMarker): Ditto.
+        (WTR::AccessibilityUIElement::previousWordStartTextMarkerForTextMarker): Ditto.
+        (WTR::AccessibilityUIElement::nextWordEndTextMarkerForTextMarker): Ditto.
+        (WTR::AccessibilityUIElement::paragraphTextMarkerRangeForTextMarker): Ditto.
+        (WTR::AccessibilityUIElement::previousParagraphStartTextMarkerForTextMarker): Ditto.
+        (WTR::AccessibilityUIElement::nextParagraphEndTextMarkerForTextMarker): Ditto.
+        (WTR::AccessibilityUIElement::sentenceTextMarkerRangeForTextMarker): Ditto.
+        (WTR::AccessibilityUIElement::previousSentenceStartTextMarkerForTextMarker): Ditto.
+        (WTR::AccessibilityUIElement::nextSentenceEndTextMarkerForTextMarker): Ditto.
+
+        * WebKitTestRunner/PlatformMac.cmake: Added WebKitTestRunnerWindow.h and .mm files.
+        * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: Ditto.
+
+        * WebKitTestRunner/mac/EventSenderProxy.mm: Add include of WebKitTestRunnerWindow.h
+        so we can use the type and know it inherits from NSWindow.
+
+        * WebKitTestRunner/mac/PlatformWebViewMac.mm: Add include of WebKitTestRunnerWindow.h
+        so we can use the type and know it inherits from NSWindow. Moved WebKitTestRunnerWindow
+        class into a separate file.
+        (WTR::PlatformWebView::keyWindow): Call +[WebKitTestRunnerWindow _WTR_keyWindow]
+        instead of have a second copy of the implementation.
+
+        * WebKitTestRunner/mac/WebKitTestRunnerEvent.mm: Add include of WebKitTestRunnerWindow.h
+        so we can use the type and know it inherits from NSWindow. Also removed "using namespace".
+        (+[WebKitTestRunnerEvent mouseLocation]): Updated for above.
+
+        * WebKitTestRunner/mac/WebKitTestRunnerPasteboard.mm:
+        (+[LocalPasteboard alloc]): Use class_createInstance instead of NSAllocateObject.
+        (-[LocalPasteboard availableTypeFromArray:]): Use modern for loop.
+        (-[LocalPasteboard setData:forType:]): Reordered method to be a tiny bit more efficient.
+        (-[LocalPasteboard setPropertyList:forType:]): Use NSPropertyListSerialization
+        instead of CFPropertyList.
+        (-[LocalPasteboard setString:forType:]): Use NSString method instead of
+        CFStringCreateExternalRepresentation.
+
+        * WebKitTestRunner/mac/WebKitTestRunnerWindow.h: Moved declaration of
+        WebKitTestRunnerWindow here so it can be included by files that need to know
+        what the type is and that it inherits from NSWindow.
+
+        * WebKitTestRunner/mac/WebKitTestRunnerWindow.mm: Added. Moved implementation here.
+        (+[WebKitTestRunnerWindow _WTR_keyWindow]): Use modern for loop instead of the old,
+        messier implementation.
+
 2018-08-07  Alex Christensen  <achristensen@webkit.org>
 
         Add a test for using SafeBrowsing
index e877446..fc73263 100644 (file)
@@ -68,7 +68,7 @@ typedef struct {
     NPEventModel eventModel;
 #endif
 #ifdef XP_MACOSX
-    void* coreAnimationLayer;
+    const void* coreAnimationLayer;
 #endif
     NPWindow lastWindow;
 } PluginObject;
@@ -83,7 +83,7 @@ extern bool testDocumentOpen(NPP npp);
 extern bool testWindowOpen(NPP npp);
 
 #ifdef XP_MACOSX
-extern void* createCoreAnimationLayer();
+extern const void* createCoreAnimationLayer();
 #endif
 
 #endif
index 4dca7f5..edecd92 100644 (file)
@@ -42,7 +42,7 @@
 
 @end
 
-void* createCoreAnimationLayer()
+const void* createCoreAnimationLayer()
 {
     CALayer *caLayer = [[TestPluginLayer alloc] init];
 
@@ -93,5 +93,5 @@ void* createCoreAnimationLayer()
                                                       attribute:kCAConstraintMaxX]];
 
     [caLayer addSublayer:sublayer];
-    return caLayer;
+    return CFBridgingRetain(caLayer);
 }
index bd840ce..ba9b550 100644 (file)
@@ -1587,8 +1587,8 @@ void AccessibilityUIElement::removeSelection()
 AccessibilityTextMarkerRange AccessibilityUIElement::lineTextMarkerRangeForTextMarker(AccessibilityTextMarker* textMarker)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    id textMarkerRange = [m_element accessibilityAttributeValue:@"AXLineTextMarkerRangeForTextMarker" forParameter:(id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarkerRange(textMarkerRange);
+    id textMarkerRange = [m_element accessibilityAttributeValue:@"AXLineTextMarkerRangeForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
+    return AccessibilityTextMarkerRange((__bridge CFTypeRef)textMarkerRange);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1598,7 +1598,7 @@ AccessibilityTextMarkerRange AccessibilityUIElement::textMarkerRangeForElement(A
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarkerRange = [m_element accessibilityAttributeValue:@"AXTextMarkerRangeForUIElement" forParameter:element->platformUIElement()];
-    return AccessibilityTextMarkerRange(textMarkerRange);
+    return AccessibilityTextMarkerRange((__bridge CFTypeRef)textMarkerRange);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1608,7 +1608,7 @@ AccessibilityTextMarkerRange AccessibilityUIElement::selectedTextMarkerRange()
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarkerRange = [m_element accessibilityAttributeValue:NSAccessibilitySelectedTextMarkerRangeAttribute];
-    return AccessibilityTextMarkerRange(textMarkerRange);
+    return AccessibilityTextMarkerRange((__bridge CFTypeRef)textMarkerRange);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1633,7 +1633,7 @@ void AccessibilityUIElement::resetSelectedTextMarkerRange()
 int AccessibilityUIElement::textMarkerRangeLength(AccessibilityTextMarkerRange* range)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    NSNumber* lengthValue = [m_element accessibilityAttributeValue:@"AXLengthForTextMarkerRange" forParameter:(id)range->platformTextMarkerRange()];
+    NSNumber* lengthValue = [m_element accessibilityAttributeValue:@"AXLengthForTextMarkerRange" forParameter:(__bridge id)range->platformTextMarkerRange()];
     return [lengthValue intValue];
     END_AX_OBJC_EXCEPTIONS
     
@@ -1643,7 +1643,7 @@ int AccessibilityUIElement::textMarkerRangeLength(AccessibilityTextMarkerRange*
 bool AccessibilityUIElement::attributedStringForTextMarkerRangeContainsAttribute(JSStringRef attribute, AccessibilityTextMarkerRange* range)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    NSAttributedString* string = [m_element accessibilityAttributeValue:@"AXAttributedStringForTextMarkerRange" forParameter:(id)range->platformTextMarkerRange()];
+    NSAttributedString* string = [m_element accessibilityAttributeValue:@"AXAttributedStringForTextMarkerRange" forParameter:(__bridge id)range->platformTextMarkerRange()];
     if (![string isKindOfClass:[NSAttributedString class]])
         return false;
     
@@ -1658,7 +1658,7 @@ bool AccessibilityUIElement::attributedStringForTextMarkerRangeContainsAttribute
 int AccessibilityUIElement::indexForTextMarker(AccessibilityTextMarker* marker)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    NSNumber* indexNumber = [m_element accessibilityAttributeValue:@"AXIndexForTextMarker" forParameter:(id)marker->platformTextMarker()];
+    NSNumber* indexNumber = [m_element accessibilityAttributeValue:@"AXIndexForTextMarker" forParameter:(__bridge id)marker->platformTextMarker()];
     return [indexNumber intValue];
     END_AX_OBJC_EXCEPTIONS
     
@@ -1669,7 +1669,7 @@ AccessibilityTextMarker AccessibilityUIElement::textMarkerForIndex(int textIndex
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarker = [m_element accessibilityAttributeValue:@"AXTextMarkerForIndex" forParameter:[NSNumber numberWithInteger:textIndex]];
-    return AccessibilityTextMarker(textMarker);
+    return AccessibilityTextMarker((__bridge CFTypeRef)textMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1678,7 +1678,7 @@ AccessibilityTextMarker AccessibilityUIElement::textMarkerForIndex(int textIndex
 bool AccessibilityUIElement::isTextMarkerValid(AccessibilityTextMarker* textMarker)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    NSNumber* validNumber = [m_element accessibilityAttributeValue:@"AXTextMarkerIsValid" forParameter:(id)textMarker->platformTextMarker()];
+    NSNumber* validNumber = [m_element accessibilityAttributeValue:@"AXTextMarkerIsValid" forParameter:(__bridge id)textMarker->platformTextMarker()];
     return [validNumber boolValue];
     END_AX_OBJC_EXCEPTIONS
 
@@ -1688,8 +1688,8 @@ bool AccessibilityUIElement::isTextMarkerValid(AccessibilityTextMarker* textMark
 AccessibilityTextMarker AccessibilityUIElement::previousTextMarker(AccessibilityTextMarker* textMarker)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    id previousMarker = [m_element accessibilityAttributeValue:@"AXPreviousTextMarkerForTextMarker" forParameter:(id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarker(previousMarker);
+    id previousMarker = [m_element accessibilityAttributeValue:@"AXPreviousTextMarkerForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
+    return AccessibilityTextMarker((__bridge CFTypeRef)previousMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1698,8 +1698,8 @@ AccessibilityTextMarker AccessibilityUIElement::previousTextMarker(Accessibility
 AccessibilityTextMarker AccessibilityUIElement::nextTextMarker(AccessibilityTextMarker* textMarker)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    id nextMarker = [m_element accessibilityAttributeValue:@"AXNextTextMarkerForTextMarker" forParameter:(id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarker(nextMarker);
+    id nextMarker = [m_element accessibilityAttributeValue:@"AXNextTextMarkerForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
+    return AccessibilityTextMarker((__bridge CFTypeRef)nextMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1708,7 +1708,7 @@ AccessibilityTextMarker AccessibilityUIElement::nextTextMarker(AccessibilityText
 JSStringRef AccessibilityUIElement::stringForTextMarkerRange(AccessibilityTextMarkerRange* markerRange)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    id textString = [m_element accessibilityAttributeValue:@"AXStringForTextMarkerRange" forParameter:(id)markerRange->platformTextMarkerRange()];
+    id textString = [m_element accessibilityAttributeValue:@"AXStringForTextMarkerRange" forParameter:(__bridge id)markerRange->platformTextMarkerRange()];
     return [textString createJSStringRef];
     END_AX_OBJC_EXCEPTIONS
     
@@ -1727,9 +1727,9 @@ static JSStringRef createJSStringRef(id string)
             misspelled = [[attrs objectForKey:NSAccessibilityMarkedMisspelledTextAttribute] boolValue];
         if (misspelled)
             [mutableString appendString:@"Misspelled, "];
-        id font = [attributes objectForKey:(id)kAXFontTextAttribute];
+        id font = [attributes objectForKey:(__bridge NSString *)kAXFontTextAttribute];
         if (font)
-            [mutableString appendFormat:@"%@ - %@, ", (id)kAXFontTextAttribute, font];
+            [mutableString appendFormat:@"%@ - %@, ", (__bridge NSString *)kAXFontTextAttribute, font];
     };
     [string enumerateAttributesInRange:NSMakeRange(0, [string length]) options:(NSAttributedStringEnumerationOptions)0 usingBlock:attributeEnumerationBlock];
     [mutableString appendString:[string string]];
@@ -1738,7 +1738,7 @@ static JSStringRef createJSStringRef(id string)
 
 JSStringRef AccessibilityUIElement::attributedStringForTextMarkerRange(AccessibilityTextMarkerRange* markerRange)
 {
-    id string = [m_element accessibilityAttributeValue:@"AXAttributedStringForTextMarkerRange" forParameter:(id)markerRange->platformTextMarkerRange()];
+    id string = [m_element accessibilityAttributeValue:@"AXAttributedStringForTextMarkerRange" forParameter:(__bridge id)markerRange->platformTextMarkerRange()];
     return createJSStringRef(string);
 }
 
@@ -1746,9 +1746,9 @@ JSStringRef AccessibilityUIElement::attributedStringForTextMarkerRangeWithOption
 {
     id parameter = nil;
     if (includeSpellCheck)
-        parameter = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:includeSpellCheck], @"AXSpellCheck", (id)markerRange->platformTextMarkerRange(), @"AXTextMarkerRange", nil];
+        parameter = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:includeSpellCheck], @"AXSpellCheck", (__bridge id)markerRange->platformTextMarkerRange(), @"AXTextMarkerRange", nil];
     else
-        parameter = (id)markerRange->platformTextMarkerRange();
+        parameter = (__bridge id)markerRange->platformTextMarkerRange();
     id string = [m_element accessibilityAttributeValue:@"AXAttributedStringForTextMarkerRangeWithOptions" forParameter:parameter];
     return createJSStringRef(string);
 }
@@ -1756,9 +1756,9 @@ JSStringRef AccessibilityUIElement::attributedStringForTextMarkerRangeWithOption
 AccessibilityTextMarkerRange AccessibilityUIElement::textMarkerRangeForMarkers(AccessibilityTextMarker* startMarker, AccessibilityTextMarker* endMarker)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    NSArray* textMarkers = [NSArray arrayWithObjects:(id)startMarker->platformTextMarker(), (id)endMarker->platformTextMarker(), nil];
+    NSArray* textMarkers = [NSArray arrayWithObjects:(__bridge id)startMarker->platformTextMarker(), (__bridge id)endMarker->platformTextMarker(), nil];
     id textMarkerRange = [m_element accessibilityAttributeValue:@"AXTextMarkerRangeForUnorderedTextMarkers" forParameter:textMarkers];
-    return AccessibilityTextMarkerRange(textMarkerRange);
+    return AccessibilityTextMarkerRange((__bridge CFTypeRef)textMarkerRange);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1767,8 +1767,8 @@ AccessibilityTextMarkerRange AccessibilityUIElement::textMarkerRangeForMarkers(A
 AccessibilityTextMarker AccessibilityUIElement::startTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange* range)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    id textMarker = [m_element accessibilityAttributeValue:@"AXStartTextMarkerForTextMarkerRange" forParameter:(id)range->platformTextMarkerRange()];
-    return AccessibilityTextMarker(textMarker);
+    id textMarker = [m_element accessibilityAttributeValue:@"AXStartTextMarkerForTextMarkerRange" forParameter:(__bridge id)range->platformTextMarkerRange()];
+    return AccessibilityTextMarker((__bridge CFTypeRef)textMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1777,8 +1777,8 @@ AccessibilityTextMarker AccessibilityUIElement::startTextMarkerForTextMarkerRang
 AccessibilityTextMarker AccessibilityUIElement::endTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange* range)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    id textMarker = [m_element accessibilityAttributeValue:@"AXEndTextMarkerForTextMarkerRange" forParameter:(id)range->platformTextMarkerRange()];
-    return AccessibilityTextMarker(textMarker);
+    id textMarker = [m_element accessibilityAttributeValue:@"AXEndTextMarkerForTextMarkerRange" forParameter:(__bridge id)range->platformTextMarkerRange()];
+    return AccessibilityTextMarker((__bridge CFTypeRef)textMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1788,7 +1788,7 @@ AccessibilityTextMarker AccessibilityUIElement::endTextMarkerForBounds(int x, in
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarker = [m_element accessibilityAttributeValue:NSAccessibilityEndTextMarkerForBoundsParameterizedAttribute forParameter:[NSValue valueWithRect:NSMakeRect(x, y, width, height)]];
-    return AccessibilityTextMarker(textMarker);
+    return AccessibilityTextMarker((__bridge CFTypeRef)textMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1798,7 +1798,7 @@ AccessibilityTextMarker AccessibilityUIElement::startTextMarkerForBounds(int x,
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarker = [m_element accessibilityAttributeValue:NSAccessibilityStartTextMarkerForBoundsParameterizedAttribute forParameter:[NSValue valueWithRect:NSMakeRect(x, y, width, height)]];
-    return AccessibilityTextMarker(textMarker);
+    return AccessibilityTextMarker((__bridge CFTypeRef)textMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1808,7 +1808,7 @@ AccessibilityTextMarker AccessibilityUIElement::textMarkerForPoint(int x, int y)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarker = [m_element accessibilityAttributeValue:@"AXTextMarkerForPosition" forParameter:[NSValue valueWithPoint:NSMakePoint(x, y)]];
-    return AccessibilityTextMarker(textMarker);
+    return AccessibilityTextMarker((__bridge CFTypeRef)textMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1817,7 +1817,7 @@ AccessibilityTextMarker AccessibilityUIElement::textMarkerForPoint(int x, int y)
 AccessibilityUIElement AccessibilityUIElement::accessibilityElementForTextMarker(AccessibilityTextMarker* marker)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    id uiElement = [m_element accessibilityAttributeValue:@"AXUIElementForTextMarker" forParameter:(id)marker->platformTextMarker()];
+    id uiElement = [m_element accessibilityAttributeValue:@"AXUIElementForTextMarker" forParameter:(__bridge id)marker->platformTextMarker()];
     return AccessibilityUIElement(uiElement);
     END_AX_OBJC_EXCEPTIONS
     
@@ -1828,7 +1828,7 @@ AccessibilityTextMarker AccessibilityUIElement::startTextMarker()
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarker = [m_element accessibilityAttributeValue:@"AXStartTextMarker"];
-    return AccessibilityTextMarker(textMarker);
+    return AccessibilityTextMarker((__bridge CFTypeRef)textMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1838,7 +1838,7 @@ AccessibilityTextMarker AccessibilityUIElement::endTextMarker()
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarker = [m_element accessibilityAttributeValue:@"AXEndTextMarker"];
-    return AccessibilityTextMarker(textMarker);
+    return AccessibilityTextMarker((__bridge CFTypeRef)textMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1847,7 +1847,7 @@ AccessibilityTextMarker AccessibilityUIElement::endTextMarker()
 bool AccessibilityUIElement::setSelectedVisibleTextRange(AccessibilityTextMarkerRange* markerRange)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    [m_element accessibilitySetValue:(id)markerRange->platformTextMarkerRange() forAttribute:NSAccessibilitySelectedTextMarkerRangeAttribute];
+    [m_element accessibilitySetValue:(__bridge id)markerRange->platformTextMarkerRange() forAttribute:NSAccessibilitySelectedTextMarkerRangeAttribute];
     END_AX_OBJC_EXCEPTIONS
     
     return true;
@@ -1856,8 +1856,8 @@ bool AccessibilityUIElement::setSelectedVisibleTextRange(AccessibilityTextMarker
 AccessibilityTextMarkerRange AccessibilityUIElement::leftWordTextMarkerRangeForTextMarker(AccessibilityTextMarker* textMarker)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    id textMarkerRange = [m_element accessibilityAttributeValue:@"AXLeftWordTextMarkerRangeForTextMarker" forParameter:(id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarkerRange(textMarkerRange);
+    id textMarkerRange = [m_element accessibilityAttributeValue:@"AXLeftWordTextMarkerRangeForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
+    return AccessibilityTextMarkerRange((__bridge CFTypeRef)textMarkerRange);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1866,8 +1866,8 @@ AccessibilityTextMarkerRange AccessibilityUIElement::leftWordTextMarkerRangeForT
 AccessibilityTextMarkerRange AccessibilityUIElement::rightWordTextMarkerRangeForTextMarker(AccessibilityTextMarker* textMarker)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    id textMarkerRange = [m_element accessibilityAttributeValue:@"AXRightWordTextMarkerRangeForTextMarker" forParameter:(id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarkerRange(textMarkerRange);
+    id textMarkerRange = [m_element accessibilityAttributeValue:@"AXRightWordTextMarkerRangeForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
+    return AccessibilityTextMarkerRange((__bridge CFTypeRef)textMarkerRange);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1876,8 +1876,8 @@ AccessibilityTextMarkerRange AccessibilityUIElement::rightWordTextMarkerRangeFor
 AccessibilityTextMarker AccessibilityUIElement::previousWordStartTextMarkerForTextMarker(AccessibilityTextMarker* textMarker)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    id previousTextMarker = [m_element accessibilityAttributeValue:@"AXPreviousWordStartTextMarkerForTextMarker" forParameter:(id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarker(previousTextMarker);
+    id previousTextMarker = [m_element accessibilityAttributeValue:@"AXPreviousWordStartTextMarkerForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
+    return AccessibilityTextMarker((__bridge CFTypeRef)previousTextMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1886,8 +1886,8 @@ AccessibilityTextMarker AccessibilityUIElement::previousWordStartTextMarkerForTe
 AccessibilityTextMarker AccessibilityUIElement::nextWordEndTextMarkerForTextMarker(AccessibilityTextMarker* textMarker)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    id nextTextMarker = [m_element accessibilityAttributeValue:@"AXNextWordEndTextMarkerForTextMarker" forParameter:(id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarker(nextTextMarker);
+    id nextTextMarker = [m_element accessibilityAttributeValue:@"AXNextWordEndTextMarkerForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
+    return AccessibilityTextMarker((__bridge CFTypeRef)nextTextMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1896,8 +1896,8 @@ AccessibilityTextMarker AccessibilityUIElement::nextWordEndTextMarkerForTextMark
 AccessibilityTextMarkerRange AccessibilityUIElement::paragraphTextMarkerRangeForTextMarker(AccessibilityTextMarker* textMarker)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    id textMarkerRange = [m_element accessibilityAttributeValue:@"AXParagraphTextMarkerRangeForTextMarker" forParameter:(id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarkerRange(textMarkerRange);
+    id textMarkerRange = [m_element accessibilityAttributeValue:@"AXParagraphTextMarkerRangeForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
+    return AccessibilityTextMarkerRange((__bridge CFTypeRef)textMarkerRange);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1906,8 +1906,8 @@ AccessibilityTextMarkerRange AccessibilityUIElement::paragraphTextMarkerRangeFor
 AccessibilityTextMarker AccessibilityUIElement::previousParagraphStartTextMarkerForTextMarker(AccessibilityTextMarker* textMarker)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    id previousTextMarker = [m_element accessibilityAttributeValue:@"AXPreviousParagraphStartTextMarkerForTextMarker" forParameter:(id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarker(previousTextMarker);
+    id previousTextMarker = [m_element accessibilityAttributeValue:@"AXPreviousParagraphStartTextMarkerForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
+    return AccessibilityTextMarker((__bridge CFTypeRef)previousTextMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1916,8 +1916,8 @@ AccessibilityTextMarker AccessibilityUIElement::previousParagraphStartTextMarker
 AccessibilityTextMarker AccessibilityUIElement::nextParagraphEndTextMarkerForTextMarker(AccessibilityTextMarker* textMarker)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    id nextTextMarker = [m_element accessibilityAttributeValue:@"AXNextParagraphEndTextMarkerForTextMarker" forParameter:(id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarker(nextTextMarker);
+    id nextTextMarker = [m_element accessibilityAttributeValue:@"AXNextParagraphEndTextMarkerForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
+    return AccessibilityTextMarker((__bridge CFTypeRef)nextTextMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1926,8 +1926,8 @@ AccessibilityTextMarker AccessibilityUIElement::nextParagraphEndTextMarkerForTex
 AccessibilityTextMarkerRange AccessibilityUIElement::sentenceTextMarkerRangeForTextMarker(AccessibilityTextMarker* textMarker)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    id textMarkerRange = [m_element accessibilityAttributeValue:@"AXSentenceTextMarkerRangeForTextMarker" forParameter:(id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarkerRange(textMarkerRange);
+    id textMarkerRange = [m_element accessibilityAttributeValue:@"AXSentenceTextMarkerRangeForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
+    return AccessibilityTextMarkerRange((__bridge CFTypeRef)textMarkerRange);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1936,8 +1936,8 @@ AccessibilityTextMarkerRange AccessibilityUIElement::sentenceTextMarkerRangeForT
 AccessibilityTextMarker AccessibilityUIElement::previousSentenceStartTextMarkerForTextMarker(AccessibilityTextMarker* textMarker)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    id previousTextMarker = [m_element accessibilityAttributeValue:@"AXPreviousSentenceStartTextMarkerForTextMarker" forParameter:(id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarker(previousTextMarker);
+    id previousTextMarker = [m_element accessibilityAttributeValue:@"AXPreviousSentenceStartTextMarkerForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
+    return AccessibilityTextMarker((__bridge CFTypeRef)previousTextMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1946,8 +1946,8 @@ AccessibilityTextMarker AccessibilityUIElement::previousSentenceStartTextMarkerF
 AccessibilityTextMarker AccessibilityUIElement::nextSentenceEndTextMarkerForTextMarker(AccessibilityTextMarker* textMarker)
 {
     BEGIN_AX_OBJC_EXCEPTIONS
-    id nextTextMarker = [m_element accessibilityAttributeValue:@"AXNextSentenceEndTextMarkerForTextMarker" forParameter:(id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarker(nextTextMarker);
+    id nextTextMarker = [m_element accessibilityAttributeValue:@"AXNextSentenceEndTextMarkerForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
+    return AccessibilityTextMarker((__bridge CFTypeRef)nextTextMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
index 3d0a8a0..d9b84fc 100644 (file)
@@ -923,7 +923,7 @@ static void resetWebPreferencesToConsistentValues()
     [preferences setMetaRefreshEnabled:YES];
 
     if (persistentUserStyleSheetLocation) {
-        [preferences setUserStyleSheetLocation:[NSURL URLWithString:(NSString *)(persistentUserStyleSheetLocation.get())]];
+        [preferences setUserStyleSheetLocation:[NSURL URLWithString:(__bridge NSString *)persistentUserStyleSheetLocation.get()]];
         [preferences setUserStyleSheetEnabled:YES];
     } else
         [preferences setUserStyleSheetEnabled:NO];
@@ -1479,7 +1479,7 @@ static NSString *dumpFramesAsText(WebFrame *frame)
     // conversion methods cannot. After the conversion to a buffer, we turn that buffer into
     // a CFString via fromUTF8WithLatin1Fallback().createCFString() which can be appended to
     // the result without any conversion.
-    WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKStringCreateWithCFString((CFStringRef)innerText));
+    WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKStringCreateWithCFString((__bridge CFStringRef)innerText));
     size_t bufferSize = WKStringGetMaximumUTF8CStringSize(stringRef.get());
     auto buffer = std::make_unique<char[]>(bufferSize);
     size_t stringLength = WKStringGetUTF8CStringNonStrict(stringRef.get(), buffer.get(), bufferSize);
@@ -1612,10 +1612,7 @@ static const char *methodNameStringForFailedTest()
 
 static void dumpBackForwardListForAllWindows()
 {
-    CFArrayRef openWindows = (CFArrayRef)[DumpRenderTreeWindow openWindows];
-    unsigned count = CFArrayGetCount(openWindows);
-    for (unsigned i = 0; i < count; i++) {
-        NSWindow *window = (NSWindow *)CFArrayGetValueAtIndex(openWindows, i);
+    for (NSWindow *window in [DumpRenderTreeWindow openWindows]) {
 #if !PLATFORM(IOS)
         WebView *webView = [[[window contentView] subviews] objectAtIndex:0];
 #else
@@ -1693,11 +1690,11 @@ void dump()
             resultMimeType = @"application/pdf";
         } else if (gTestRunner->dumpDOMAsWebArchive()) {
             WebArchive *webArchive = [[mainFrame DOMDocument] webArchive];
-            resultString = CFBridgingRelease(WebCoreTestSupport::createXMLStringFromWebArchiveData((CFDataRef)[webArchive data]));
+            resultString = CFBridgingRelease(WebCoreTestSupport::createXMLStringFromWebArchiveData((__bridge CFDataRef)[webArchive data]));
             resultMimeType = @"application/x-webarchive";
         } else if (gTestRunner->dumpSourceAsWebArchive()) {
             WebArchive *webArchive = [[mainFrame dataSource] webArchive];
-            resultString = CFBridgingRelease(WebCoreTestSupport::createXMLStringFromWebArchiveData((CFDataRef)[webArchive data]));
+            resultString = CFBridgingRelease(WebCoreTestSupport::createXMLStringFromWebArchiveData((__bridge CFDataRef)[webArchive data]));
             resultMimeType = @"application/x-webarchive";
         } else
             resultString = [mainFrame renderTreeAsExternalRepresentationForPrinting:gTestRunner->isPrinting()];
@@ -1943,7 +1940,7 @@ static void runTest(const string& inputLine)
         testPath = [url absoluteString];
 
     NSString *informationString = [@"CRASHING TEST: " stringByAppendingString:testPath];
-    WebKit::setCrashReportApplicationSpecificInformation((CFStringRef)informationString);
+    WebKit::setCrashReportApplicationSpecificInformation((__bridge CFStringRef)informationString);
 
     TestOptions options { [url isFileURL] ? [url fileSystemRepresentation] : pathOrURL, command.absolutePath };
 
@@ -2085,7 +2082,7 @@ static void runTest(const string& inputLine)
 
     // We should only have our main window left open when we're done
     ASSERT(CFArrayGetCount(openWindowsRef) == 1);
-    ASSERT(CFArrayGetValueAtIndex(openWindowsRef, 0) == [[mainFrame webView] window]);
+    ASSERT(CFArrayGetValueAtIndex(openWindowsRef, 0) == (__bridge CFTypeRef)[[mainFrame webView] window]);
 
     gTestRunner->cleanup();
     gTestRunner = nullptr;
index cb897ae..cdd31b3 100644 (file)
 #import "config.h"
 #import "DumpRenderTreePasteboard.h"
 
-#import "DumpRenderTreeMac.h"
-
-#if !PLATFORM(IOS)
+#if PLATFORM(MAC)
 
+#import "DumpRenderTreeMac.h"
 #import <WebKit/WebTypesInternal.h>
+#import <objc/runtime.h>
 #import <wtf/Assertions.h>
 #import <wtf/HashMap.h>
 #import <wtf/ListHashSet.h>
@@ -46,8 +46,8 @@
     RetainPtr<NSString> _pasteboardName;
     NSInteger _changeCount;
 
-    ListHashSet<RetainPtr<NSString>, WTF::RetainPtrObjectHash<NSString>> _types;
-    HashMap<RetainPtr<NSString>, RetainPtr<NSData>, WTF::RetainPtrObjectHash<NSString>, WTF::RetainPtrObjectHashTraits<NSString>> _data;
+    ListHashSet<RetainPtr<CFStringRef>, WTF::RetainPtrObjectHash<CFStringRef>> _types;
+    HashMap<RetainPtr<CFStringRef>, RetainPtr<CFDataRef>, WTF::RetainPtrObjectHash<CFStringRef>, WTF::RetainPtrObjectHashTraits<CFStringRef>> _data;
 }
 
 -(id)initWithName:(NSString *)name;
@@ -93,7 +93,8 @@ static NSMutableDictionary *localPasteboards;
 
 + (id)alloc
 {
-    return NSAllocateObject(self, 0, 0);
+    // Need to skip NSPasteboard's alloc, which does not allocate an object.
+    return class_createInstance(self, 0);
 }
 
 - (id)initWithName:(NSString *)name
@@ -129,14 +130,14 @@ static bool isUTI(NSString *type)
     return UTTypeIsDynamic((__bridge CFStringRef)type) || UTTypeIsDeclared((__bridge CFStringRef)type);
 }
 
-static RetainPtr<NSString> toUTI(NSString *type)
+static RetainPtr<CFStringRef> toUTI(NSString *type)
 {
     if (isUTI(type)) {
-        // This is already an UTI.
-        return adoptNS([type copy]);
+        // This is already a UTI.
+        return adoptCF(CFStringCreateCopy(nullptr, (__bridge CFStringRef)type));
     }
 
-    return adoptNS((__bridge NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, (__bridge CFStringRef)type, nullptr));
+    return adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, (__bridge CFStringRef)type, nullptr));
 }
 
 - (NSInteger)addTypes:(NSArray *)newTypes owner:(id)newOwner
@@ -162,10 +163,10 @@ static RetainPtr<NSString> toUTI(NSString *type)
     auto types = adoptNS([[NSMutableArray alloc] init]);
 
     for (const auto& type : _types) {
-        [types addObject:type.get()];
+        [types addObject:(__bridge NSString *)type.get()];
 
         // Include the pasteboard type as well.
-        if (auto pasteboardType = adoptNS((__bridge NSString *)UTTypeCopyPreferredTagWithClass((CFStringRef)type.get(), kUTTagClassNSPboardType)))
+        if (auto pasteboardType = adoptNS((__bridge NSString *)UTTypeCopyPreferredTagWithClass(type.get(), kUTTagClassNSPboardType)))
             [types addObject:pasteboardType.get()];
     }
 
@@ -175,7 +176,7 @@ static RetainPtr<NSString> toUTI(NSString *type)
 - (NSString *)availableTypeFromArray:(NSArray *)types
 {
     for (NSString *type in types) {
-        if (_types.contains(type))
+        if (_types.contains((__bridge CFStringRef)type))
             return type;
     }
 
@@ -189,45 +190,32 @@ static RetainPtr<NSString> toUTI(NSString *type)
     if (!_types.contains(uti))
         return NO;
 
-    _data.set(WTFMove(uti), data ? data : [NSData data]);
+    _data.set(WTFMove(uti), (__bridge CFDataRef)(data ?: [NSData data]));
     return YES;
 }
 
 - (NSData *)dataForType:(NSString *)dataType
 {
-    if (NSData *data = _data.get(toUTI(dataType)).get())
+    if (NSData *data = (__bridge NSData *)_data.get(toUTI(dataType).get()).get())
         return data;
 
     if (_owner && [_owner respondsToSelector:@selector(pasteboard:provideDataForType:)])
         [_owner pasteboard:self provideDataForType:dataType];
 
-    return _data.get(toUTI(dataType)).get();
+    return (__bridge NSData *)_data.get(toUTI(dataType).get()).get();
 }
 
 - (BOOL)setPropertyList:(id)propertyList forType:(NSString *)dataType
 {
-    CFDataRef data = NULL;
+    NSData *data = nil;
     if (propertyList)
-        data = CFPropertyListCreateXMLData(NULL, propertyList);
-    BOOL result = [self setData:(NSData *)data forType:dataType];
-    if (data)
-        CFRelease(data);
-    return result;
+        data = [NSPropertyListSerialization dataWithPropertyList:propertyList format:NSPropertyListXMLFormat_v1_0 options:0 error:nullptr];
+    return [self setData:data forType:dataType];
 }
 
 - (BOOL)setString:(NSString *)string forType:(NSString *)dataType
 {
-    CFDataRef data = NULL;
-    if (string) {
-        if (!string.length)
-            data = CFDataCreate(NULL, NULL, 0);
-        else
-            data = CFStringCreateExternalRepresentation(NULL, (CFStringRef)string, kCFStringEncodingUTF8, 0);
-    }
-    BOOL result = [self setData:(NSData *)data forType:dataType];
-    if (data)
-        CFRelease(data);
-    return result;
+    return [self setData:[string dataUsingEncoding:NSUTF8StringEncoding] forType:dataType];
 }
 
 - (BOOL)writeObjects:(NSArray<id <NSPasteboardWriting>> *)objects
@@ -251,4 +239,4 @@ static RetainPtr<NSString> toUTI(NSString *type)
 
 @end
 
-#endif // !PLATFORM(IOS)
+#endif // PLATFORM(MAC)
index 7265dcd..ec959b7 100644 (file)
@@ -23,9 +23,6 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef MockGeolocationProvider_h
-#define MockGeolocationProvider_h
-
 #import <WebKit/WebViewPrivate.h>
 #import <wtf/HashSet.h>
 #import <wtf/RetainPtr.h>
@@ -35,7 +32,7 @@
     BOOL _hasError;
     RetainPtr<NSString> _errorMessage;
     NSTimer *_timer;
-    HashSet<WebView *> _registeredViews;
+    HashSet<CFTypeRef> _registeredViews;
 }
 
 + (MockGeolocationProvider *)shared;
@@ -47,4 +44,3 @@
 - (BOOL)isActive;
 
 @end
-#endif
index 17e6c46..1559aaa 100644 (file)
@@ -76,7 +76,7 @@
 
 - (void)registerWebView:(WebView *)webView
 {
-    _registeredViews.add(webView);
+    _registeredViews.add((__bridge CFTypeRef)webView);
 
     if (!_timer)
         _timer = [NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(timerFired) userInfo:0 repeats:NO];
@@ -84,7 +84,7 @@
 
 - (void)unregisterWebView:(WebView *)webView
 {
-    _registeredViews.remove(webView);
+    _registeredViews.remove((__bridge CFTypeRef)webView);
 }
 
 - (WebGeolocationPosition *)lastPosition
     _timer = 0;
 
     // Expect that views won't be (un)registered while iterating.
-    HashSet<WebView*> views = _registeredViews;
-    for (HashSet<WebView*>::iterator iter = views.begin(); iter != views.end(); ++iter) {
+    auto copyOfRegisteredViews { _registeredViews };
+    for (auto typelessView : copyOfRegisteredViews) {
+        auto webView = (__bridge WebView *)typelessView;
 #if !PLATFORM(IOS)
         if (_hasError)
-            [*iter _geolocationDidFailWithMessage:_errorMessage.get()];
+            [webView _geolocationDidFailWithMessage:_errorMessage.get()];
         else
-            [*iter _geolocationDidChangePosition:_lastPosition.get()];
+            [webView _geolocationDidChangePosition:_lastPosition.get()];
 #else
-        WebView* webView = *iter;
         WebGeolocationPosition *lastPosition = _lastPosition.get();
         NSString *errorMessage = _errorMessage.get();
         if (_hasError) {
index c4deb83..e46b32b 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef MockWebNotificationProvider_h
-#define MockWebNotificationProvider_h
-
 #import <WebKit/WebNotification.h>
 #import <WebKit/WebViewPrivate.h>
 #import <wtf/HashMap.h>
 #import <wtf/HashSet.h>
 #import <wtf/RetainPtr.h>
 
-typedef HashMap<uint64_t, RetainPtr<WebNotification> > NotificationIDMap;
-typedef HashMap<uint64_t, WebView *> NotificationViewMap;
+using NotificationIDMap = HashMap<uint64_t, RetainPtr<WebNotification>>;
+using NotificationViewMap = HashMap<uint64_t, CFTypeRef>;
 
 @interface MockWebNotificationProvider : NSObject <WebNotificationProvider> {
-    HashSet<WebView *> _registeredWebViews;
+    HashSet<CFTypeRef> _registeredWebViews;
     NotificationIDMap _notifications;
     NotificationViewMap _notificationViewMap;
     RetainPtr<NSMutableDictionary> _permissions;
@@ -54,5 +51,3 @@ typedef HashMap<uint64_t, WebView *> NotificationViewMap;
 
 - (void)reset;
 @end
-
-#endif // MockWebNotificationProvider_h
index 948d4bb..1ad453b 100644 (file)
 
 - (void)registerWebView:(WebView *)webView
 {
-    ASSERT(!_registeredWebViews.contains(webView));
-    _registeredWebViews.add(webView);
+    ASSERT(!_registeredWebViews.contains((__bridge CFTypeRef)webView));
+    _registeredWebViews.add((__bridge CFTypeRef)webView);
 }
 
 - (void)unregisterWebView:(WebView *)webView
 {
-    ASSERT(_registeredWebViews.contains(webView));
-    _registeredWebViews.remove(webView);
+    ASSERT(_registeredWebViews.contains((__bridge CFTypeRef)webView));
+    _registeredWebViews.remove((__bridge CFTypeRef)webView);
 }
 
 - (void)showNotification:(WebNotification *)notification fromWebView:(WebView *)webView
 {
-    ASSERT(_registeredWebViews.contains(webView));
+    ASSERT(_registeredWebViews.contains((__bridge CFTypeRef)webView));
 
     uint64_t notificationID = [notification notificationID];
     _notifications.add(notificationID, notification);
-    _notificationViewMap.add(notificationID, webView);
+    _notificationViewMap.add(notificationID, (__bridge CFTypeRef)webView);
 
     [webView _notificationDidShow:notificationID];
 }
@@ -75,7 +75,7 @@
     uint64_t notificationID = [notification notificationID];
     ASSERT(_notifications.contains(notificationID));
 
-    [_notificationViewMap.get(notificationID) _notificationsDidClose:[NSArray arrayWithObject:[NSNumber numberWithUnsignedLongLong:notificationID]]];
+    [(__bridge WebView *)_notificationViewMap.get(notificationID) _notificationsDidClose:[NSArray arrayWithObject:[NSNumber numberWithUnsignedLongLong:notificationID]]];
 }
 
 - (void)notificationDestroyed:(WebNotification *)notification
 - (void)simulateWebNotificationClick:(uint64_t)notificationID
 {
     ASSERT(_notifications.contains(notificationID));
-    [_notificationViewMap.get(notificationID) _notificationDidClick:notificationID];
+    [(__bridge WebView *)_notificationViewMap.get(notificationID) _notificationDidClick:notificationID];
 }
 
 - (WebNotificationPermission)policyForOrigin:(WebSecurityOrigin *)origin
index 58da347..f934b99 100644 (file)
@@ -116,7 +116,8 @@ static BOOL _allowsScriptsFullAccess = NO;
 
 - (id)retainObject:(id)obj
 {
-    return [obj retain];
+    CFRetain((__bridge CFTypeRef)obj);
+    return obj;
 }
 
 - (id)classOfObject:(id)obj
index 1f8a54a..0f90274 100644 (file)
@@ -145,10 +145,10 @@ void TestRunner::addDisallowedURL(JSStringRef url)
         disallowedURLs = CFSetCreateMutable(kCFAllocatorDefault, 0, NULL);
 
     // Canonicalize the URL
-    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:(NSString *)urlCF.get()]];
+    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:(__bridge NSString *)urlCF.get()]];
     request = [NSURLProtocol canonicalRequestForRequest:request];
 
-    CFSetAddValue(disallowedURLs, [request URL]);
+    CFSetAddValue(disallowedURLs, (__bridge CFURLRef)[request URL]);
 }
 
 bool TestRunner::callShouldCloseOnWebView()
@@ -164,7 +164,7 @@ void TestRunner::clearAllApplicationCaches()
 long long TestRunner::applicationCacheDiskUsageForOrigin(JSStringRef url)
 {
     RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, url));
-    WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:(NSString *)urlCF.get()]];
+    WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:(__bridge NSString *)urlCF.get()]];
     long long usage = [WebApplicationCache diskUsageForOrigin:origin];
     [origin release];
     return usage;
@@ -174,7 +174,7 @@ void TestRunner::clearApplicationCacheForOrigin(JSStringRef url)
 {
     RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, url));
 
-    WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:(NSString *)urlCF.get()]];
+    WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:(__bridge NSString *)urlCF.get()]];
     [WebApplicationCache deleteCacheForOrigin:origin];
     [origin release];
 }
@@ -187,7 +187,7 @@ JSValueRef originsArrayToJS(JSContextRef context, NSArray *origins)
     JSObjectRef arrayObj = JSValueToObject(context, arrayResult, 0);
     for (NSUInteger i = 0; i < count; i++) {
         NSString *origin = [[origins objectAtIndex:i] databaseIdentifier];
-        JSRetainPtr<JSStringRef> originJS(Adopt, JSStringCreateWithCFString((CFStringRef)origin));
+        JSRetainPtr<JSStringRef> originJS(Adopt, JSStringCreateWithCFString((__bridge CFStringRef)origin));
         JSObjectSetPropertyAtIndex(context, arrayObj, i, JSValueMakeString(context, originJS.get()), 0);
     }
 
@@ -252,15 +252,15 @@ void TestRunner::clearBackForwardList()
 JSStringRef TestRunner::copyDecodedHostName(JSStringRef name)
 {
     RetainPtr<CFStringRef> nameCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, name));
-    NSString *nameNS = (NSString *)nameCF.get();
-    return JSStringCreateWithCFString((CFStringRef)[nameNS _web_decodeHostName]);
+    NSString *nameNS = (__bridge NSString *)nameCF.get();
+    return JSStringCreateWithCFString((__bridge CFStringRef)[nameNS _web_decodeHostName]);
 }
 
 JSStringRef TestRunner::copyEncodedHostName(JSStringRef name)
 {
     RetainPtr<CFStringRef> nameCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, name));
-    NSString *nameNS = (NSString *)nameCF.get();
-    return JSStringCreateWithCFString((CFStringRef)[nameNS _web_encodeHostName]);
+    NSString *nameNS = (__bridge NSString *)nameCF.get();
+    return JSStringCreateWithCFString((__bridge CFStringRef)[nameNS _web_encodeHostName]);
 }
 
 void TestRunner::display()
@@ -378,7 +378,7 @@ JSStringRef TestRunner::pathToLocalResource(JSContextRef context, JSStringRef lo
 void TestRunner::queueLoad(JSStringRef url, JSStringRef target)
 {
     RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, url));
-    NSString *urlNS = (NSString *)urlCF.get();
+    NSString *urlNS = (__bridge NSString *)urlCF.get();
 
     NSURL *nsurl = [NSURL URLWithString:urlNS relativeToURL:[[[mainFrame dataSource] response] URL]];
     NSString *nsurlString = [nsurl absoluteString];
@@ -443,7 +443,7 @@ void TestRunner::setDefersLoading(bool defers)
 void TestRunner::setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme)
 {
     RetainPtr<CFStringRef> schemeCFString = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, scheme));
-    [WebView _setDomainRelaxationForbidden:forbidden forURLScheme:(NSString *)schemeCFString.get()];
+    [WebView _setDomainRelaxationForbidden:forbidden forURLScheme:(__bridge NSString *)schemeCFString.get()];
 }
 
 void TestRunner::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
@@ -483,7 +483,7 @@ void TestRunner::setMockGeolocationPosition(double latitude, double longitude, d
 void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef message)
 {
     RetainPtr<CFStringRef> messageCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, message));
-    NSString *messageNS = (NSString *)messageCF.get();
+    NSString *messageNS = (__bridge NSString *)messageCF.get();
     [[MockGeolocationProvider shared] setPositionUnavailableErrorWithMessage:messageNS];
 }
 
@@ -592,7 +592,7 @@ void TestRunner::setUserStyleSheetEnabled(bool flag)
 void TestRunner::setUserStyleSheetLocation(JSStringRef path)
 {
     RetainPtr<CFStringRef> pathCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, path));
-    NSURL *url = [NSURL URLWithString:(NSString *)pathCF.get()];
+    NSURL *url = [NSURL URLWithString:(__bridge NSString *)pathCF.get()];
     [[WebPreferences standardPreferences] setUserStyleSheetLocation:url];
 }
 
@@ -603,7 +603,7 @@ void TestRunner::setValueForUser(JSContextRef context, JSValueRef nodeObject, JS
         return;
 
     RetainPtr<CFStringRef> valueCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, value));
-    [(DOMHTMLInputElement *)element setValueForUser:(NSString *)valueCF.get()];
+    [(DOMHTMLInputElement *)element setValueForUser:(__bridge NSString *)valueCF.get()];
 }
 
 void TestRunner::dispatchPendingLoadRequests()
@@ -614,10 +614,10 @@ void TestRunner::dispatchPendingLoadRequests()
 void TestRunner::overridePreference(JSStringRef key, JSStringRef value)
 {
     RetainPtr<CFStringRef> keyCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, key));
-    NSString *keyNS = (NSString *)keyCF.get();
+    NSString *keyNS = (__bridge NSString *)keyCF.get();
 
     RetainPtr<CFStringRef> valueCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, value));
-    NSString *valueNS = (NSString *)valueCF.get();
+    NSString *valueNS = (__bridge NSString *)valueCF.get();
 
     [[WebPreferences standardPreferences] _setPreferenceForTestWithValue:valueNS forKey:keyNS];
 }
@@ -669,10 +669,10 @@ int TestRunner::windowCount()
 void TestRunner::execCommand(JSStringRef name, JSStringRef value)
 {
     RetainPtr<CFStringRef> nameCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, name));
-    NSString *nameNS = (NSString *)nameCF.get();
+    NSString *nameNS = (__bridge NSString *)nameCF.get();
 
     RetainPtr<CFStringRef> valueCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, value));
-    NSString *valueNS = (NSString *)valueCF.get();
+    NSString *valueNS = (__bridge NSString *)valueCF.get();
 
     [[mainFrame webView] _executeCoreCommandByName:nameNS value:valueNS];
 }
@@ -710,7 +710,7 @@ bool TestRunner::findString(JSContextRef context, JSStringRef target, JSObjectRe
             options |= WebFindOptionsStartInSelection;
     }
 
-    return [[mainFrame webView] findString:(NSString *)targetCFString.get() options:options];
+    return [[mainFrame webView] findString:(__bridge NSString *)targetCFString.get() options:options];
 }
 
 void TestRunner::setCacheModel(int cacheModel)
@@ -722,7 +722,7 @@ bool TestRunner::isCommandEnabled(JSStringRef name)
 {
 #if !PLATFORM(IOS)
     RetainPtr<CFStringRef> nameCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, name));
-    NSString *nameNS = (NSString *)nameCF.get();
+    NSString *nameNS = (__bridge NSString *)nameCF.get();
 
     // Accept command strings with capital letters for first letter without trailing colon.
     if (![nameNS hasSuffix:@":"] && [nameNS length]) {
@@ -756,22 +756,22 @@ void TestRunner::waitForPolicyDelegate()
 void TestRunner::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains)
 {
     RetainPtr<CFStringRef> sourceOriginCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, sourceOrigin));
-    NSString *sourceOriginNS = (NSString *)sourceOriginCF.get();
+    NSString *sourceOriginNS = (__bridge NSString *)sourceOriginCF.get();
     RetainPtr<CFStringRef> protocolCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, destinationProtocol));
-    NSString *destinationProtocolNS = (NSString *)protocolCF.get();
+    NSString *destinationProtocolNS = (__bridge NSString *)protocolCF.get();
     RetainPtr<CFStringRef> hostCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, destinationHost));
-    NSString *destinationHostNS = (NSString *)hostCF.get();
+    NSString *destinationHostNS = (__bridge NSString *)hostCF.get();
     [WebView _addOriginAccessWhitelistEntryWithSourceOrigin:sourceOriginNS destinationProtocol:destinationProtocolNS destinationHost:destinationHostNS allowDestinationSubdomains:allowDestinationSubdomains];
 }
 
 void TestRunner::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains)
 {
     RetainPtr<CFStringRef> sourceOriginCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, sourceOrigin));
-    NSString *sourceOriginNS = (NSString *)sourceOriginCF.get();
+    NSString *sourceOriginNS = (__bridge NSString *)sourceOriginCF.get();
     RetainPtr<CFStringRef> protocolCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, destinationProtocol));
-    NSString *destinationProtocolNS = (NSString *)protocolCF.get();
+    NSString *destinationProtocolNS = (__bridge NSString *)protocolCF.get();
     RetainPtr<CFStringRef> hostCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, destinationHost));
-    NSString *destinationHostNS = (NSString *)hostCF.get();
+    NSString *destinationHostNS = (__bridge NSString *)hostCF.get();
     [WebView _removeOriginAccessWhitelistEntryWithSourceOrigin:sourceOriginNS destinationProtocol:destinationProtocolNS destinationHost:destinationHostNS allowDestinationSubdomains:allowDestinationSubdomains];
 }
 
@@ -783,14 +783,14 @@ void TestRunner::setScrollbarPolicy(JSStringRef orientation, JSStringRef policy)
 void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFrames)
 {
     RetainPtr<CFStringRef> sourceCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, source));
-    NSString *sourceNS = (NSString *)sourceCF.get();
+    NSString *sourceNS = (__bridge NSString *)sourceCF.get();
     [WebView _addUserScriptToGroup:@"org.webkit.DumpRenderTree" world:[WebScriptWorld world] source:sourceNS url:nil whitelist:nil blacklist:nil injectionTime:(runAtStart ? WebInjectAtDocumentStart : WebInjectAtDocumentEnd) injectedFrames:(allFrames ? WebInjectInAllFrames : WebInjectInTopFrameOnly)];
 }
 
 void TestRunner::addUserStyleSheet(JSStringRef source, bool allFrames)
 {
     RetainPtr<CFStringRef> sourceCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, source));
-    NSString *sourceNS = (NSString *)sourceCF.get();
+    NSString *sourceNS = (__bridge NSString *)sourceCF.get();
     [WebView _addUserStyleSheetToGroup:@"org.webkit.DumpRenderTree" world:[WebScriptWorld world] source:sourceNS url:nil whitelist:nil blacklist:nil injectedFrames:(allFrames ? WebInjectInAllFrames : WebInjectInTopFrameOnly)];
 }
 
@@ -812,7 +812,7 @@ void TestRunner::closeWebInspector()
 void TestRunner::evaluateInWebInspector(JSStringRef script)
 {
     RetainPtr<CFStringRef> scriptCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, script));
-    NSString *scriptNS = (NSString *)scriptCF.get();
+    NSString *scriptNS = (__bridge NSString *)scriptCF.get();
     [[[mainFrame webView] inspector] evaluateInFrontend:nil script:scriptNS];
 }
 
@@ -863,7 +863,7 @@ void TestRunner::evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, J
 void TestRunner::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
 {
     RetainPtr<CFStringRef> scriptCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, script));
-    NSString *scriptNS = (NSString *)scriptCF.get();
+    NSString *scriptNS = (__bridge NSString *)scriptCF.get();
 
     // A worldID of 0 always corresponds to a new world. Any other worldID corresponds to a world
     // that is created once and cached forever.
@@ -1135,9 +1135,9 @@ void TestRunner::authenticateSession(JSStringRef url, JSStringRef username, JSSt
     RetainPtr<CFStringRef> usernameCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, username));
     RetainPtr<CFStringRef> passwordCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, password));
 
-    RetainPtr<NSURLRequest> request = adoptNS([[NSURLRequest alloc] initWithURL:[NSURL URLWithString:(NSString *)urlStringCF.get()]]);
+    RetainPtr<NSURLRequest> request = adoptNS([[NSURLRequest alloc] initWithURL:[NSURL URLWithString:(__bridge NSString *)urlStringCF.get()]]);
 
-    [SynchronousLoader makeRequest:request.get() withUsername:(NSString *)usernameCF.get() password:(NSString *)passwordCF.get()];
+    [SynchronousLoader makeRequest:request.get() withUsername:(__bridge NSString *)usernameCF.get() password:(__bridge NSString *)passwordCF.get()];
 }
 
 void TestRunner::abortModal()
@@ -1227,14 +1227,14 @@ void TestRunner::grantWebNotificationPermission(JSStringRef jsOrigin)
 {
     RetainPtr<CFStringRef> cfOrigin = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, jsOrigin));
     ASSERT([[mainFrame webView] _notificationProvider] == [MockWebNotificationProvider shared]);
-    [[MockWebNotificationProvider shared] setWebNotificationOrigin:(NSString *)cfOrigin.get() permission:TRUE];
+    [[MockWebNotificationProvider shared] setWebNotificationOrigin:(__bridge NSString *)cfOrigin.get() permission:TRUE];
 }
 
 void TestRunner::denyWebNotificationPermission(JSStringRef jsOrigin)
 {
     RetainPtr<CFStringRef> cfOrigin = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, jsOrigin));
     ASSERT([[mainFrame webView] _notificationProvider] == [MockWebNotificationProvider shared]);
-    [[MockWebNotificationProvider shared] setWebNotificationOrigin:(NSString *)cfOrigin.get() permission:FALSE];
+    [[MockWebNotificationProvider shared] setWebNotificationOrigin:(__bridge NSString *)cfOrigin.get() permission:FALSE];
 }
 
 void TestRunner::removeAllWebNotificationPermissions()
index 2175a01..231ab55 100644 (file)
@@ -251,10 +251,10 @@ static NSTextCheckingType nsTextCheckingType(JSRetainPtr<JSStringRef>&& jsType)
                 }
                 JSPropertyNameArrayRelease(detailsObjectProperties);
             }
-            [resultsForWord addObject:[[[LayoutTestTextCheckingResult alloc] initWithType:nsTextCheckingType(WTFMove(typeValue)) range:NSMakeRange(fromValue, toValue - fromValue) replacement:(NSString *)replacementText.get() details:details.get()] autorelease]];
+            [resultsForWord addObject:[[[LayoutTestTextCheckingResult alloc] initWithType:nsTextCheckingType(WTFMove(typeValue)) range:NSMakeRange(fromValue, toValue - fromValue) replacement:(__bridge NSString *)replacementText.get() details:details.get()] autorelease]];
         }
         auto cfTextToCheck = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, textToCheck));
-        [results setObject:resultsForWord.get() forKey:(NSString *)cfTextToCheck.get()];
+        [results setObject:resultsForWord.get() forKey:(__bridge NSString *)cfTextToCheck.get()];
         JSPropertyNameArrayRelease(resultsArrayPropertyNames);
     }
     JSPropertyNameArrayRelease(properties);
index 9e074d1..77dffb3 100644 (file)
@@ -1671,7 +1671,7 @@ RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::lineTextMarkerRange
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarkerRange = [m_element accessibilityAttributeValue:@"AXLineTextMarkerRangeForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarkerRange::create(textMarkerRange);
+    return AccessibilityTextMarkerRange::create((__bridge CFTypeRef)textMarkerRange);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1681,7 +1681,7 @@ RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::textMarkerRangeForE
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarkerRange = [m_element accessibilityAttributeValue:@"AXTextMarkerRangeForUIElement" forParameter:element->platformUIElement()];
-    return AccessibilityTextMarkerRange::create(textMarkerRange);
+    return AccessibilityTextMarkerRange::create((__bridge CFTypeRef)textMarkerRange);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1701,7 +1701,7 @@ RefPtr<AccessibilityTextMarker> AccessibilityUIElement::previousTextMarker(Acces
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id previousMarker = [m_element accessibilityAttributeValue:@"AXPreviousTextMarkerForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarker::create(previousMarker);
+    return AccessibilityTextMarker::create((__bridge CFTypeRef)previousMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1711,7 +1711,7 @@ RefPtr<AccessibilityTextMarker> AccessibilityUIElement::nextTextMarker(Accessibi
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id nextMarker = [m_element accessibilityAttributeValue:@"AXNextTextMarkerForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarker::create(nextMarker);
+    return AccessibilityTextMarker::create((__bridge CFTypeRef)nextMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1732,7 +1732,7 @@ RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::textMarkerRangeForM
     BEGIN_AX_OBJC_EXCEPTIONS
     NSArray* textMarkers = [NSArray arrayWithObjects:(__bridge id)startMarker->platformTextMarker(), (__bridge id)endMarker->platformTextMarker(), nil];
     id textMarkerRange = [m_element accessibilityAttributeValue:@"AXTextMarkerRangeForUnorderedTextMarkers" forParameter:textMarkers];
-    return AccessibilityTextMarkerRange::create(textMarkerRange);
+    return AccessibilityTextMarkerRange::create((__bridge CFTypeRef)textMarkerRange);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1742,7 +1742,7 @@ RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::selectedTextMarkerR
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarkerRange = [m_element accessibilityAttributeValue:NSAccessibilitySelectedTextMarkerRangeAttribute];
-    return AccessibilityTextMarkerRange::create(textMarkerRange);
+    return AccessibilityTextMarkerRange::create((__bridge CFTypeRef)textMarkerRange);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1768,7 +1768,7 @@ RefPtr<AccessibilityTextMarker> AccessibilityUIElement::startTextMarkerForTextMa
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarker = [m_element accessibilityAttributeValue:@"AXStartTextMarkerForTextMarkerRange" forParameter:(__bridge id)range->platformTextMarkerRange()];
-    return AccessibilityTextMarker::create(textMarker);
+    return AccessibilityTextMarker::create((__bridge CFTypeRef)textMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1778,7 +1778,7 @@ RefPtr<AccessibilityTextMarker> AccessibilityUIElement::endTextMarkerForTextMark
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarker = [m_element accessibilityAttributeValue:@"AXEndTextMarkerForTextMarkerRange" forParameter:(__bridge id)range->platformTextMarkerRange()];
-    return AccessibilityTextMarker::create(textMarker);
+    return AccessibilityTextMarker::create((__bridge CFTypeRef)textMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1788,7 +1788,7 @@ RefPtr<AccessibilityTextMarker> AccessibilityUIElement::endTextMarkerForBounds(i
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarker = [m_element accessibilityAttributeValue:NSAccessibilityEndTextMarkerForBoundsParameterizedAttribute forParameter:[NSValue valueWithRect:NSMakeRect(x, y, width, height)]];
-    return AccessibilityTextMarker::create(textMarker);
+    return AccessibilityTextMarker::create((__bridge CFTypeRef)textMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1798,7 +1798,7 @@ RefPtr<AccessibilityTextMarker> AccessibilityUIElement::startTextMarkerForBounds
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarker = [m_element accessibilityAttributeValue:NSAccessibilityStartTextMarkerForBoundsParameterizedAttribute forParameter:[NSValue valueWithRect:NSMakeRect(x, y, width, height)]];
-    return AccessibilityTextMarker::create(textMarker);
+    return AccessibilityTextMarker::create((__bridge CFTypeRef)textMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1808,7 +1808,7 @@ RefPtr<AccessibilityTextMarker> AccessibilityUIElement::textMarkerForPoint(int x
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarker = [m_element accessibilityAttributeValue:@"AXTextMarkerForPosition" forParameter:[NSValue valueWithPoint:NSMakePoint(x, y)]];
-    return AccessibilityTextMarker::create(textMarker);
+    return AccessibilityTextMarker::create((__bridge CFTypeRef)textMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1917,7 +1917,7 @@ RefPtr<AccessibilityTextMarker> AccessibilityUIElement::textMarkerForIndex(int t
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarker = [m_element accessibilityAttributeValue:@"AXTextMarkerForIndex" forParameter:[NSNumber numberWithInteger:textIndex]];
-    return AccessibilityTextMarker::create(textMarker);
+    return AccessibilityTextMarker::create((__bridge CFTypeRef)textMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1927,7 +1927,7 @@ RefPtr<AccessibilityTextMarker> AccessibilityUIElement::startTextMarker()
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarker = [m_element accessibilityAttributeValue:@"AXStartTextMarker"];
-    return AccessibilityTextMarker::create(textMarker);
+    return AccessibilityTextMarker::create((__bridge CFTypeRef)textMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1937,7 +1937,7 @@ RefPtr<AccessibilityTextMarker> AccessibilityUIElement::endTextMarker()
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarker = [m_element accessibilityAttributeValue:@"AXEndTextMarker"];
-    return AccessibilityTextMarker::create(textMarker);
+    return AccessibilityTextMarker::create((__bridge CFTypeRef)textMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1947,7 +1947,7 @@ RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::leftWordTextMarkerR
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarkerRange = [m_element accessibilityAttributeValue:@"AXLeftWordTextMarkerRangeForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarkerRange::create(textMarkerRange);
+    return AccessibilityTextMarkerRange::create((__bridge CFTypeRef)textMarkerRange);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1957,7 +1957,7 @@ RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::rightWordTextMarker
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarkerRange = [m_element accessibilityAttributeValue:@"AXRightWordTextMarkerRangeForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarkerRange::create(textMarkerRange);
+    return AccessibilityTextMarkerRange::create((__bridge CFTypeRef)textMarkerRange);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1967,7 +1967,7 @@ RefPtr<AccessibilityTextMarker> AccessibilityUIElement::previousWordStartTextMar
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id previousWordStartMarker = [m_element accessibilityAttributeValue:@"AXPreviousWordStartTextMarkerForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarker::create(previousWordStartMarker);
+    return AccessibilityTextMarker::create((__bridge CFTypeRef)previousWordStartMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1977,7 +1977,7 @@ RefPtr<AccessibilityTextMarker> AccessibilityUIElement::nextWordEndTextMarkerFor
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id nextWordEndMarker = [m_element accessibilityAttributeValue:@"AXNextWordEndTextMarkerForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarker::create(nextWordEndMarker);
+    return AccessibilityTextMarker::create((__bridge CFTypeRef)nextWordEndMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1987,7 +1987,7 @@ RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::paragraphTextMarker
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarkerRange = [m_element accessibilityAttributeValue:@"AXParagraphTextMarkerRangeForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarkerRange::create(textMarkerRange);
+    return AccessibilityTextMarkerRange::create((__bridge CFTypeRef)textMarkerRange);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -1997,7 +1997,7 @@ RefPtr<AccessibilityTextMarker> AccessibilityUIElement::previousParagraphStartTe
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id previousParagraphStartMarker = [m_element accessibilityAttributeValue:@"AXPreviousParagraphStartTextMarkerForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarker::create(previousParagraphStartMarker);
+    return AccessibilityTextMarker::create((__bridge CFTypeRef)previousParagraphStartMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -2007,7 +2007,7 @@ RefPtr<AccessibilityTextMarker> AccessibilityUIElement::nextParagraphEndTextMark
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id nextParagraphEndMarker = [m_element accessibilityAttributeValue:@"AXNextParagraphEndTextMarkerForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarker::create(nextParagraphEndMarker);
+    return AccessibilityTextMarker::create((__bridge CFTypeRef)nextParagraphEndMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -2017,7 +2017,7 @@ RefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::sentenceTextMarkerR
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id textMarkerRange = [m_element accessibilityAttributeValue:@"AXSentenceTextMarkerRangeForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarkerRange::create(textMarkerRange);
+    return AccessibilityTextMarkerRange::create((__bridge CFTypeRef)textMarkerRange);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -2027,7 +2027,7 @@ RefPtr<AccessibilityTextMarker> AccessibilityUIElement::previousSentenceStartTex
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id previousParagraphStartMarker = [m_element accessibilityAttributeValue:@"AXPreviousSentenceStartTextMarkerForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarker::create(previousParagraphStartMarker);
+    return AccessibilityTextMarker::create((__bridge CFTypeRef)previousParagraphStartMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
@@ -2037,7 +2037,7 @@ RefPtr<AccessibilityTextMarker> AccessibilityUIElement::nextSentenceEndTextMarke
 {
     BEGIN_AX_OBJC_EXCEPTIONS
     id nextParagraphEndMarker = [m_element accessibilityAttributeValue:@"AXNextSentenceEndTextMarkerForTextMarker" forParameter:(__bridge id)textMarker->platformTextMarker()];
-    return AccessibilityTextMarker::create(nextParagraphEndMarker);
+    return AccessibilityTextMarker::create((__bridge CFTypeRef)nextParagraphEndMarker);
     END_AX_OBJC_EXCEPTIONS
     
     return nullptr;
index 313dbcd..edd7c4d 100644 (file)
@@ -62,6 +62,7 @@ list(APPEND WebKitTestRunner_SOURCES
     ${WEBKIT_TESTRUNNER_DIR}/mac/WebKitTestRunnerDraggingInfo.mm
     ${WEBKIT_TESTRUNNER_DIR}/mac/WebKitTestRunnerEvent.mm
     ${WEBKIT_TESTRUNNER_DIR}/mac/WebKitTestRunnerPasteboard.mm
+    ${WEBKIT_TESTRUNNER_DIR}/mac/WebKitTestRunnerWindow.mm
     ${WEBKIT_TESTRUNNER_DIR}/mac/main.mm
     
     ${WEBKIT_TESTRUNNER_SHARED_DIR}/EventSerialization/mac/EventSerializerMac.mm
index 1940f5b..1c6c474 100644 (file)
                65EB85A011EC67CC0034D300 /* ActivateFontsCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65EB859F11EC67CC0034D300 /* ActivateFontsCocoa.mm */; };
                8034C6621487636400AC32E9 /* AccessibilityControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8034C6611487636400AC32E9 /* AccessibilityControllerMac.mm */; };
                8097338A14874A5A008156D9 /* AccessibilityNotificationHandler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8097338914874A5A008156D9 /* AccessibilityNotificationHandler.mm */; };
+               9376417A210D737200A3DAAE /* WebKitTestRunnerWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93764176210D736000A3DAAE /* WebKitTestRunnerWindow.mm */; };
                A185103A1B9AE0DA00744AEB /* CrashReporterInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FEB90A31905BC6A000FDBF3 /* CrashReporterInfo.mm */; };
                A185103B1B9AE0E200744AEB /* TestControllerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DCE2CD11B84524500C7F832 /* TestControllerCocoa.mm */; };
                A185103C1B9AE0FE00744AEB /* Options.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 841CC00D181185BF0042E9B6 /* Options.cpp */; };
                841CC00D181185BF0042E9B6 /* Options.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Options.cpp; sourceTree = "<group>"; };
                841CC00E181185BF0042E9B6 /* Options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Options.h; sourceTree = "<group>"; };
                8DD76FA10486AA7600D96B5E /* WebKitTestRunner */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = WebKitTestRunner; sourceTree = BUILT_PRODUCTS_DIR; };
+               93764176210D736000A3DAAE /* WebKitTestRunnerWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKitTestRunnerWindow.mm; sourceTree = "<group>"; };
+               93764177210D736100A3DAAE /* WebKitTestRunnerWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitTestRunnerWindow.h; sourceTree = "<group>"; };
                9B0D132E2036D346008FC8FB /* WebKitTestRunnerApp-iOS.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = "WebKitTestRunnerApp-iOS.entitlements"; sourceTree = "<group>"; };
                9B36A270209453A0003E0651 /* WhatToDump.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WhatToDump.h; sourceTree = "<group>"; };
                A18510271B9ADE4800744AEB /* libWebKitTestRunner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libWebKitTestRunner.a; sourceTree = BUILT_PRODUCTS_DIR; };
                                E132AA3B17CE776F00611DF0 /* WebKitTestRunnerEvent.mm */,
                                E1C642C517CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.h */,
                                E1C642C417CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.mm */,
+                               93764177210D736100A3DAAE /* WebKitTestRunnerWindow.h */,
+                               93764176210D736000A3DAAE /* WebKitTestRunnerWindow.mm */,
                        );
                        path = mac;
                        sourceTree = "<group>";
                                E132AA3A17CD5F1000611DF0 /* WebKitTestRunnerDraggingInfo.mm in Sources */,
                                E132AA3D17CE776F00611DF0 /* WebKitTestRunnerEvent.mm in Sources */,
                                E1C642C617CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.mm in Sources */,
+                               9376417A210D737200A3DAAE /* WebKitTestRunnerWindow.mm in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index ac9ae01..e219485 100644 (file)
     CGPoint _fakeOrigin;
     BOOL _initialized;
 }
-@property (nonatomic, assign) WTR::PlatformWebView* platformWebView;
+@property (nonatomic) WTR::PlatformWebView* platformWebView;
 @end
 
-static Vector<WebKitTestRunnerWindow*> allWindows;
+static Vector<WebKitTestRunnerWindow *> allWindows;
 
 @implementation WebKitTestRunnerWindow
 @synthesize platformWebView = _platformWebView;
index 790f635..46584ff 100644 (file)
@@ -31,6 +31,7 @@
 #import "StringFunctions.h"
 #import "TestController.h"
 #import "TestRunnerWKWebView.h"
+#import "WebKitTestRunnerWindow.h"
 #import <Carbon/Carbon.h>
 #import <WebKit/WKString.h>
 #import <WebKit/WKPagePrivate.h>
index ddd5749..f6cb2a0 100644 (file)
@@ -29,6 +29,7 @@
 #import "TestController.h"
 #import "TestRunnerWKWebView.h"
 #import "WebKitTestRunnerDraggingInfo.h"
+#import "WebKitTestRunnerWindow.h"
 #import <WebKit/WKImageCG.h>
 #import <WebKit/WKPreferencesPrivate.h>
 #import <WebKit/WKWebViewConfiguration.h>
 #import <wtf/mac/AppKitCompatibilityDeclarations.h>
 
 #if WK_API_ENABLED
-@interface WKWebView (Details)
+@interface WKWebView ()
 - (WKPageRef)_pageForTesting;
 @end
 #endif
 
 using namespace WTR;
 
+// FIXME: Move to NSWindowSPI.h.
 enum {
     _NSBackingStoreUnbuffered = 3
 };
 
-@interface WebKitTestRunnerWindow : NSWindow {
-    PlatformWebView* _platformWebView;
-    NSPoint _fakeOrigin;
-}
-@property (nonatomic, assign) PlatformWebView* platformWebView;
-@end
-
-static Vector<WebKitTestRunnerWindow*> allWindows;
-
-@implementation WebKitTestRunnerWindow
-@synthesize platformWebView = _platformWebView;
-
-+ (NSWindow *)_WTR_keyWindow
-{
-    size_t i = allWindows.size();
-    while (i) {
-        if ([allWindows[i] isKeyWindow])
-            return allWindows[i];
-        --i;
-    }
-
-    return nil;
-}
-
-- (instancetype)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation
-{
-    allWindows.append(self);
-    return [super initWithContentRect:contentRect styleMask:windowStyle backing:bufferingType defer:deferCreation];
-}
-
-- (void)dealloc
-{
-    allWindows.removeFirst(self);
-    ASSERT(!allWindows.contains(self));
-    [super dealloc];
-}
-
-- (BOOL)isKeyWindow
-{
-    return _platformWebView ? _platformWebView->windowIsKey() : YES;
-}
-
-- (void)setFrameOrigin:(NSPoint)point
-{
-    _fakeOrigin = point;
-}
-
-- (void)setFrame:(NSRect)windowFrame display:(BOOL)displayViews animate:(BOOL)performAnimation
-{
-    NSRect currentFrame = [super frame];
-
-    _fakeOrigin = windowFrame.origin;
-
-    [super setFrame:NSMakeRect(currentFrame.origin.x, currentFrame.origin.y, windowFrame.size.width, windowFrame.size.height) display:displayViews animate:performAnimation];
-}
-
-- (void)setFrame:(NSRect)windowFrame display:(BOOL)displayViews
-{
-    NSRect currentFrame = [super frame];
-
-    _fakeOrigin = windowFrame.origin;
-
-    [super setFrame:NSMakeRect(currentFrame.origin.x, currentFrame.origin.y, windowFrame.size.width, windowFrame.size.height) display:displayViews];
-}
-
-- (NSRect)frameRespectingFakeOrigin
-{
-    NSRect currentFrame = [self frame];
-    return NSMakeRect(_fakeOrigin.x, _fakeOrigin.y, currentFrame.size.width, currentFrame.size.height);
-}
-@end
-
+// FIXME: Move to NSWindowSPI.h.
 @interface NSWindow ()
-
 - (void)_setWindowResolution:(CGFloat)resolution displayIfChanged:(BOOL)displayIfChanged;
-
 @end
 
 namespace WTR {
@@ -187,14 +116,7 @@ PlatformWebView::~PlatformWebView()
 
 PlatformWindow PlatformWebView::keyWindow()
 {
-    size_t i = allWindows.size();
-    while (i) {
-        --i;
-        if ([allWindows[i] isKeyWindow])
-            return allWindows[i];
-    }
-
-    return nil;
+    return [WebKitTestRunnerWindow _WTR_keyWindow];
 }
 
 WKPageRef PlatformWebView::page()
index 9dea2df..f547fd1 100644 (file)
 #import "WebKitTestRunnerEvent.h"
 
 #import "EventSenderProxy.h"
-#import "TestController.h"
 #import "PlatformWebView.h"
-
-using namespace WTR;
+#import "TestController.h"
+#import "WebKitTestRunnerWindow.h"
 
 @implementation WebKitTestRunnerEvent
 
 + (NSPoint)mouseLocation
 {
-    WKPoint location = TestController::singleton().eventSenderProxy()->position();
-    return [TestController::singleton().mainWebView()->platformWindow() convertBaseToScreen:NSMakePoint(location.x, location.y)];
+    WKPoint location = WTR::TestController::singleton().eventSenderProxy()->position();
+    return [WTR::TestController::singleton().mainWebView()->platformWindow() convertBaseToScreen:NSMakePoint(location.x, location.y)];
 }
 
 @end
index a26180e..abcdf41 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006, 2007, 2013 Apple, Inc.  All rights reserved.
+ * Copyright (C) 2005-2018 Apple, Inc.  All rights reserved.
  * Copyright (C) 2007 Graham Dennis (graham.dennis@gmail.com)
  * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
  *
@@ -28,6 +28,8 @@
 #include "config.h"
 #include "WebKitTestRunnerPasteboard.h"
 
+#include <objc/runtime.h>
+
 @interface LocalPasteboard : NSPasteboard
 {
     NSMutableArray *typesArray;
@@ -86,7 +88,8 @@ static NSMutableDictionary *localPasteboards;
 
 + (id)alloc
 {
-    return NSAllocateObject(self, 0, 0);
+    // Need to skip over [NSPasteboard alloc], which won't allocate a new object.
+    return class_createInstance(self, 0);
 }
 
 - (id)initWithName:(NSString *)name
@@ -158,12 +161,8 @@ static NSMutableDictionary *localPasteboards;
 
 - (NSString *)availableTypeFromArray:(NSArray *)types
 {
-    unsigned count = [types count];
-    unsigned i;
-    for (i = 0; i < count; ++i) {
-        NSString *type = [types objectAtIndex:i];
-        NSString *setType = [typesSet member:type];
-        if (setType)
+    for (NSString *type in types) {
+        if (NSString *setType = [typesSet member:type])
             return setType;
     }
     return nil;
@@ -171,10 +170,10 @@ static NSMutableDictionary *localPasteboards;
 
 - (BOOL)setData:(NSData *)data forType:(NSString *)dataType
 {
-    if (data == nil)
-        data = [NSData data];
     if (![typesSet containsObject:dataType])
         return NO;
+    if (!data)
+        data = [NSData data];
     [dataByType setObject:data forKey:dataType];
     ++changeCount;
     return YES;
@@ -187,28 +186,15 @@ static NSMutableDictionary *localPasteboards;
 
 - (BOOL)setPropertyList:(id)propertyList forType:(NSString *)dataType
 {
-    CFDataRef data = 0;
+    NSData *data = nil;
     if (propertyList)
-        data = CFPropertyListCreateXMLData(0, (__bridge CFTypeRef)propertyList);
-    BOOL result = [self setData:(__bridge NSData *)data forType:dataType];
-    if (data)
-        CFRelease(data);
-    return result;
+        data = [NSPropertyListSerialization dataWithPropertyList:propertyList format:NSPropertyListXMLFormat_v1_0 options:0 error:nullptr];
+    return [self setData:data forType:dataType];
 }
 
 - (BOOL)setString:(NSString *)string forType:(NSString *)dataType
 {
-    CFDataRef data = 0;
-    if (string) {
-        if ([string length] == 0)
-            data = CFDataCreate(0, 0, 0);
-        else
-            data = CFStringCreateExternalRepresentation(0, (CFStringRef)string, kCFStringEncodingUTF8, 0);
-    }
-    BOOL result = [self setData:(__bridge NSData *)data forType:dataType];
-    if (data)
-        CFRelease(data);
-    return result;
+    return [self setData:[string dataUsingEncoding:NSUTF8StringEncoding] forType:dataType];
 }
 
 @end
diff --git a/Tools/WebKitTestRunner/mac/WebKitTestRunnerWindow.h b/Tools/WebKitTestRunner/mac/WebKitTestRunnerWindow.h
new file mode 100644 (file)
index 0000000..599343e
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2013-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
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+namespace WTR {
+class PlatformWebView;
+}
+
+@interface WebKitTestRunnerWindow : NSWindow {
+    WTR::PlatformWebView* _platformWebView;
+    NSPoint _fakeOrigin;
+}
+
++ (WebKitTestRunnerWindow *)_WTR_keyWindow;
+
+@property (nonatomic, assign) WTR::PlatformWebView* platformWebView;
+- (NSRect)frameRespectingFakeOrigin;
+
+@end
diff --git a/Tools/WebKitTestRunner/mac/WebKitTestRunnerWindow.mm b/Tools/WebKitTestRunner/mac/WebKitTestRunnerWindow.mm
new file mode 100644 (file)
index 0000000..b45995a
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2013-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
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "WebKitTestRunnerWindow.h"
+
+#import "PlatformWebView.h"
+#import <wtf/Vector.h>
+
+@implementation WebKitTestRunnerWindow
+
+static Vector<WebKitTestRunnerWindow *> allWindows;
+
+@synthesize platformWebView = _platformWebView;
+
++ (WebKitTestRunnerWindow *)_WTR_keyWindow
+{
+    for (auto window : allWindows) {
+        if ([window isKeyWindow])
+            return window;
+    }
+    return nil;
+}
+
+- (instancetype)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation
+{
+    allWindows.append(self);
+    return [super initWithContentRect:contentRect styleMask:windowStyle backing:bufferingType defer:deferCreation];
+}
+
+- (void)dealloc
+{
+    allWindows.removeFirst(self);
+    ASSERT(!allWindows.contains(self));
+    [super dealloc];
+}
+
+- (BOOL)isKeyWindow
+{
+    return !_platformWebView || _platformWebView->windowIsKey();
+}
+
+- (void)setFrameOrigin:(NSPoint)point
+{
+    _fakeOrigin = point;
+}
+
+- (void)setFrame:(NSRect)windowFrame display:(BOOL)displayViews animate:(BOOL)performAnimation
+{
+    NSRect currentFrame = [super frame];
+    _fakeOrigin = windowFrame.origin;
+    [super setFrame:NSMakeRect(currentFrame.origin.x, currentFrame.origin.y, windowFrame.size.width, windowFrame.size.height) display:displayViews animate:performAnimation];
+}
+
+- (void)setFrame:(NSRect)windowFrame display:(BOOL)displayViews
+{
+    NSRect currentFrame = [super frame];
+    _fakeOrigin = windowFrame.origin;
+    [super setFrame:NSMakeRect(currentFrame.origin.x, currentFrame.origin.y, windowFrame.size.width, windowFrame.size.height) display:displayViews];
+}
+
+- (NSRect)frameRespectingFakeOrigin
+{
+    NSRect currentFrame = [self frame];
+    return NSMakeRect(_fakeOrigin.x, _fakeOrigin.y, currentFrame.size.width, currentFrame.size.height);
+}
+
+@end