PageConfiguration::dragClient should use a smart pointer
https://bugs.webkit.org/show_bug.cgi?id=204816
Reviewed by Alex Christensen.
Source/WebCore:
* loader/EmptyClients.cpp:
(WebCore::pageConfigurationWithEmptyClients):
* page/DragClient.h:
* page/DragController.cpp:
(WebCore::DragController::DragController):
(WebCore::DragController::~DragController):
(WebCore::DragController::dragEnded):
(WebCore::DragController::performDragOperation):
(WebCore::DragController::delegateDragSourceAction):
(WebCore::DragController::concludeEditDrag):
(WebCore::DragController::startDrag):
(WebCore::DragController::beginDrag):
(WebCore::DragController::doSystemDrag):
* page/DragController.h:
(WebCore::DragController::client const):
* page/Page.cpp:
(WebCore::Page::Page):
* page/PageConfiguration.cpp:
* page/PageConfiguration.h:
* page/mac/DragControllerMac.mm:
(WebCore::DragController::declareAndWriteDragImage):
Source/WebKit:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_overriddenMediaType):
Source/WebKitLegacy/mac:
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
Source/WebKitLegacy/win:
* WebView.cpp:
(WebView::initWithFrame):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@253182 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 7670d4e..f7ff228 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,5 +1,34 @@
2019-12-05 Chris Dumez <cdumez@apple.com>
+ PageConfiguration::dragClient should use a smart pointer
+ https://bugs.webkit.org/show_bug.cgi?id=204816
+
+ Reviewed by Alex Christensen.
+
+ * loader/EmptyClients.cpp:
+ (WebCore::pageConfigurationWithEmptyClients):
+ * page/DragClient.h:
+ * page/DragController.cpp:
+ (WebCore::DragController::DragController):
+ (WebCore::DragController::~DragController):
+ (WebCore::DragController::dragEnded):
+ (WebCore::DragController::performDragOperation):
+ (WebCore::DragController::delegateDragSourceAction):
+ (WebCore::DragController::concludeEditDrag):
+ (WebCore::DragController::startDrag):
+ (WebCore::DragController::beginDrag):
+ (WebCore::DragController::doSystemDrag):
+ * page/DragController.h:
+ (WebCore::DragController::client const):
+ * page/Page.cpp:
+ (WebCore::Page::Page):
+ * page/PageConfiguration.cpp:
+ * page/PageConfiguration.h:
+ * page/mac/DragControllerMac.mm:
+ (WebCore::DragController::declareAndWriteDragImage):
+
+2019-12-05 Chris Dumez <cdumez@apple.com>
+
[IPC] Fail BackForwardItemIdentifier decoding if the decoded integer is not a valid ID
https://bugs.webkit.org/show_bug.cgi?id=204920
<rdar://problem/57677453>
diff --git a/Source/WebCore/loader/EmptyClients.cpp b/Source/WebCore/loader/EmptyClients.cpp
index 779e914..de32525 100644
--- a/Source/WebCore/loader/EmptyClients.cpp
+++ b/Source/WebCore/loader/EmptyClients.cpp
@@ -182,7 +182,6 @@
void willPerformDragSourceAction(DragSourceAction, const IntPoint&, DataTransfer&) final { }
DragSourceAction dragSourceActionMaskForPoint(const IntPoint&) final { return DragSourceActionNone; }
void startDrag(DragItem, DataTransfer&, Frame&) final { }
- void dragControllerDestroyed() final { }
};
#endif // ENABLE(DRAG_SUPPORT)
@@ -607,8 +606,7 @@
#endif
#if ENABLE(DRAG_SUPPORT)
- static NeverDestroyed<EmptyDragClient> dummyDragClient;
- pageConfiguration.dragClient = &dummyDragClient.get();
+ pageConfiguration.dragClient = makeUnique<EmptyDragClient>();
#endif
static NeverDestroyed<EmptyInspectorClient> dummyInspectorClient;
diff --git a/Source/WebCore/page/DragClient.h b/Source/WebCore/page/DragClient.h
index 3786068..b2bcdad 100644
--- a/Source/WebCore/page/DragClient.h
+++ b/Source/WebCore/page/DragClient.h
@@ -40,9 +40,8 @@
struct PromisedAttachmentInfo;
class DragClient {
+ WTF_MAKE_FAST_ALLOCATED;
public:
- virtual void dragControllerDestroyed() = 0;
-
virtual bool useLegacyDragClient() { return true; }
virtual void willPerformDragDestinationAction(DragDestinationAction, const DragData&) = 0;
diff --git a/Source/WebCore/page/DragController.cpp b/Source/WebCore/page/DragController.cpp
index d508a63..dad002b 100644
--- a/Source/WebCore/page/DragController.cpp
+++ b/Source/WebCore/page/DragController.cpp
@@ -133,16 +133,13 @@
metaKey, WallTime::now(), ForceAtClick, NoTap);
}
-DragController::DragController(Page& page, DragClient& client)
+DragController::DragController(Page& page, std::unique_ptr<DragClient>&& client)
: m_page(page)
- , m_client(client)
+ , m_client(WTFMove(client))
{
}
-DragController::~DragController()
-{
- m_client.dragControllerDestroyed();
-}
+DragController::~DragController() = default;
static RefPtr<DocumentFragment> documentFragmentFromDragData(const DragData& dragData, Frame& frame, Range& context, bool allowPlainText, bool& chosePlainText)
{
@@ -209,7 +206,7 @@
clearDragCaret();
removeAllDroppedImagePlaceholders();
- m_client.dragEnded();
+ client().dragEnded();
}
DragOperation DragController::dragEntered(const DragData& dragData)
@@ -260,7 +257,7 @@
shouldOpenExternalURLsPolicy = m_documentUnderMouse->shouldOpenExternalURLsPolicyToPropagate();
if ((m_dragDestinationAction & DragDestinationActionDHTML) && dragIsHandledByDocument(m_dragHandlingMethod)) {
- m_client.willPerformDragDestinationAction(DragDestinationActionDHTML, dragData);
+ client().willPerformDragDestinationAction(DragDestinationActionDHTML, dragData);
Ref<Frame> mainFrame(m_page.mainFrame());
bool preventedDefault = false;
if (mainFrame->view())
@@ -273,7 +270,7 @@
}
if ((m_dragDestinationAction & DragDestinationActionEdit) && concludeEditDrag(dragData)) {
- m_client.didConcludeEditDrag();
+ client().didConcludeEditDrag();
m_documentUnderMouse = nullptr;
clearDragCaret();
return true;
@@ -289,7 +286,7 @@
if (urlString.isEmpty())
return false;
- m_client.willPerformDragDestinationAction(DragDestinationActionLoad, dragData);
+ client().willPerformDragDestinationAction(DragDestinationActionLoad, dragData);
FrameLoadRequest frameLoadRequest { m_page.mainFrame(), ResourceRequest { urlString }, shouldOpenExternalURLsPolicy };
frameLoadRequest.setIsRequestFromClientOrUserInput();
m_page.mainFrame().loader().load(WTFMove(frameLoadRequest));
@@ -488,7 +485,7 @@
DragSourceAction DragController::delegateDragSourceAction(const IntPoint& rootViewPoint)
{
- m_dragSourceAction = m_client.dragSourceActionMaskForPoint(rootViewPoint);
+ m_dragSourceAction = client().dragSourceActionMaskForPoint(rootViewPoint);
return m_dragSourceAction;
}
@@ -573,7 +570,7 @@
style->setProperty(CSSPropertyColor, color.serialized(), false);
if (!innerFrame->editor().shouldApplyStyle(style.ptr(), innerRange.get()))
return false;
- m_client.willPerformDragDestinationAction(DragDestinationActionEdit, dragData);
+ client().willPerformDragDestinationAction(DragDestinationActionEdit, dragData);
innerFrame->editor().applyStyle(style.ptr(), EditAction::SetColor);
return true;
}
@@ -609,7 +606,7 @@
if (!fragment || !editor.shouldInsertFragment(*fragment, range.get(), EditorInsertAction::Dropped))
return false;
- m_client.willPerformDragDestinationAction(DragDestinationActionEdit, dragData);
+ client().willPerformDragDestinationAction(DragDestinationActionEdit, dragData);
if (editor.client() && editor.client()->performTwoStepDrop(*fragment, *range, isMove))
return true;
@@ -635,7 +632,7 @@
if (text.isEmpty() || !editor.shouldInsertText(text, range.get(), EditorInsertAction::Dropped))
return false;
- m_client.willPerformDragDestinationAction(DragDestinationActionEdit, dragData);
+ client().willPerformDragDestinationAction(DragDestinationActionEdit, dragData);
RefPtr<DocumentFragment> fragment = createFragmentFromText(*range, text);
if (!fragment)
return false;
@@ -956,7 +953,7 @@
ASSERT(state.source);
Element& element = *state.source;
- bool mustUseLegacyDragClient = hasData == HasNonDefaultPasteboardData::Yes || m_client.useLegacyDragClient();
+ bool mustUseLegacyDragClient = hasData == HasNonDefaultPasteboardData::Yes || client().useLegacyDragClient();
IntRect dragImageBounds;
Image* image = getImage(element);
@@ -1002,7 +999,7 @@
src.editor().didWriteSelectionToPasteboard();
}
- m_client.willPerformDragSourceAction(DragSourceActionSelection, dragOrigin, dataTransfer);
+ client().willPerformDragSourceAction(DragSourceActionSelection, dragOrigin, dataTransfer);
if (!dragImage) {
TextIndicatorData textIndicator;
dragImage = DragImage { dissolveDragImageToFraction(createDragImageForSelection(src, textIndicator), DragImageAlpha) };
@@ -1054,7 +1051,7 @@
declareAndWriteDragImage(dataTransfer, element, !linkURL.isEmpty() ? linkURL : imageURL, hitTestResult.altDisplayString());
}
- m_client.willPerformDragSourceAction(DragSourceActionImage, dragOrigin, dataTransfer);
+ client().willPerformDragSourceAction(DragSourceActionImage, dragOrigin, dataTransfer);
if (!dragImage)
doImageDrag(element, dragOrigin, hitTestResult.imageRect(), src, m_dragOffset, state, WTFMove(attachmentInfo));
@@ -1098,7 +1095,7 @@
src.selection().setSelection(VisibleSelection::selectionFromContentsOfNode(node));
}
- m_client.willPerformDragSourceAction(DragSourceActionLink, dragOrigin, dataTransfer);
+ client().willPerformDragSourceAction(DragSourceActionLink, dragOrigin, dataTransfer);
if (!dragImage) {
TextIndicatorData textIndicator;
dragImage = DragImage { createDragImageForLink(element, linkURL, textContentWithSimplifiedWhiteSpace, textIndicator, src.settings().fontRenderingMode(), m_page.deviceScaleFactor()) };
@@ -1149,7 +1146,7 @@
}
}
- m_client.willPerformDragSourceAction(DragSourceActionAttachment, dragOrigin, dataTransfer);
+ client().willPerformDragSourceAction(DragSourceActionAttachment, dragOrigin, dataTransfer);
if (!dragImage) {
TextIndicatorData textIndicator;
@@ -1184,7 +1181,7 @@
dragImageOffset = IntPoint { dragImageSize(dragImage.get()) };
dragLoc = dragLocForDHTMLDrag(mouseDraggedPoint, dragOrigin, dragImageOffset, false);
- m_client.willPerformDragSourceAction(DragSourceActionColor, dragOrigin, dataTransfer);
+ client().willPerformDragSourceAction(DragSourceActionColor, dragOrigin, dataTransfer);
doSystemDrag(WTFMove(dragImage), dragLoc, dragOrigin, src, state, { });
return true;
}
@@ -1192,7 +1189,7 @@
if (state.type == DragSourceActionDHTML && dragImage) {
ASSERT(m_dragSourceAction & DragSourceActionDHTML);
- m_client.willPerformDragSourceAction(DragSourceActionDHTML, dragOrigin, dataTransfer);
+ client().willPerformDragSourceAction(DragSourceActionDHTML, dragOrigin, dataTransfer);
doSystemDrag(WTFMove(dragImage), dragLoc, dragOrigin, src, state, { });
return true;
}
@@ -1248,7 +1245,7 @@
void DragController::beginDrag(DragItem dragItem, Frame& frame, const IntPoint& mouseDownPoint, const IntPoint& mouseDraggedPoint, DataTransfer& dataTransfer, DragSourceAction dragSourceAction)
{
- ASSERT(!m_client.useLegacyDragClient());
+ ASSERT(!client().useLegacyDragClient());
m_didInitiateDrag = true;
m_dragInitiator = frame.document();
@@ -1260,7 +1257,7 @@
auto mouseDownPointInRootViewCoordinates = viewProtector->rootViewToContents(frame.view()->contentsToRootView(mouseDownPoint));
auto mouseDraggedPointInRootViewCoordinates = viewProtector->rootViewToContents(frame.view()->contentsToRootView(mouseDraggedPoint));
- m_client.beginDrag(WTFMove(dragItem), frame, mouseDownPointInRootViewCoordinates, mouseDraggedPointInRootViewCoordinates, dataTransfer, dragSourceAction);
+ client().beginDrag(WTFMove(dragItem), frame, mouseDownPointInRootViewCoordinates, mouseDraggedPointInRootViewCoordinates, dataTransfer, dragSourceAction);
}
void DragController::doSystemDrag(DragImage image, const IntPoint& dragLoc, const IntPoint& eventPos, Frame& frame, const DragState& state, PromisedAttachmentInfo&& promisedAttachmentInfo)
@@ -1316,7 +1313,7 @@
item.url = frame.document()->completeURL(stripLeadingAndTrailingHTMLSpaces(link->getAttribute(HTMLNames::hrefAttr)));
}
}
- m_client.startDrag(WTFMove(item), *state.dataTransfer, frameProtector.get());
+ client().startDrag(WTFMove(item), *state.dataTransfer, frameProtector.get());
// DragClient::startDrag can cause our Page to dispear, deallocating |this|.
if (!frameProtector->page())
return;
diff --git a/Source/WebCore/page/DragController.h b/Source/WebCore/page/DragController.h
index 42526b1..de6da31 100644
--- a/Source/WebCore/page/DragController.h
+++ b/Source/WebCore/page/DragController.h
@@ -53,10 +53,9 @@
class DragController {
WTF_MAKE_NONCOPYABLE(DragController); WTF_MAKE_FAST_ALLOCATED;
public:
- DragController(Page&, DragClient&);
+ DragController(Page&, std::unique_ptr<DragClient>&&);
~DragController();
- static std::unique_ptr<DragController> create(Page&, DragClient&);
static DragOperation platformGenericDragOperation();
WEBCORE_EXPORT DragOperation dragEntered(const DragData&);
@@ -133,6 +132,8 @@
#endif
}
+ DragClient& client() const { return *m_client; }
+
bool tryToUpdateDroppedImagePlaceholders(const DragData&);
void removeAllDroppedImagePlaceholders();
@@ -145,7 +146,7 @@
PromisedAttachmentInfo promisedAttachmentInfo(Frame&, Element&);
#endif
Page& m_page;
- DragClient& m_client;
+ std::unique_ptr<DragClient> m_client;
RefPtr<Document> m_documentUnderMouse; // The document the mouse was last dragged over.
RefPtr<Document> m_dragInitiator; // The Document (if any) that initiated the drag.
diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp
index 203f5ae..2271c19 100644
--- a/Source/WebCore/page/Page.cpp
+++ b/Source/WebCore/page/Page.cpp
@@ -217,7 +217,7 @@
: m_chrome(makeUnique<Chrome>(*this, *pageConfiguration.chromeClient))
, m_dragCaretController(makeUnique<DragCaretController>())
#if ENABLE(DRAG_SUPPORT)
- , m_dragController(makeUnique<DragController>(*this, *pageConfiguration.dragClient))
+ , m_dragController(makeUnique<DragController>(*this, WTFMove(pageConfiguration.dragClient)))
#endif
, m_focusController(makeUnique<FocusController>(*this, pageInitialActivityState()))
#if ENABLE(CONTEXT_MENUS)
diff --git a/Source/WebCore/page/PageConfiguration.cpp b/Source/WebCore/page/PageConfiguration.cpp
index a698dae..5819415 100644
--- a/Source/WebCore/page/PageConfiguration.cpp
+++ b/Source/WebCore/page/PageConfiguration.cpp
@@ -32,6 +32,7 @@
#include "CookieJar.h"
#include "DatabaseProvider.h"
#include "DiagnosticLoggingClient.h"
+#include "DragClient.h"
#include "EditorClient.h"
#include "LibWebRTCProvider.h"
#include "PerformanceLoggingClient.h"
diff --git a/Source/WebCore/page/PageConfiguration.h b/Source/WebCore/page/PageConfiguration.h
index 0928c3c..4d953f1 100644
--- a/Source/WebCore/page/PageConfiguration.h
+++ b/Source/WebCore/page/PageConfiguration.h
@@ -80,7 +80,7 @@
#endif
UniqueRef<EditorClient> editorClient;
Ref<SocketProvider> socketProvider;
- DragClient* dragClient { nullptr };
+ std::unique_ptr<DragClient> dragClient;
InspectorClient* inspectorClient { nullptr };
#if ENABLE(APPLE_PAY)
PaymentCoordinatorClient* paymentCoordinatorClient { nullptr };
diff --git a/Source/WebCore/page/mac/DragControllerMac.mm b/Source/WebCore/page/mac/DragControllerMac.mm
index 0e3dc5f..0337dd7 100644
--- a/Source/WebCore/page/mac/DragControllerMac.mm
+++ b/Source/WebCore/page/mac/DragControllerMac.mm
@@ -159,7 +159,7 @@
void DragController::declareAndWriteDragImage(DataTransfer& dataTransfer, Element& element, const URL& url, const String& label)
{
- m_client.declareAndWriteDragImage(dataTransfer.pasteboard().name(), element, url, label, element.document().frame());
+ client().declareAndWriteDragImage(dataTransfer.pasteboard().name(), element, url, label, element.document().frame());
}
} // namespace WebCore
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog
index 1dfc22a..fa56e97 100644
--- a/Source/WebKit/ChangeLog
+++ b/Source/WebKit/ChangeLog
@@ -1,5 +1,15 @@
2019-12-05 Chris Dumez <cdumez@apple.com>
+ PageConfiguration::dragClient should use a smart pointer
+ https://bugs.webkit.org/show_bug.cgi?id=204816
+
+ Reviewed by Alex Christensen.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::m_overriddenMediaType):
+
+2019-12-05 Chris Dumez <cdumez@apple.com>
+
[IPC] Fail BackForwardItemIdentifier decoding if the decoded integer is not a valid ID
https://bugs.webkit.org/show_bug.cgi?id=204920
<rdar://problem/57677453>
diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebDragClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebDragClient.cpp
index 60959a7..1a9a4e9 100644
--- a/Source/WebKit/WebProcess/WebCoreSupport/WebDragClient.cpp
+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebDragClient.cpp
@@ -60,11 +60,6 @@
}
#endif
-void WebDragClient::dragControllerDestroyed()
-{
- delete this;
-}
-
} // namespace WebKit
#endif // ENABLE(DRAG_SUPPORT)
diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebDragClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebDragClient.h
index b24ecf7..27c4b27 100644
--- a/Source/WebKit/WebProcess/WebCoreSupport/WebDragClient.h
+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebDragClient.h
@@ -54,8 +54,6 @@
void declareAndWriteDragImage(const String& pasteboardName, WebCore::Element&, const URL&, const String&, WebCore::Frame*) override;
#endif
- void dragControllerDestroyed() override;
-
WebPage* m_page;
};
diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp
index 35cdf49..539c4b6 100644
--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp
+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp
@@ -457,7 +457,7 @@
pageConfiguration.contextMenuClient = new WebContextMenuClient(this);
#endif
#if ENABLE(DRAG_SUPPORT)
- pageConfiguration.dragClient = new WebDragClient(this);
+ pageConfiguration.dragClient = makeUnique<WebDragClient>(this);
#endif
pageConfiguration.inspectorClient = new WebInspectorClient(this);
#if USE(AUTOCORRECTION_PANEL)
diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog
index 42496c6..1169f88 100644
--- a/Source/WebKitLegacy/mac/ChangeLog
+++ b/Source/WebKitLegacy/mac/ChangeLog
@@ -1,3 +1,14 @@
+2019-12-05 Chris Dumez <cdumez@apple.com>
+
+ PageConfiguration::dragClient should use a smart pointer
+ https://bugs.webkit.org/show_bug.cgi?id=204816
+
+ Reviewed by Alex Christensen.
+
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:]):
+ (-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
+
2019-12-04 Chris Dumez <cdumez@apple.com>
PageConfiguration::progressTrackerClient should use a smart pointer
diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebDragClient.h b/Source/WebKitLegacy/mac/WebCoreSupport/WebDragClient.h
index 30df3f7..15dcba5 100644
--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebDragClient.h
+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebDragClient.h
@@ -38,7 +38,6 @@
void willPerformDragDestinationAction(WebCore::DragDestinationAction, const WebCore::DragData&) override;
void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::DataTransfer&) override;
- void dragControllerDestroyed() override;
WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint& windowPoint) override;
void startDrag(WebCore::DragItem, WebCore::DataTransfer&, WebCore::Frame&) override;
diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebDragClient.mm b/Source/WebKitLegacy/mac/WebCoreSupport/WebDragClient.mm
index 640ce83..4278b03 100644
--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebDragClient.mm
+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebDragClient.mm
@@ -249,9 +249,4 @@
#endif // PLATFORM(IOS_FAMILY)
-void WebDragClient::dragControllerDestroyed()
-{
- delete this;
-}
-
#endif // ENABLE(DRAG_SUPPORT)
diff --git a/Source/WebKitLegacy/mac/WebView/WebView.mm b/Source/WebKitLegacy/mac/WebView/WebView.mm
index e2a71b1..76511a8 100644
--- a/Source/WebKitLegacy/mac/WebView/WebView.mm
+++ b/Source/WebKitLegacy/mac/WebView/WebView.mm
@@ -1452,7 +1452,7 @@
#endif
#if ENABLE(DRAG_SUPPORT)
- pageConfiguration.dragClient = new WebDragClient(self);
+ pageConfiguration.dragClient = makeUnique<WebDragClient>(self);
#endif
#if ENABLE(APPLE_PAY)
@@ -1711,7 +1711,7 @@
);
pageConfiguration.chromeClient = new WebChromeClientIOS(self);
#if ENABLE(DRAG_SUPPORT)
- pageConfiguration.dragClient = new WebDragClient(self);
+ pageConfiguration.dragClient = makeUnique<WebDragClient>(self);
#endif
#if ENABLE(APPLE_PAY)
diff --git a/Source/WebKitLegacy/win/ChangeLog b/Source/WebKitLegacy/win/ChangeLog
index dd296eb..42014d9 100644
--- a/Source/WebKitLegacy/win/ChangeLog
+++ b/Source/WebKitLegacy/win/ChangeLog
@@ -1,3 +1,13 @@
+2019-12-05 Chris Dumez <cdumez@apple.com>
+
+ PageConfiguration::dragClient should use a smart pointer
+ https://bugs.webkit.org/show_bug.cgi?id=204816
+
+ Reviewed by Alex Christensen.
+
+ * WebView.cpp:
+ (WebView::initWithFrame):
+
2019-12-04 Chris Dumez <cdumez@apple.com>
PageConfiguration::progressTrackerClient should use a smart pointer
diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebDragClient.cpp b/Source/WebKitLegacy/win/WebCoreSupport/WebDragClient.cpp
index 1bc1352..d43c2e4 100644
--- a/Source/WebKitLegacy/win/WebCoreSupport/WebDragClient.cpp
+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebDragClient.cpp
@@ -162,8 +162,3 @@
frame.eventHandler().dragSourceEndedAt(generateMouseEvent(m_webView, false), operation);
}
}
-
-void WebDragClient::dragControllerDestroyed()
-{
- delete this;
-}
diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebDragClient.h b/Source/WebKitLegacy/win/WebCoreSupport/WebDragClient.h
index 45e3ca7..27d47c8 100644
--- a/Source/WebKitLegacy/win/WebCoreSupport/WebDragClient.h
+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebDragClient.h
@@ -34,7 +34,6 @@
WTF_MAKE_FAST_ALLOCATED;
public:
WebDragClient(WebView*);
- virtual void dragControllerDestroyed();
virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint&);
virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, const WebCore::DragData&);
diff --git a/Source/WebKitLegacy/win/WebView.cpp b/Source/WebKitLegacy/win/WebView.cpp
index 6014481..a0448bb 100644
--- a/Source/WebKitLegacy/win/WebView.cpp
+++ b/Source/WebKitLegacy/win/WebView.cpp
@@ -3125,7 +3125,7 @@
);
configuration.chromeClient = new WebChromeClient(this);
configuration.contextMenuClient = new WebContextMenuClient(this);
- configuration.dragClient = new WebDragClient(this);
+ configuration.dragClient = makeUnique<WebDragClient>(this);
configuration.inspectorClient = m_inspectorClient;
configuration.loaderClientForMainFrame = new WebFrameLoaderClient;
configuration.applicationCacheStorage = &WebApplicationCache::storage();