Drop remaining uses of PassRefPtr in WebKit2/WebProcess
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 May 2017 01:55:14 +0000 (01:55 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 May 2017 01:55:14 +0000 (01:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172055

Reviewed by Alex Christensen.

* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.mm:
(+[WKWebProcessPlugInScriptWorld normalWorld]):
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(contextMenuItems):
* WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp:
(WKBundleScriptWorldNormalWorld):
* WebProcess/InjectedBundle/API/gtk/WebKitScriptWorld.cpp:
(webkitScriptWorldCreate):
* WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.cpp:
(WebKit::InjectedBundleCSSStyleDeclarationHandle::getOrCreate):
* WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.h:
* WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
(WebKit::InjectedBundleRangeHandle::getOrCreate):
(WebKit::InjectedBundleRangeHandle::create):
(WebKit::InjectedBundleRangeHandle::coreRange):
(WebKit::InjectedBundleRangeHandle::renderedImage):
* WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::create):
(WebKit::InjectedBundle::createWebDataFromUint8Array):
* WebProcess/InjectedBundle/InjectedBundle.h:
* WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp:
(WebKit::InjectedBundleBackForwardList::itemAtIndex):
* WebProcess/InjectedBundle/InjectedBundleBackForwardList.h:
(WebKit::InjectedBundleBackForwardList::detach):
* WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.h:
(WebKit::InjectedBundleBackForwardListItem::create):
(WebKit::InjectedBundleBackForwardListItem::InjectedBundleBackForwardListItem):
* WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp:
(WebKit::InjectedBundleHitTestResult::nodeHandle):
(WebKit::InjectedBundleHitTestResult::urlElementHandle):
* WebProcess/InjectedBundle/InjectedBundleHitTestResult.h:
* WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
(WebKit::InjectedBundleNavigationAction::create):
(WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction):
* WebProcess/InjectedBundle/InjectedBundleNavigationAction.h:
* WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:
(WebKit::InjectedBundleScriptWorld::getOrCreate):
(WebKit::InjectedBundleScriptWorld::normalWorld):
* WebProcess/InjectedBundle/InjectedBundleScriptWorld.h:
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::create):
(WebKit::NetscapePlugin::NetscapePlugin):
(WebKit::NetscapePlugin::supportsSnapshotting):
* WebProcess/Plugins/Netscape/NetscapePlugin.h:
* WebProcess/Plugins/PDF/PDFPluginAnnotation.h:
* WebProcess/Plugins/PDF/PDFPluginAnnotation.mm:
(WebKit::PDFPluginAnnotation::create):
* WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.h:
* WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
(WebKit::PDFPluginChoiceAnnotation::createAnnotationElement):
* WebProcess/Plugins/PDF/PDFPluginPasswordField.h:
* WebProcess/Plugins/PDF/PDFPluginPasswordField.mm:
(WebKit::PDFPluginPasswordField::createAnnotationElement):
* WebProcess/Plugins/PDF/PDFPluginTextAnnotation.h:
* WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
(WebKit::PDFPluginTextAnnotation::createAnnotationElement):
* WebProcess/UserContent/WebUserContentController.cpp:
(WebKit::worldMap):
(WebKit::WebUserMessageHandlerDescriptorProxy::create):
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::convertImageToBitmap):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::addUserScript):
(WebKit::WebPage::addUserStyleSheet):
* WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
(WebKit::WebPrintOperationGtk::create):
* WebProcess/WebPage/gtk/WebPrintOperationGtk.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::rangeForPosition):
(WebKit::rangeAtWordBoundaryForPosition):
* WebProcess/WebPage/mac/PlatformCAAnimationRemote.h:

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

44 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/APIWebArchive.h
Source/WebKit2/Shared/APIWebArchive.mm
Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm
Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.mm
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitScriptWorld.cpp
Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.cpp
Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.h
Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp
Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h
Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginAnnotation.h
Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginAnnotation.mm
Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.h
Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm
Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginPasswordField.h
Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginPasswordField.mm
Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.h
Source/WebKit2/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm
Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp
Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp
Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.h
Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm
Source/WebKit2/WebProcess/WebPage/mac/PlatformCAAnimationRemote.h
Source/WebKit2/WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm

index 8ea4155..b0e8b08 100644 (file)
@@ -1,3 +1,83 @@
+2017-05-12  Chris Dumez  <cdumez@apple.com>
+
+        Drop remaining uses of PassRefPtr in WebKit2/WebProcess
+        https://bugs.webkit.org/show_bug.cgi?id=172055
+
+        Reviewed by Alex Christensen.
+
+        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInScriptWorld.mm:
+        (+[WKWebProcessPlugInScriptWorld normalWorld]):
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+        (contextMenuItems):
+        * WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp:
+        (WKBundleScriptWorldNormalWorld):
+        * WebProcess/InjectedBundle/API/gtk/WebKitScriptWorld.cpp:
+        (webkitScriptWorldCreate):
+        * WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.cpp:
+        (WebKit::InjectedBundleCSSStyleDeclarationHandle::getOrCreate):
+        * WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.h:
+        * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
+        (WebKit::InjectedBundleRangeHandle::getOrCreate):
+        (WebKit::InjectedBundleRangeHandle::create):
+        (WebKit::InjectedBundleRangeHandle::coreRange):
+        (WebKit::InjectedBundleRangeHandle::renderedImage):
+        * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::create):
+        (WebKit::InjectedBundle::createWebDataFromUint8Array):
+        * WebProcess/InjectedBundle/InjectedBundle.h:
+        * WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp:
+        (WebKit::InjectedBundleBackForwardList::itemAtIndex):
+        * WebProcess/InjectedBundle/InjectedBundleBackForwardList.h:
+        (WebKit::InjectedBundleBackForwardList::detach):
+        * WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.h:
+        (WebKit::InjectedBundleBackForwardListItem::create):
+        (WebKit::InjectedBundleBackForwardListItem::InjectedBundleBackForwardListItem):
+        * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp:
+        (WebKit::InjectedBundleHitTestResult::nodeHandle):
+        (WebKit::InjectedBundleHitTestResult::urlElementHandle):
+        * WebProcess/InjectedBundle/InjectedBundleHitTestResult.h:
+        * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
+        (WebKit::InjectedBundleNavigationAction::create):
+        (WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction):
+        * WebProcess/InjectedBundle/InjectedBundleNavigationAction.h:
+        * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:
+        (WebKit::InjectedBundleScriptWorld::getOrCreate):
+        (WebKit::InjectedBundleScriptWorld::normalWorld):
+        * WebProcess/InjectedBundle/InjectedBundleScriptWorld.h:
+        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+        (WebKit::NetscapePlugin::create):
+        (WebKit::NetscapePlugin::NetscapePlugin):
+        (WebKit::NetscapePlugin::supportsSnapshotting):
+        * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+        * WebProcess/Plugins/PDF/PDFPluginAnnotation.h:
+        * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm:
+        (WebKit::PDFPluginAnnotation::create):
+        * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.h:
+        * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
+        (WebKit::PDFPluginChoiceAnnotation::createAnnotationElement):
+        * WebProcess/Plugins/PDF/PDFPluginPasswordField.h:
+        * WebProcess/Plugins/PDF/PDFPluginPasswordField.mm:
+        (WebKit::PDFPluginPasswordField::createAnnotationElement):
+        * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.h:
+        * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
+        (WebKit::PDFPluginTextAnnotation::createAnnotationElement):
+        * WebProcess/UserContent/WebUserContentController.cpp:
+        (WebKit::worldMap):
+        (WebKit::WebUserMessageHandlerDescriptorProxy::create):
+        * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
+        (WebKit::convertImageToBitmap):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::addUserScript):
+        (WebKit::WebPage::addUserStyleSheet):
+        * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
+        (WebKit::WebPrintOperationGtk::create):
+        * WebProcess/WebPage/gtk/WebPrintOperationGtk.h:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::rangeForPosition):
+        (WebKit::rangeAtWordBoundaryForPosition):
+        * WebProcess/WebPage/mac/PlatformCAAnimationRemote.h:
+
 2017-05-12  Alex Christensen  <achristensen@webkit.org>
 
         Rename WKContentExtension to WKContentRuleList
index 8375777..71de28b 100644 (file)
@@ -52,7 +52,7 @@ public:
     static Ref<WebArchive> create(WebArchiveResource* mainResource, RefPtr<API::Array>&& subresources, RefPtr<API::Array>&& subframeArchives);
     static Ref<WebArchive> create(API::Data*);
     static Ref<WebArchive> create(RefPtr<WebCore::LegacyWebArchive>&&);
-    static Ref<WebArchive> create(WebCore::Range*);
+    static Ref<WebArchive> create(WebCore::Range&);
 
     WebArchiveResource* mainResource();
     API::Array* subresources();
index f2f0fe0..f615f4c 100644 (file)
@@ -53,9 +53,9 @@ Ref<WebArchive> WebArchive::create(RefPtr<LegacyWebArchive>&& legacyWebArchive)
     return adoptRef(*new WebArchive(legacyWebArchive.releaseNonNull()));
 }
 
-Ref<WebArchive> WebArchive::create(Range* range)
+Ref<WebArchive> WebArchive::create(Range& range)
 {
-    return adoptRef(*new WebArchive(LegacyWebArchive::create(range)));
+    return adoptRef(*new WebArchive(LegacyWebArchive::create(&range)));
 }
 
 WebArchive::WebArchive(WebArchiveResource* mainResource, RefPtr<API::Array>&& subresources, RefPtr<API::Array>&& subframeArchives)
index 7cd5ab3..794ab1c 100644 (file)
@@ -70,7 +70,7 @@ using namespace WebKit;
 #if TARGET_OS_IPHONE
 - (NSArray *)detectDataWithTypes:(WKDataDetectorTypes)types context:(NSDictionary *)context WK_API_AVAILABLE(ios(WK_IOS_TBA))
 {
-    RefPtr<WebCore::Range> coreRange = _rangeHandle->coreRange();
+    RefPtr<WebCore::Range> coreRange = &_rangeHandle->coreRange();
     return WebCore::DataDetection::detectContentInRange(coreRange, fromWKDataDetectorTypes(types), context);
 }
 #endif
index 1aec0b9..8cc628a 100644 (file)
@@ -42,7 +42,7 @@ using namespace WebKit;
 
 + (WKWebProcessPlugInScriptWorld *)normalWorld
 {
-    return wrapper(*InjectedBundleScriptWorld::normalWorld());
+    return wrapper(InjectedBundleScriptWorld::normalWorld());
 }
 
 - (void)dealloc
index b1baace..d3ff25f 100644 (file)
@@ -218,7 +218,7 @@ void WKBundleSetDatabaseQuota(WKBundleRef bundleRef, uint64_t quota)
 
 WKDataRef WKBundleCreateWKDataFromUInt8Array(WKBundleRef bundle, JSContextRef context, JSValueRef data)
 {
-    return toAPI(toImpl(bundle)->createWebDataFromUint8Array(context, data).leakRef());
+    return toAPI(&toImpl(bundle)->createWebDataFromUint8Array(context, data).leakRef());
 }
 
 int WKBundleNumberOfPages(WKBundleRef bundleRef, WKBundleFrameRef frameRef, double pageWidthInPixels, double pageHeightInPixels)
index 94ab4da..907b7d6 100644 (file)
@@ -179,7 +179,7 @@ void WKBundlePageClickMenuItem(WKBundlePageRef pageRef, WKContextMenuItemRef ite
 }
 
 #if ENABLE(CONTEXT_MENUS)
-static PassRefPtr<API::Array> contextMenuItems(const WebContextMenu& contextMenu)
+static Ref<API::Array> contextMenuItems(const WebContextMenu& contextMenu)
 {
     auto items = contextMenu.items();
 
@@ -198,7 +198,7 @@ WKArrayRef WKBundlePageCopyContextMenuItems(WKBundlePageRef pageRef)
 #if ENABLE(CONTEXT_MENUS)
     WebContextMenu* contextMenu = toImpl(pageRef)->contextMenu();
 
-    return toAPI(contextMenuItems(*contextMenu).leakRef());
+    return toAPI(&contextMenuItems(*contextMenu).leakRef());
 #else
     UNUSED_PARAM(pageRef);
     return nullptr;
@@ -212,7 +212,7 @@ WKArrayRef WKBundlePageCopyContextMenuAtPointInWindow(WKBundlePageRef pageRef, W
     if (!contextMenu)
         return nullptr;
 
-    return toAPI(contextMenuItems(*contextMenu).leakRef());
+    return toAPI(&contextMenuItems(*contextMenu).leakRef());
 #else
     UNUSED_PARAM(pageRef);
     UNUSED_PARAM(point);
index bfecd33..3c07d2e 100644 (file)
@@ -137,7 +137,7 @@ private:
             DDActionContext *actionContext = (DDActionContext *)m_client.actionContextForResultAtPoint(toAPI(&pageOverlay), WKPointMake(location.x(), location.y()), &apiRange, m_client.base.clientInfo);
 
             if (apiRange)
-                rangeHandle = toImpl(apiRange)->coreRange();
+                rangeHandle = &toImpl(apiRange)->coreRange();
 
             return actionContext;
         }
index b7bd8b3..b409c59 100644 (file)
@@ -45,7 +45,7 @@ WKBundleScriptWorldRef WKBundleScriptWorldCreateWorld()
 
 WKBundleScriptWorldRef WKBundleScriptWorldNormalWorld()
 {
-    return toAPI(InjectedBundleScriptWorld::normalWorld());
+    return toAPI(&InjectedBundleScriptWorld::normalWorld());
 }
 
 void WKBundleScriptWorldClearWrappers(WKBundleScriptWorldRef scriptWorldRef)
index dc095e0..8d4c978 100644 (file)
@@ -99,10 +99,10 @@ void webkitScriptWorldWindowObjectCleared(WebKitScriptWorld* world, WebKitWebPag
     g_signal_emit(world, signals[WINDOW_OBJECT_CLEARED], 0, page, frame);
 }
 
-static WebKitScriptWorld* webkitScriptWorldCreate(PassRefPtr<InjectedBundleScriptWorld> scriptWorld)
+static WebKitScriptWorld* webkitScriptWorldCreate(Ref<InjectedBundleScriptWorld>&& scriptWorld)
 {
     WebKitScriptWorld* world = WEBKIT_SCRIPT_WORLD(g_object_new(WEBKIT_TYPE_SCRIPT_WORLD, NULL));
-    world->priv->scriptWorld = scriptWorld;
+    world->priv->scriptWorld = WTFMove(scriptWorld);
 
     ASSERT(!scriptWorlds().contains(world->priv->scriptWorld.get()));
     scriptWorlds().add(world->priv->scriptWorld.get(), world);
index 2a8f17a..e011f62 100644 (file)
@@ -42,14 +42,14 @@ static DOMHandleCache& domHandleCache()
     return cache;
 }
 
-PassRefPtr<InjectedBundleCSSStyleDeclarationHandle> InjectedBundleCSSStyleDeclarationHandle::getOrCreate(CSSStyleDeclaration* styleDeclaration)
+RefPtr<InjectedBundleCSSStyleDeclarationHandle> InjectedBundleCSSStyleDeclarationHandle::getOrCreate(CSSStyleDeclaration* styleDeclaration)
 {
     if (!styleDeclaration)
         return nullptr;
 
     DOMHandleCache::AddResult result = domHandleCache().add(styleDeclaration, nullptr);
     if (!result.isNewEntry)
-        return PassRefPtr<InjectedBundleCSSStyleDeclarationHandle>(result.iterator->value);
+        return result.iterator->value;
 
     auto styleDeclarationHandle = adoptRef(*new InjectedBundleCSSStyleDeclarationHandle(*styleDeclaration));
     result.iterator->value = styleDeclarationHandle.ptr();
index 84c93c1..95d920c 100644 (file)
@@ -27,8 +27,8 @@
 #define InjectedBundleCSSStyleDeclarationHandle_h
 
 #include "APIObject.h"
-#include <wtf/PassRefPtr.h>
 #include <wtf/Ref.h>
+#include <wtf/RefPtr.h>
 
 namespace WebCore {
 class CSSStyleDeclaration;
@@ -38,7 +38,7 @@ namespace WebKit {
 
 class InjectedBundleCSSStyleDeclarationHandle : public API::ObjectImpl<API::Object::Type::BundleCSSStyleDeclarationHandle> {
 public:
-    static PassRefPtr<InjectedBundleCSSStyleDeclarationHandle> getOrCreate(WebCore::CSSStyleDeclaration*);
+    static RefPtr<InjectedBundleCSSStyleDeclarationHandle> getOrCreate(WebCore::CSSStyleDeclaration*);
     virtual ~InjectedBundleCSSStyleDeclarationHandle();
 
 private:
index 1a34a91..f74a121 100644 (file)
@@ -57,42 +57,42 @@ static DOMHandleCache& domHandleCache()
     return cache;
 }
 
-PassRefPtr<InjectedBundleRangeHandle> InjectedBundleRangeHandle::getOrCreate(JSContextRef context, JSObjectRef object)
+RefPtr<InjectedBundleRangeHandle> InjectedBundleRangeHandle::getOrCreate(JSContextRef context, JSObjectRef object)
 {
     Range* range = JSRange::toWrapped(toJS(context)->vm(), toJS(object));
     return getOrCreate(range);
 }
 
-PassRefPtr<InjectedBundleRangeHandle> InjectedBundleRangeHandle::getOrCreate(Range* range)
+RefPtr<InjectedBundleRangeHandle> InjectedBundleRangeHandle::getOrCreate(Range* range)
 {
     if (!range)
-        return 0;
+        return nullptr;
 
     DOMHandleCache::AddResult result = domHandleCache().add(range, nullptr);
     if (!result.isNewEntry)
-        return PassRefPtr<InjectedBundleRangeHandle>(result.iterator->value);
+        return result.iterator->value;
 
-    auto rangeHandle = InjectedBundleRangeHandle::create(range);
+    auto rangeHandle = InjectedBundleRangeHandle::create(*range);
     result.iterator->value = rangeHandle.ptr();
     return WTFMove(rangeHandle);
 }
 
-Ref<InjectedBundleRangeHandle> InjectedBundleRangeHandle::create(Range* range)
+Ref<InjectedBundleRangeHandle> InjectedBundleRangeHandle::create(Range& range)
 {
     return adoptRef(*new InjectedBundleRangeHandle(range));
 }
 
-InjectedBundleRangeHandle::InjectedBundleRangeHandle(Range* range)
+InjectedBundleRangeHandle::InjectedBundleRangeHandle(Range& range)
     : m_range(range)
 {
 }
 
 InjectedBundleRangeHandle::~InjectedBundleRangeHandle()
 {
-    domHandleCache().remove(m_range.get());
+    domHandleCache().remove(m_range.ptr());
 }
 
-Range* InjectedBundleRangeHandle::coreRange() const
+Range& InjectedBundleRangeHandle::coreRange() const
 {
     return m_range.get();
 }
@@ -109,7 +109,7 @@ WebCore::IntRect InjectedBundleRangeHandle::boundingRectInWindowCoordinates() co
     return frame->view()->contentsToWindow(enclosingIntRect(boundingRect));
 }
 
-PassRefPtr<WebImage> InjectedBundleRangeHandle::renderedImage(SnapshotOptions options)
+RefPtr<WebImage> InjectedBundleRangeHandle::renderedImage(SnapshotOptions options)
 {
     Document& ownerDocument = m_range->ownerDocument();
     Frame* frame = ownerDocument.frame();
@@ -123,7 +123,7 @@ PassRefPtr<WebImage> InjectedBundleRangeHandle::renderedImage(SnapshotOptions op
     Ref<Frame> protector(*frame);
 
     VisibleSelection oldSelection = frame->selection().selection();
-    frame->selection().setSelection(VisibleSelection(*m_range));
+    frame->selection().setSelection(VisibleSelection(m_range));
 
     float scaleFactor = (options & SnapshotOptionsExcludeDeviceScaleFactor) ? 1 : frame->page()->deviceScaleFactor();
     IntRect paintRect = enclosingIntRect(m_range->absoluteBoundingRect());
index 647b1c2..f80e33a 100644 (file)
@@ -30,7 +30,6 @@
 #include "ImageOptions.h"
 #include <JavaScriptCore/JSBase.h>
 #include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 
 namespace WebCore {
@@ -46,24 +45,24 @@ class WebImage;
 
 class InjectedBundleRangeHandle : public API::ObjectImpl<API::Object::Type::BundleRangeHandle> {
 public:
-    static PassRefPtr<InjectedBundleRangeHandle> getOrCreate(JSContextRef, JSObjectRef);
-    static PassRefPtr<InjectedBundleRangeHandle> getOrCreate(WebCore::Range*);
+    static RefPtr<InjectedBundleRangeHandle> getOrCreate(JSContextRef, JSObjectRef);
+    static RefPtr<InjectedBundleRangeHandle> getOrCreate(WebCore::Range*);
 
     virtual ~InjectedBundleRangeHandle();
 
     Ref<InjectedBundleNodeHandle> document();
 
     WebCore::IntRect boundingRectInWindowCoordinates() const;
-    PassRefPtr<WebImage> renderedImage(SnapshotOptions);
+    RefPtr<WebImage> renderedImage(SnapshotOptions);
     String text() const;
 
-    WebCore::Range* coreRange() const;
+    WebCore::Range& coreRange() const;
 
 private:
-    static Ref<InjectedBundleRangeHandle> create(WebCore::Range*);
-    InjectedBundleRangeHandle(WebCore::Range*);
+    static Ref<InjectedBundleRangeHandle> create(WebCore::Range&);
+    InjectedBundleRangeHandle(WebCore::Range&);
 
-    RefPtr<WebCore::Range> m_range;
+    Ref<WebCore::Range> m_range;
 };
 
 } // namespace WebKit
index 92b6fdb..61d9cc0 100644 (file)
@@ -88,7 +88,7 @@ using namespace JSC;
 
 namespace WebKit {
 
-PassRefPtr<InjectedBundle> InjectedBundle::create(const WebProcessCreationParameters& parameters, API::Object* initializationUserData)
+RefPtr<InjectedBundle> InjectedBundle::create(const WebProcessCreationParameters& parameters, API::Object* initializationUserData)
 {
     auto bundle = adoptRef(*new InjectedBundle(parameters));
 
@@ -572,7 +572,7 @@ uint64_t InjectedBundle::webNotificationID(JSContextRef jsContext, JSValueRef js
 }
 
 // FIXME Get rid of this function and move it into WKBundle.cpp.
-PassRefPtr<API::Data> InjectedBundle::createWebDataFromUint8Array(JSContextRef context, JSValueRef data)
+Ref<API::Data> InjectedBundle::createWebDataFromUint8Array(JSContextRef context, JSValueRef data)
 {
     JSC::ExecState* execState = toJS(context);
     RefPtr<Uint8Array> arrayData = WebCore::toUnsharedUint8Array(execState->vm(), toJS(execState, data));
index 000550b..8f337cc 100644 (file)
@@ -32,7 +32,7 @@
 #include "WKBundle.h"
 #include <WebCore/UserContentTypes.h>
 #include <WebCore/UserScriptTypes.h>
-#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
 #include <wtf/RetainPtr.h>
 #include <wtf/text/WTFString.h>
 
@@ -75,7 +75,7 @@ struct WebProcessCreationParameters;
 
 class InjectedBundle : public API::ObjectImpl<API::Object::Type::Bundle> {
 public:
-    static PassRefPtr<InjectedBundle> create(const WebProcessCreationParameters&, API::Object* initializationUserData);
+    static RefPtr<InjectedBundle> create(const WebProcessCreationParameters&, API::Object* initializationUserData);
 
     ~InjectedBundle();
 
@@ -117,7 +117,7 @@ public:
     void setWebNotificationPermission(WebPage*, const String& originString, bool allowed);
     void removeAllWebNotificationPermissions(WebPage*);
     uint64_t webNotificationID(JSContextRef, JSValueRef);
-    PassRefPtr<API::Data> createWebDataFromUint8Array(JSContextRef, JSValueRef);
+    Ref<API::Data> createWebDataFromUint8Array(JSContextRef, JSValueRef);
 
     // UserContent API
     void addUserScript(WebPageGroupProxy*, InjectedBundleScriptWorld*, const String& source, const String& url, API::Array* whitelist, API::Array* blacklist, WebCore::UserScriptInjectionTime, WebCore::UserContentInjectedFrames);
index e87905b..3f26084 100644 (file)
@@ -36,13 +36,13 @@ using namespace WebCore;
 
 namespace WebKit {
 
-PassRefPtr<InjectedBundleBackForwardListItem> InjectedBundleBackForwardList::itemAtIndex(int index) const
+RefPtr<InjectedBundleBackForwardListItem> InjectedBundleBackForwardList::itemAtIndex(int index) const
 {
     if (!m_page)
-        return 0;
+        return nullptr;
     Page* page = m_page->corePage();
     if (!page)
-        return 0;
+        return nullptr;
     return InjectedBundleBackForwardListItem::create(page->backForward().itemAtIndex(index));
 }
 
index a44d0b9..9edafaa 100644 (file)
@@ -27,7 +27,7 @@
 #define InjectedBundleBackForwardList_h
 
 #include "APIObject.h"
-#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
 
 namespace WebKit {
 
@@ -42,11 +42,11 @@ public:
         return adoptRef(*new InjectedBundleBackForwardList(page));
     }
 
-    void detach() { m_page = 0; }
+    void detach() { m_page = nullptr; }
 
     void clear();
 
-    PassRefPtr<InjectedBundleBackForwardListItem> itemAtIndex(int) const;
+    RefPtr<InjectedBundleBackForwardListItem> itemAtIndex(int) const;
     int backListCount() const;
     int forwardListCount() const;
 
index 42827f6..15e6a57 100644 (file)
@@ -39,11 +39,11 @@ class WebPageProxy;
 
 class InjectedBundleBackForwardListItem : public API::ObjectImpl<API::Object::Type::BundleBackForwardListItem> {
 public:
-    static PassRefPtr<InjectedBundleBackForwardListItem> create(PassRefPtr<WebCore::HistoryItem> item)
+    static RefPtr<InjectedBundleBackForwardListItem> create(RefPtr<WebCore::HistoryItem>&& item)
     {
         if (!item)
-            return 0;
-        return adoptRef(new InjectedBundleBackForwardListItem(item));
+            return nullptr;
+        return adoptRef(new InjectedBundleBackForwardListItem(WTFMove(item)));
     }
 
     WebCore::HistoryItem* item() const { return m_item.get(); }
@@ -60,7 +60,9 @@ public:
     Ref<API::Array> children() const;
 
 private:
-    InjectedBundleBackForwardListItem(PassRefPtr<WebCore::HistoryItem> item) : m_item(item) { }
+    explicit InjectedBundleBackForwardListItem(RefPtr<WebCore::HistoryItem>&& item)
+        : m_item(WTFMove(item))
+    { }
 
     RefPtr<WebCore::HistoryItem> m_item;
 };
index 826d372..72ae772 100644 (file)
@@ -46,12 +46,12 @@ Ref<InjectedBundleHitTestResult> InjectedBundleHitTestResult::create(const HitTe
     return adoptRef(*new InjectedBundleHitTestResult(hitTestResult));
 }
 
-PassRefPtr<InjectedBundleNodeHandle> InjectedBundleHitTestResult::nodeHandle() const
+RefPtr<InjectedBundleNodeHandle> InjectedBundleHitTestResult::nodeHandle() const
 {
     return InjectedBundleNodeHandle::getOrCreate(m_hitTestResult.innerNonSharedNode());
 }
 
-PassRefPtr<InjectedBundleNodeHandle> InjectedBundleHitTestResult::urlElementHandle() const
+RefPtr<InjectedBundleNodeHandle> InjectedBundleHitTestResult::urlElementHandle() const
 {
     return InjectedBundleNodeHandle::getOrCreate(m_hitTestResult.URLElement());
 }
index 2582b47..14e3e67 100644 (file)
@@ -30,7 +30,7 @@
 #include "InjectedBundleHitTestResultMediaType.h"
 #include <WebCore/HitTestResult.h>
 #include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
+#include <wtf/Ref.h>
 #include <wtf/RefPtr.h>
 
 namespace WebKit {
@@ -44,8 +44,8 @@ public:
 
     const WebCore::HitTestResult& coreHitTestResult() const { return m_hitTestResult; }
 
-    PassRefPtr<InjectedBundleNodeHandle> nodeHandle() const;
-    PassRefPtr<InjectedBundleNodeHandle> urlElementHandle() const;
+    RefPtr<InjectedBundleNodeHandle> nodeHandle() const;
+    RefPtr<InjectedBundleNodeHandle> urlElementHandle() const;
     WebFrame* frame() const;
     WebFrame* targetFrame() const;
 
index 3569fd8..76d5068 100644 (file)
@@ -97,12 +97,12 @@ WebMouseEvent::SyntheticClickType InjectedBundleNavigationAction::syntheticClick
     return syntheticClickTypeForMouseEvent(mouseEventForNavigationAction(navigationAction));
 }
 
-Ref<InjectedBundleNavigationAction> InjectedBundleNavigationAction::create(WebFrame* frame, const NavigationAction& action, PassRefPtr<FormState> formState)
+Ref<InjectedBundleNavigationAction> InjectedBundleNavigationAction::create(WebFrame* frame, const NavigationAction& action, RefPtr<FormState>&& formState)
 {
-    return adoptRef(*new InjectedBundleNavigationAction(frame, action, formState));
+    return adoptRef(*new InjectedBundleNavigationAction(frame, action, WTFMove(formState)));
 }
 
-InjectedBundleNavigationAction::InjectedBundleNavigationAction(WebFrame* frame, const NavigationAction& navigationAction, PassRefPtr<FormState> formState)
+InjectedBundleNavigationAction::InjectedBundleNavigationAction(WebFrame* frame, const NavigationAction& navigationAction, RefPtr<FormState>&& formState)
     : m_navigationType(navigationAction.type())
     , m_modifiers(modifiersForNavigationAction(navigationAction))
     , m_mouseButton(WebMouseEvent::NoButton)
index b3766e3..fa6a2a5 100644 (file)
@@ -31,7 +31,7 @@
 #include "InjectedBundleNodeHandle.h"
 #include "WebEvent.h"
 #include <WebCore/FrameLoaderTypes.h>
-#include <wtf/PassRefPtr.h>
+#include <wtf/Ref.h>
 #include <wtf/RefPtr.h>
 
 namespace WebCore {
@@ -45,7 +45,7 @@ class WebFrame;
 
 class InjectedBundleNavigationAction : public API::ObjectImpl<API::Object::Type::BundleNavigationAction> {
 public:
-    static Ref<InjectedBundleNavigationAction> create(WebFrame*, const WebCore::NavigationAction&, PassRefPtr<WebCore::FormState>);
+    static Ref<InjectedBundleNavigationAction> create(WebFrame*, const WebCore::NavigationAction&, RefPtr<WebCore::FormState>&&);
 
     static WebEvent::Modifiers modifiersForNavigationAction(const WebCore::NavigationAction&);
     static WebMouseEvent::Button mouseButtonForNavigationAction(const WebCore::NavigationAction&);
@@ -63,7 +63,7 @@ public:
     AtomicString downloadAttribute() const { return m_downloadAttribute; }
 
 private:
-    InjectedBundleNavigationAction(WebFrame*, const WebCore::NavigationAction&, PassRefPtr<WebCore::FormState>);
+    InjectedBundleNavigationAction(WebFrame*, const WebCore::NavigationAction&, RefPtr<WebCore::FormState>&&);
 
     WebCore::NavigationType m_navigationType;
     WebEvent::Modifiers m_modifiers;
index 5ba47cc..e25b071 100644 (file)
@@ -267,7 +267,7 @@ void InjectedBundlePageLoaderClient::didClearWindowObjectForFrame(WebPage* page,
     if (!m_client.didClearWindowObjectForFrame)
         return;
 
-    m_client.didClearWindowObjectForFrame(toAPI(page), toAPI(frame), toAPI(InjectedBundleScriptWorld::getOrCreate(world).get()), m_client.base.clientInfo);
+    m_client.didClearWindowObjectForFrame(toAPI(page), toAPI(frame), toAPI(InjectedBundleScriptWorld::getOrCreate(world).ptr()), m_client.base.clientInfo);
 }
 
 void InjectedBundlePageLoaderClient::didCancelClientRedirectForFrame(WebPage* page, WebFrame* frame)
index 9e11a76..b17831d 100644 (file)
@@ -61,20 +61,20 @@ Ref<InjectedBundleScriptWorld> InjectedBundleScriptWorld::create(const String& n
     return adoptRef(*new InjectedBundleScriptWorld(ScriptController::createWorld(), name));
 }
 
-PassRefPtr<InjectedBundleScriptWorld> InjectedBundleScriptWorld::getOrCreate(DOMWrapperWorld& world)
+Ref<InjectedBundleScriptWorld> InjectedBundleScriptWorld::getOrCreate(DOMWrapperWorld& world)
 {
     if (&world == &mainThreadNormalWorld())
         return normalWorld();
 
     if (InjectedBundleScriptWorld* existingWorld = allWorlds().get(&world))
-        return existingWorld;
+        return *existingWorld;
 
-    return adoptRef(new InjectedBundleScriptWorld(world, uniqueWorldName()));
+    return adoptRef(*new InjectedBundleScriptWorld(world, uniqueWorldName()));
 }
 
-InjectedBundleScriptWorld* InjectedBundleScriptWorld::normalWorld()
+InjectedBundleScriptWorld& InjectedBundleScriptWorld::normalWorld()
 {
-    static InjectedBundleScriptWorld* world = adoptRef(new InjectedBundleScriptWorld(mainThreadNormalWorld(), String())).leakRef();
+    static InjectedBundleScriptWorld& world = adoptRef(*new InjectedBundleScriptWorld(mainThreadNormalWorld(), String())).leakRef();
     return world;
 }
 
index fe796f6..5092ae7 100644 (file)
@@ -27,7 +27,7 @@
 #define InjectedBundleScriptWorld_h
 
 #include "APIObject.h"
-#include <wtf/PassRefPtr.h>
+#include <wtf/Ref.h>
 #include <wtf/RefPtr.h>
 #include <wtf/text/WTFString.h>
 
@@ -41,8 +41,8 @@ class InjectedBundleScriptWorld : public API::ObjectImpl<API::Object::Type::Bund
 public:
     static Ref<InjectedBundleScriptWorld> create();
     static Ref<InjectedBundleScriptWorld> create(const String&);
-    static PassRefPtr<InjectedBundleScriptWorld> getOrCreate(WebCore::DOMWrapperWorld&);
-    static InjectedBundleScriptWorld* normalWorld();
+    static Ref<InjectedBundleScriptWorld> getOrCreate(WebCore::DOMWrapperWorld&);
+    static InjectedBundleScriptWorld& normalWorld();
 
     virtual ~InjectedBundleScriptWorld();
 
index 17d35c9..a4d7f1a 100644 (file)
@@ -53,18 +53,18 @@ namespace WebKit {
 // The plug-in that we're currently calling NPP_New for.
 static NetscapePlugin* currentNPPNewPlugin;
 
-RefPtr<NetscapePlugin> NetscapePlugin::create(PassRefPtr<NetscapePluginModule> pluginModule)
+RefPtr<NetscapePlugin> NetscapePlugin::create(RefPtr<NetscapePluginModule>&& pluginModule)
 {
     if (!pluginModule)
         return nullptr;
 
-    return adoptRef(*new NetscapePlugin(pluginModule));
+    return adoptRef(*new NetscapePlugin(pluginModule.releaseNonNull()));
 }
     
-NetscapePlugin::NetscapePlugin(PassRefPtr<NetscapePluginModule> pluginModule)
+NetscapePlugin::NetscapePlugin(Ref<NetscapePluginModule>&& pluginModule)
     : Plugin(NetscapePluginType)
     , m_nextRequestID(0)
-    , m_pluginModule(pluginModule)
+    , m_pluginModule(WTFMove(pluginModule))
     , m_npWindow()
     , m_isStarted(false)
 #if PLATFORM(COCOA)
@@ -1102,7 +1102,7 @@ Scrollbar* NetscapePlugin::verticalScrollbar()
 bool NetscapePlugin::supportsSnapshotting() const
 {
 #if PLATFORM(COCOA)
-    return m_pluginModule && m_pluginModule->pluginQuirks().contains(PluginQuirks::SupportsSnapshotting);
+    return m_pluginModule->pluginQuirks().contains(PluginQuirks::SupportsSnapshotting);
 #endif
     return false;
 }
index 78227f5..07c8b08 100644 (file)
@@ -52,7 +52,7 @@ class NetscapePluginUnix;
 
 class NetscapePlugin : public Plugin {
 public:
-    static RefPtr<NetscapePlugin> create(PassRefPtr<NetscapePluginModule>);
+    static RefPtr<NetscapePlugin> create(RefPtr<NetscapePluginModule>&&);
     virtual ~NetscapePlugin();
 
     static RefPtr<NetscapePlugin> fromNPP(NPP);
@@ -159,7 +159,7 @@ public:
     WebCore::IntPoint convertToRootView(const WebCore::IntPoint&) const override;
 
 private:
-    NetscapePlugin(PassRefPtr<NetscapePluginModule> pluginModule);
+    explicit NetscapePlugin(Ref<NetscapePluginModule>&&);
 
     void callSetWindow();
     void callSetWindowInvisible();
@@ -286,7 +286,7 @@ private:
     StreamsMap m_streams;
     HashMap<void*, std::pair<RefPtr<NetscapePluginStream>, String>> m_redirects;
 
-    RefPtr<NetscapePluginModule> m_pluginModule;
+    Ref<NetscapePluginModule> m_pluginModule;
     NPP_t m_npp;
     NPWindow m_npWindow;
 
index f633970..afda171 100644 (file)
@@ -46,7 +46,7 @@ class PDFPlugin;
 
 class PDFPluginAnnotation : public RefCounted<PDFPluginAnnotation> {
 public:
-    static PassRefPtr<PDFPluginAnnotation> create(PDFAnnotation *, PDFLayerController *, PDFPlugin*);
+    static RefPtr<PDFPluginAnnotation> create(PDFAnnotation *, PDFLayerController *, PDFPlugin*);
     virtual ~PDFPluginAnnotation();
 
     WebCore::Element* element() const { return m_element.get(); }
@@ -75,7 +75,7 @@ protected:
     virtual bool handleEvent(WebCore::Event*);
 
 private:
-    virtual PassRefPtr<WebCore::Element> createAnnotationElement() = 0;
+    virtual Ref<WebCore::Element> createAnnotationElement() = 0;
 
     class PDFPluginAnnotationEventListener : public WebCore::EventListener {
     public:
index 422bdac..74dcbc8 100644 (file)
@@ -52,14 +52,14 @@ namespace WebKit {
 
 using namespace HTMLNames;
 
-PassRefPtr<PDFPluginAnnotation> PDFPluginAnnotation::create(PDFAnnotation *annotation, PDFLayerController *pdfLayerController, PDFPlugin* plugin)
+RefPtr<PDFPluginAnnotation> PDFPluginAnnotation::create(PDFAnnotation *annotation, PDFLayerController *pdfLayerController, PDFPlugin* plugin)
 {
     if ([annotation isKindOfClass:pdfAnnotationTextWidgetClass()])
         return PDFPluginTextAnnotation::create(annotation, pdfLayerController, plugin);
     if ([annotation isKindOfClass:pdfAnnotationChoiceWidgetClass()])
         return PDFPluginChoiceAnnotation::create(annotation, pdfLayerController, plugin);
 
-    return 0;
+    return nullptr;
 }
 
 void PDFPluginAnnotation::attach(Element* parent)
index 6af87cd..0f7675c 100644 (file)
@@ -51,7 +51,7 @@ private:
     {
     }
 
-    PassRefPtr<WebCore::Element> createAnnotationElement() override;
+    Ref<WebCore::Element> createAnnotationElement() override;
 
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
index 2735032..dbe5ae9 100644 (file)
@@ -66,7 +66,7 @@ void PDFPluginChoiceAnnotation::commit()
     PDFPluginAnnotation::commit();
 }
 
-PassRefPtr<Element> PDFPluginChoiceAnnotation::createAnnotationElement()
+Ref<Element> PDFPluginChoiceAnnotation::createAnnotationElement()
 {
     Document& document = parent()->document();
 #pragma clang diagnostic push
@@ -74,13 +74,13 @@ PassRefPtr<Element> PDFPluginChoiceAnnotation::createAnnotationElement()
     PDFAnnotationChoiceWidget *choiceAnnotation = this->choiceAnnotation();
 #pragma clang diagnostic pop
 
-    RefPtr<Element> element = document.createElement(selectTag, false);
+    auto element = document.createElement(selectTag, false);
 
-    StyledElement* styledElement = static_cast<StyledElement*>(element.get());
+    auto& styledElement = downcast<StyledElement>(element.get());
 
     // FIXME: Match font weight and style as well?
-    styledElement->setInlineStyleProperty(CSSPropertyColor, colorFromNSColor(choiceAnnotation.fontColor).serialized());
-    styledElement->setInlineStyleProperty(CSSPropertyFontFamily, choiceAnnotation.font.familyName);
+    styledElement.setInlineStyleProperty(CSSPropertyColor, colorFromNSColor(choiceAnnotation.fontColor).serialized());
+    styledElement.setInlineStyleProperty(CSSPropertyFontFamily, choiceAnnotation.font.familyName);
 
     NSArray *choices = choiceAnnotation.choices;
     NSString *selectedChoice = choiceAnnotation.stringValue;
@@ -93,7 +93,7 @@ PassRefPtr<Element> PDFPluginChoiceAnnotation::createAnnotationElement()
         if (choice == selectedChoice)
             choiceOption->setAttributeWithoutSynchronization(selectedAttr, AtomicString("selected", AtomicString::ConstructFromLiteral));
 
-        styledElement->appendChild(choiceOption);
+        styledElement.appendChild(choiceOption);
     }
 
     return element;
index 163250a..36e2e82 100644 (file)
@@ -45,7 +45,7 @@ private:
     {
     }
 
-    PassRefPtr<WebCore::Element> createAnnotationElement() override;
+    Ref<WebCore::Element> createAnnotationElement() override;
 
     bool handleEvent(WebCore::Event*) override;
 };
index 0a90707..6778489 100644 (file)
@@ -53,9 +53,9 @@ PDFPluginPasswordField::~PDFPluginPasswordField()
     element()->removeEventListener(eventNames().keyupEvent, *eventListener(), false);
 }
 
-PassRefPtr<Element> PDFPluginPasswordField::createAnnotationElement()
+Ref<Element> PDFPluginPasswordField::createAnnotationElement()
 {
-    RefPtr<Element> element = PDFPluginTextAnnotation::createAnnotationElement();
+    auto element = PDFPluginTextAnnotation::createAnnotationElement();
     element->setAttribute(typeAttr, "password");
     element->addEventListener(eventNames().keyupEvent, *eventListener(), false);
     return element;
index a8e62e9..0cae6f0 100644 (file)
@@ -54,7 +54,7 @@ protected:
     {
     }
 
-    PassRefPtr<WebCore::Element> createAnnotationElement() override;
+    Ref<WebCore::Element> createAnnotationElement() override;
     String value() const;
 
 private:
index bcf9c55..710945e 100644 (file)
@@ -79,10 +79,8 @@ PDFPluginTextAnnotation::~PDFPluginTextAnnotation()
     element()->removeEventListener(eventNames().keydownEvent, *eventListener(), false);
 }
 
-PassRefPtr<Element> PDFPluginTextAnnotation::createAnnotationElement()
+Ref<Element> PDFPluginTextAnnotation::createAnnotationElement()
 {
-    RefPtr<Element> element;
-
     Document& document = parent()->document();
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
@@ -90,27 +88,23 @@ PassRefPtr<Element> PDFPluginTextAnnotation::createAnnotationElement()
 #pragma clang diagnostic pop
     bool isMultiline = textAnnotation.isMultiline;
 
-    if (isMultiline)
-        element = document.createElement(textareaTag, false);
-    else
-        element = document.createElement(inputTag, false);
-
+    auto element = document.createElement(isMultiline ? textareaTag : inputTag, false);
     element->addEventListener(eventNames().keydownEvent, *eventListener(), false);
 
-    StyledElement* styledElement = static_cast<StyledElement*>(element.get());
+    auto& styledElement = downcast<StyledElement>(element.get());
 
     if (!textAnnotation)
         return element;
 
     // FIXME: Match font weight and style as well?
-    styledElement->setInlineStyleProperty(CSSPropertyColor, colorFromNSColor(textAnnotation.fontColor).serialized());
-    styledElement->setInlineStyleProperty(CSSPropertyFontFamily, textAnnotation.font.familyName);
-    styledElement->setInlineStyleProperty(CSSPropertyTextAlign, cssAlignmentValueForNSTextAlignment(textAnnotation.alignment));
+    styledElement.setInlineStyleProperty(CSSPropertyColor, colorFromNSColor(textAnnotation.fontColor).serialized());
+    styledElement.setInlineStyleProperty(CSSPropertyFontFamily, textAnnotation.font.familyName);
+    styledElement.setInlineStyleProperty(CSSPropertyTextAlign, cssAlignmentValueForNSTextAlignment(textAnnotation.alignment));
 
     if (isMultiline)
-        downcast<HTMLTextAreaElement>(styledElement)->setValue(textAnnotation.stringValue);
+        downcast<HTMLTextAreaElement>(styledElement).setValue(textAnnotation.stringValue);
     else
-        downcast<HTMLInputElement>(styledElement)->setValue(textAnnotation.stringValue);
+        downcast<HTMLInputElement>(styledElement).setValue(textAnnotation.stringValue);
 
     return element;
 }
index cc30c80..a83158f 100644 (file)
@@ -61,7 +61,7 @@ typedef HashMap<uint64_t, std::pair<RefPtr<InjectedBundleScriptWorld>, unsigned>
 
 static WorldMap& worldMap()
 {
-    static NeverDestroyed<WorldMap> map(std::initializer_list<WorldMap::KeyValuePairType> { { 1, std::make_pair(InjectedBundleScriptWorld::normalWorld(), 1) } });
+    static NeverDestroyed<WorldMap> map(std::initializer_list<WorldMap::KeyValuePairType> { { 1, std::make_pair(&InjectedBundleScriptWorld::normalWorld(), 1) } });
 
     return map;
 }
@@ -208,9 +208,9 @@ void WebUserContentController::removeAllUserStyleSheets(const Vector<uint64_t>&
 #if ENABLE(USER_MESSAGE_HANDLERS)
 class WebUserMessageHandlerDescriptorProxy : public WebCore::UserMessageHandlerDescriptor {
 public:
-    static PassRefPtr<WebUserMessageHandlerDescriptorProxy> create(WebUserContentController* controller, const String& name, InjectedBundleScriptWorld& world, uint64_t identifier)
+    static Ref<WebUserMessageHandlerDescriptorProxy> create(WebUserContentController* controller, const String& name, InjectedBundleScriptWorld& world, uint64_t identifier)
     {
-        return adoptRef(new WebUserMessageHandlerDescriptorProxy(controller, name, world, identifier));
+        return adoptRef(*new WebUserMessageHandlerDescriptorProxy(controller, name, world, identifier));
     }
 
     virtual ~WebUserMessageHandlerDescriptorProxy()
index 5f45654..e5007c9 100644 (file)
@@ -59,7 +59,7 @@ using namespace WebKit;
 
 namespace WebKit {
 
-static PassRefPtr<ShareableBitmap> convertImageToBitmap(NSImage *image, const IntSize& size, Frame& frame)
+static RefPtr<ShareableBitmap> convertImageToBitmap(NSImage *image, const IntSize& size, Frame& frame)
 {
     ShareableBitmap::Flags flags = ShareableBitmap::SupportsAlpha;
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
@@ -79,7 +79,7 @@ static PassRefPtr<ShareableBitmap> convertImageToBitmap(NSImage *image, const In
 
     [NSGraphicsContext setCurrentContext:savedContext.get()];
 
-    return WTFMove(bitmap);
+    return bitmap;
 }
 
 void WebDragClient::didConcludeEditDrag()
index cb072fc..5c6d990 100644 (file)
@@ -5793,14 +5793,14 @@ void WebPage::addUserScript(const String& source, WebCore::UserContentInjectedFr
 {
     WebCore::UserScript userScript{ source, WebCore::blankURL(), Vector<String>(), Vector<String>(), injectionTime, injectedFrames };
 
-    m_userContentController->addUserScript(*InjectedBundleScriptWorld::normalWorld(), WTFMove(userScript));
+    m_userContentController->addUserScript(InjectedBundleScriptWorld::normalWorld(), WTFMove(userScript));
 }
 
 void WebPage::addUserStyleSheet(const String& source, WebCore::UserContentInjectedFrames injectedFrames)
 {
     WebCore::UserStyleSheet userStyleSheet{ source, WebCore::blankURL(), Vector<String>(), Vector<String>(), injectedFrames, UserStyleUserLevel };
 
-    m_userContentController->addUserStyleSheet(*InjectedBundleScriptWorld::normalWorld(), WTFMove(userStyleSheet));
+    m_userContentController->addUserStyleSheet(InjectedBundleScriptWorld::normalWorld(), WTFMove(userStyleSheet));
 }
 
 void WebPage::removeAllUserContent()
index 1a5e102..c8c93b2 100644 (file)
@@ -379,7 +379,7 @@ struct PrintPagesData {
     bool isValid : 1;
 };
 
-PassRefPtr<WebPrintOperationGtk> WebPrintOperationGtk::create(WebPage* page, const PrintInfo& printInfo)
+RefPtr<WebPrintOperationGtk> WebPrintOperationGtk::create(WebPage* page, const PrintInfo& printInfo)
 {
 #if HAVE(GTK_UNIX_PRINTING)
     return adoptRef(new WebPrintOperationGtkUnix(page, printInfo));
@@ -388,7 +388,7 @@ PassRefPtr<WebPrintOperationGtk> WebPrintOperationGtk::create(WebPage* page, con
 #else
     UNUSED_PARAM(page);
     UNUSED_PARAM(printInfo);
-    return 0;
+    return nullptr;
 #endif
 }
 
index f5fec10..743cc2c 100644 (file)
@@ -28,8 +28,8 @@
 
 #include "PrintInfo.h"
 #include <WebCore/RefPtrCairo.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
 #include <wtf/glib/GRefPtr.h>
 
 typedef struct _GtkPrintSettings GtkPrintSettings;
@@ -48,7 +48,7 @@ class WebPage;
 
 class WebPrintOperationGtk : public RefCounted<WebPrintOperationGtk> {
 public:
-    static PassRefPtr<WebPrintOperationGtk> create(WebPage*, const PrintInfo&);
+    static RefPtr<WebPrintOperationGtk> create(WebPage*, const PrintInfo&);
     virtual ~WebPrintOperationGtk();
 
     WebCore::PrintContext* printContext() const { return m_printContext; }
index 05cf110..91b8f23 100644 (file)
@@ -1178,7 +1178,7 @@ void WebPage::selectWithGesture(const IntPoint& point, uint32_t granularity, uin
     send(Messages::WebPageProxy::GestureCallback(point, gestureType, gestureState, static_cast<uint32_t>(flags), callbackID));
 }
 
-static PassRefPtr<Range> rangeForPosition(Frame* frame, const VisiblePosition& position, bool baseIsStart)
+static RefPtr<Range> rangeForPosition(Frame* frame, const VisiblePosition& position, bool baseIsStart)
 {
     RefPtr<Range> range;
     VisiblePosition result = position;
@@ -1203,10 +1203,10 @@ static PassRefPtr<Range> rangeForPosition(Frame* frame, const VisiblePosition& p
             range = Range::create(*frame->document(), result, selectionEnd);
     }
 
-    return range.release();
+    return range;
 }
 
-static PassRefPtr<Range> rangeAtWordBoundaryForPosition(Frame* frame, const VisiblePosition& position, bool baseIsStart, SelectionDirection direction)
+static RefPtr<Range> rangeAtWordBoundaryForPosition(Frame* frame, const VisiblePosition& position, bool baseIsStart, SelectionDirection direction)
 {
     SelectionDirection sameDirection = baseIsStart ? DirectionForward : DirectionBackward;
     SelectionDirection oppositeDirection = baseIsStart ? DirectionBackward : DirectionForward;
@@ -1216,7 +1216,7 @@ static PassRefPtr<Range> rangeAtWordBoundaryForPosition(Frame* frame, const Visi
 
     if (atBoundaryOfGranularity(extent, WordGranularity, sameDirection)) {
         // This is a word boundary. Leave selection where it is.
-        return 0;
+        return nullptr;
     }
 
     if (atBoundaryOfGranularity(extent, WordGranularity, oppositeDirection)) {
@@ -1251,7 +1251,7 @@ static PassRefPtr<Range> rangeAtWordBoundaryForPosition(Frame* frame, const Visi
     if (extent.isNull() || extent == base)
         extent = wordBoundary;
     if (extent.isNull())
-        return 0;
+        return nullptr;
 
     return (base < extent) ? Range::create(*frame->document(), base, extent) : Range::create(*frame->document(), extent, base);
 }
index 6339b22..187c1d8 100644 (file)
@@ -163,9 +163,9 @@ public:
         {
         }
 
-        KeyframeValue(PassRefPtr<WebCore::FilterOperation> value)
+        KeyframeValue(RefPtr<WebCore::FilterOperation>&& value)
             : keyType(FilterKeyType)
-            , filter(value)
+            , filter(WTFMove(value))
         {
         }
 
index b100370..b29caa6 100644 (file)
@@ -650,8 +650,8 @@ void PlatformCAAnimationRemote::setValues(const Vector<RefPtr<FilterOperation>>&
     Vector<KeyframeValue> keyframes;
     keyframes.reserveInitialCapacity(values.size());
     
-    for (size_t i = 0; i < values.size(); ++i)
-        keyframes.uncheckedAppend(KeyframeValue(values[i]));
+    for (auto& value : values)
+        keyframes.uncheckedAppend(KeyframeValue { value.copyRef() });
     
     m_properties.keyValues = WTFMove(keyframes);
 }