Diff
Modified: trunk/Source/WebCore/ChangeLog (211191 => 211192)
--- trunk/Source/WebCore/ChangeLog 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebCore/ChangeLog 2017-01-26 02:01:29 UTC (rev 211192)
@@ -1,3 +1,42 @@
+2017-01-25 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Refactor drag and drop implementation on Mac
+ https://bugs.webkit.org/show_bug.cgi?id=167427
+
+ Reviewed by Enrica Casucci.
+
+ Refactors some code around drag and drop on Mac, and cleans up some other related code as needed. This patch
+ should result in no behavior change.
+
+ * dom/DataTransfer.cpp:
+ * page/EventHandler.cpp:
+ * page/ios/EventHandlerIOS.mm:
+ (WebCore::EventHandler::eventLoopHandleMouseDragged):
+ * page/mac/EventHandlerMac.mm:
+ * platform/DragImage.cpp:
+ * platform/Pasteboard.h:
+ * platform/ios/DragImageIOS.mm:
+ * platform/ios/PasteboardIOS.mm:
+ * platform/mac/DragDataMac.mm:
+ (rtfPasteboardType):
+ (rtfdPasteboardType):
+ (stringPasteboardType):
+ (urlPasteboardType):
+ (htmlPasteboardType):
+ (colorPasteboardType):
+ (pdfPasteboardType):
+ (tiffPasteboardType):
+ (WebCore::DragData::DragData):
+ (WebCore::DragData::containsColor):
+ (WebCore::DragData::containsFiles):
+ (WebCore::DragData::numberOfFiles):
+ (WebCore::DragData::asFilenames):
+ (WebCore::DragData::containsPlainText):
+ (WebCore::DragData::containsCompatibleContent):
+ (WebCore::DragData::containsPromise):
+ (WebCore::DragData::asURL):
+ * platform/mac/DragImageMac.mm:
+
2017-01-25 Youenn Fablet <you...@apple.com>
[WebRTC] Add support for incoming and outgoing libwebrtc audio tracks
Modified: trunk/Source/WebCore/dom/DataTransfer.cpp (211191 => 211192)
--- trunk/Source/WebCore/dom/DataTransfer.cpp 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebCore/dom/DataTransfer.cpp 2017-01-26 02:01:29 UTC (rev 211192)
@@ -290,7 +290,7 @@
m_pasteboard->setDragImage(computedImage, computedHotSpot);
}
-#if !PLATFORM(COCOA)
+#if !PLATFORM(MAC)
DragImageRef DataTransfer::createDragImage(IntPoint& location) const
{
Modified: trunk/Source/WebCore/page/EventHandler.cpp (211191 => 211192)
--- trunk/Source/WebCore/page/EventHandler.cpp 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2017-01-26 02:01:29 UTC (rev 211192)
@@ -131,6 +131,9 @@
const int ImageDragHysteresis = 5;
const int TextDragHysteresis = 3;
const int GeneralDragHysteresis = 3;
+#if PLATFORM(COCOA)
+const double EventHandler::TextDragDelay = 0.15;
+#endif
#endif // ENABLE(DRAG_SUPPORT)
#if ENABLE(IOS_GESTURE_EVENTS) || ENABLE(MAC_GESTURE_EVENTS)
@@ -806,7 +809,7 @@
}
#if ENABLE(DRAG_SUPPORT)
-bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& event)
+bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& event, CheckDragHysteresis checkDragHysteresis)
{
if (!m_mousePressed)
return false;
@@ -813,7 +816,7 @@
Ref<Frame> protectedFrame(m_frame);
- if (handleDrag(event, ShouldCheckDragHysteresis))
+ if (handleDrag(event, checkDragHysteresis))
return true;
Node* targetNode = event.targetNode();
Modified: trunk/Source/WebCore/page/EventHandler.h (211191 => 211192)
--- trunk/Source/WebCore/page/EventHandler.h 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebCore/page/EventHandler.h 2017-01-26 02:01:29 UTC (rev 211192)
@@ -338,7 +338,7 @@
bool handleMousePressEventTripleClick(const MouseEventWithHitTestResults&);
#if ENABLE(DRAG_SUPPORT)
- bool handleMouseDraggedEvent(const MouseEventWithHitTestResults&);
+ bool handleMouseDraggedEvent(const MouseEventWithHitTestResults&, CheckDragHysteresis = ShouldCheckDragHysteresis);
#endif
WEBCORE_EXPORT bool handleMouseReleaseEvent(const MouseEventWithHitTestResults&);
Modified: trunk/Source/WebCore/page/ios/EventHandlerIOS.mm (211191 => 211192)
--- trunk/Source/WebCore/page/ios/EventHandlerIOS.mm 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebCore/page/ios/EventHandlerIOS.mm 2017-01-26 02:01:29 UTC (rev 211192)
@@ -49,6 +49,10 @@
#import <WebKitAdditions/EventHandlerIOSTouch.cpp>
#endif
+#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/EventHandlerAdditions.mm>)
+#import <WebKitAdditions/EventHandlerAdditions.mm>
+#endif
+
namespace WebCore {
static RetainPtr<WebEvent>& currentEventSlot()
Modified: trunk/Source/WebCore/page/mac/EventHandlerMac.mm (211191 => 211192)
--- trunk/Source/WebCore/page/mac/EventHandlerMac.mm 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebCore/page/mac/EventHandlerMac.mm 2017-01-26 02:01:29 UTC (rev 211192)
@@ -74,10 +74,6 @@
namespace WebCore {
-#if ENABLE(DRAG_SUPPORT)
-const double EventHandler::TextDragDelay = 0.15;
-#endif
-
const double resetLatchedStateTimeout = 0.1;
static RetainPtr<NSEvent>& currentNSEventSlot()
Modified: trunk/Source/WebCore/platform/DragImage.cpp (211191 => 211192)
--- trunk/Source/WebCore/platform/DragImage.cpp 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebCore/platform/DragImage.cpp 2017-01-26 02:01:29 UTC (rev 211192)
@@ -120,6 +120,8 @@
return createDragImageFromSnapshot(snapshotNode(frame, node), &node);
}
+#if !ENABLE(DATA_INTERACTION)
+
DragImageRef createDragImageForSelection(Frame& frame, bool forceBlackText)
{
SnapshotOptions options = forceBlackText ? SnapshotOptionsForceBlackText : SnapshotOptionsNone;
@@ -126,6 +128,8 @@
return createDragImageFromSnapshot(snapshotSelection(frame, options), nullptr);
}
+#endif
+
struct ScopedFrameSelectionState {
ScopedFrameSelectionState(Frame& frame)
: frame(frame)
Modified: trunk/Source/WebCore/platform/Pasteboard.h (211191 => 211192)
--- trunk/Source/WebCore/platform/Pasteboard.h 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebCore/platform/Pasteboard.h 2017-01-26 02:01:29 UTC (rev 211192)
@@ -129,7 +129,7 @@
struct PasteboardPlainText {
String text;
-#if PLATFORM(MAC)
+#if PLATFORM(COCOA)
bool isURL;
#endif
};
@@ -179,8 +179,8 @@
virtual void writePasteboard(const Pasteboard& sourcePasteboard);
#if ENABLE(DRAG_SUPPORT)
- static std::unique_ptr<Pasteboard> createForDragAndDrop();
- static std::unique_ptr<Pasteboard> createForDragAndDrop(const DragData&);
+ WEBCORE_EXPORT static std::unique_ptr<Pasteboard> createForDragAndDrop();
+ WEBCORE_EXPORT static std::unique_ptr<Pasteboard> createForDragAndDrop(const DragData&);
virtual void setDragImage(DragImageRef, const IntPoint& hotSpot);
#endif
Modified: trunk/Source/WebCore/platform/ios/DragImageIOS.mm (211191 => 211192)
--- trunk/Source/WebCore/platform/ios/DragImageIOS.mm 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebCore/platform/ios/DragImageIOS.mm 2017-01-26 02:01:29 UTC (rev 211192)
@@ -28,6 +28,12 @@
#import <CoreGraphics/CoreGraphics.h>
+#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/DragImageAdditions.mm>)
+
+#import <WebKitAdditions/DragImageAdditions.mm>
+
+#else
+
namespace WebCore {
// FIXME: fix signature of dragImageSize() to avoid copying the argument.
@@ -49,3 +55,5 @@
}
} // namespace WebCore
+
+#endif // USE(APPLE_INTERNAL_SDK)
Modified: trunk/Source/WebCore/platform/ios/PasteboardIOS.mm (211191 => 211192)
--- trunk/Source/WebCore/platform/ios/PasteboardIOS.mm 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebCore/platform/ios/PasteboardIOS.mm 2017-01-26 02:01:29 UTC (rev 211192)
@@ -58,6 +58,10 @@
- (BOOL)containsAttachments;
@end
+#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/PasteboardAdditions.mm>)
+#import <WebKitAdditions/PasteboardAdditions.mm>
+#endif
+
namespace WebCore {
// FIXME: Does this need to be declared in the header file?
Modified: trunk/Source/WebCore/platform/mac/DragDataMac.mm (211191 => 211192)
--- trunk/Source/WebCore/platform/mac/DragDataMac.mm 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebCore/platform/mac/DragDataMac.mm 2017-01-26 02:01:29 UTC (rev 211192)
@@ -33,6 +33,54 @@
#import "PlatformStrategies.h"
#import "WebCoreNSURLExtras.h"
+#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/DragDataAdditions.mm>)
+
+#import <WebKitAdditions/DragDataAdditions.mm>
+
+#else
+
+static inline String rtfPasteboardType()
+{
+ return String(NSRTFPboardType);
+}
+
+static inline String rtfdPasteboardType()
+{
+ return String(NSRTFDPboardType);
+}
+
+static inline String stringPasteboardType()
+{
+ return String(NSStringPboardType);
+}
+
+static inline String urlPasteboardType()
+{
+ return String(NSURLPboardType);
+}
+
+static inline String htmlPasteboardType()
+{
+ return String(NSHTMLPboardType);
+}
+
+static inline String colorPasteboardType()
+{
+ return String(NSColorPboardType);
+}
+
+static inline String pdfPasteboardType()
+{
+ return String(NSPDFPboardType);
+}
+
+static inline String tiffPasteboardType()
+{
+ return String(NSTIFFPboardType);
+}
+
+#endif // USE(APPLE_INTERNAL_SDK)
+
namespace WebCore {
DragData::DragData(DragDataRef data, const IntPoint& clientPosition, const IntPoint& globalPosition,
@@ -42,7 +90,11 @@
, m_platformDragData(data)
, m_draggingSourceOperationMask(sourceOperationMask)
, m_applicationFlags(flags)
+#if PLATFORM(MAC)
, m_pasteboardName([[m_platformDragData draggingPasteboard] name])
+#else
+ , m_pasteboardName("data interaction pasteboard")
+#endif
{
}
@@ -66,30 +118,40 @@
{
Vector<String> types;
platformStrategies()->pasteboardStrategy()->getTypes(types, m_pasteboardName);
- return types.contains(String(NSColorPboardType));
+ return types.contains(colorPasteboardType());
}
bool DragData::containsFiles() const
{
+#if PLATFORM(MAC)
Vector<String> types;
platformStrategies()->pasteboardStrategy()->getTypes(types, m_pasteboardName);
return types.contains(String(NSFilenamesPboardType)) || types.contains(String(NSFilesPromisePboardType));
+#else
+ return false;
+#endif
}
unsigned DragData::numberOfFiles() const
{
Vector<String> files;
+#if PLATFORM(MAC)
platformStrategies()->pasteboardStrategy()->getPathnamesForType(files, String(NSFilenamesPboardType), m_pasteboardName);
if (!files.size())
platformStrategies()->pasteboardStrategy()->getPathnamesForType(files, String(NSFilesPromisePboardType), m_pasteboardName);
+#endif
return files.size();
}
void DragData::asFilenames(Vector<String>& result) const
{
+#if PLATFORM(MAC)
platformStrategies()->pasteboardStrategy()->getPathnamesForType(result, String(NSFilenamesPboardType), m_pasteboardName);
if (!result.size())
result = fileNames();
+#else
+ UNUSED_PARAM(result);
+#endif
}
bool DragData::containsPlainText() const
@@ -97,11 +159,13 @@
Vector<String> types;
platformStrategies()->pasteboardStrategy()->getTypes(types, m_pasteboardName);
- return types.contains(String(NSStringPboardType))
- || types.contains(String(NSRTFDPboardType))
- || types.contains(String(NSRTFPboardType))
+ return types.contains(stringPasteboardType())
+ || types.contains(rtfdPasteboardType())
+ || types.contains(rtfPasteboardType())
+#if PLATFORM(MAC)
|| types.contains(String(NSFilenamesPboardType))
- || platformStrategies()->pasteboardStrategy()->stringForType(String(NSURLPboardType), m_pasteboardName).length();
+#endif
+ || platformStrategies()->pasteboardStrategy()->stringForType(urlPasteboardType(), m_pasteboardName).length();
}
String DragData::asPlainText() const
@@ -130,16 +194,18 @@
Vector<String> types;
platformStrategies()->pasteboardStrategy()->getTypes(types, m_pasteboardName);
return types.contains(String(WebArchivePboardType))
- || types.contains(String(NSHTMLPboardType))
+ || types.contains(htmlPasteboardType())
+#if PLATFORM(MAC)
|| types.contains(String(NSFilenamesPboardType))
|| types.contains(String(NSFilesPromisePboardType))
- || types.contains(String(NSTIFFPboardType))
- || types.contains(String(NSPDFPboardType))
- || types.contains(String(NSURLPboardType))
- || types.contains(String(NSRTFDPboardType))
- || types.contains(String(NSRTFPboardType))
- || types.contains(String(NSStringPboardType))
- || types.contains(String(NSColorPboardType))
+#endif
+ || types.contains(tiffPasteboardType())
+ || types.contains(pdfPasteboardType())
+ || types.contains(urlPasteboardType())
+ || types.contains(rtfdPasteboardType())
+ || types.contains(rtfPasteboardType())
+ || types.contains(stringPasteboardType())
+ || types.contains(colorPasteboardType())
|| types.contains(String(kUTTypePNG));
}
@@ -146,7 +212,9 @@
bool DragData::containsPromise() const
{
Vector<String> files;
+#if PLATFORM(MAC)
platformStrategies()->pasteboardStrategy()->getPathnamesForType(files, String(NSFilesPromisePboardType), m_pasteboardName);
+#endif
return files.size() == 1;
}
@@ -160,16 +228,18 @@
// FIXME: Use filenamePolicy.
if (title) {
+#if PLATFORM(MAC)
String URLTitleString = platformStrategies()->pasteboardStrategy()->stringForType(String(WebURLNamePboardType), m_pasteboardName);
if (!URLTitleString.isEmpty())
*title = URLTitleString;
+#endif
}
Vector<String> types;
platformStrategies()->pasteboardStrategy()->getTypes(types, m_pasteboardName);
- if (types.contains(String(NSURLPboardType))) {
- NSURL *URLFromPasteboard = [NSURL URLWithString:platformStrategies()->pasteboardStrategy()->stringForType(String(NSURLPboardType), m_pasteboardName)];
+ if (types.contains(urlPasteboardType())) {
+ NSURL *URLFromPasteboard = [NSURL URLWithString:platformStrategies()->pasteboardStrategy()->stringForType(urlPasteboardType(), m_pasteboardName)];
NSString *scheme = [URLFromPasteboard scheme];
// Cannot drop other schemes unless <rdar://problem/10562662> and <rdar://problem/11187315> are fixed.
if ([scheme isEqualToString:@"http"] || [scheme isEqualToString:@"https"])
@@ -176,8 +246,8 @@
return [URLByCanonicalizingURL(URLFromPasteboard) absoluteString];
}
- if (types.contains(String(NSStringPboardType))) {
- NSURL *URLFromPasteboard = [NSURL URLWithString:platformStrategies()->pasteboardStrategy()->stringForType(String(NSStringPboardType), m_pasteboardName)];
+ if (types.contains(stringPasteboardType())) {
+ NSURL *URLFromPasteboard = [NSURL URLWithString:platformStrategies()->pasteboardStrategy()->stringForType(stringPasteboardType(), m_pasteboardName)];
NSString *scheme = [URLFromPasteboard scheme];
// Pasteboard content is not trusted, because _javascript_ code can modify it. We can sanitize it for URLs and other typed content, but not for strings.
// The result of this function is used to initiate navigation, so we shouldn't allow arbitrary file URLs.
@@ -186,6 +256,7 @@
return [URLByCanonicalizingURL(URLFromPasteboard) absoluteString];
}
+#if PLATFORM(MAC)
if (types.contains(String(NSFilenamesPboardType))) {
Vector<String> files;
platformStrategies()->pasteboardStrategy()->getPathnamesForType(files, String(NSFilenamesPboardType), m_pasteboardName);
@@ -199,6 +270,7 @@
if (types.contains(String(NSFilesPromisePboardType)) && fileNames().size() == 1)
return [URLByCanonicalizingURL([NSURL fileURLWithPath:fileNames()[0]]) absoluteString];
+#endif
return String();
}
Modified: trunk/Source/WebCore/platform/mac/DragImageMac.mm (211191 => 211192)
--- trunk/Source/WebCore/platform/mac/DragImageMac.mm 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebCore/platform/mac/DragImageMac.mm 2017-01-26 02:01:29 UTC (rev 211192)
@@ -26,7 +26,7 @@
#import "config.h"
#import "DragImage.h"
-#if ENABLE(DRAG_SUPPORT)
+#if ENABLE(DRAG_SUPPORT) && PLATFORM(MAC)
#import "BitmapImage.h"
#import "CoreGraphicsSPI.h"
@@ -348,4 +348,4 @@
} // namespace WebCore
-#endif // ENABLE(DRAG_SUPPORT)
+#endif // ENABLE(DRAG_SUPPORT) && PLATFORM(MAC)
Modified: trunk/Source/WebKit/mac/ChangeLog (211191 => 211192)
--- trunk/Source/WebKit/mac/ChangeLog 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebKit/mac/ChangeLog 2017-01-26 02:01:29 UTC (rev 211192)
@@ -1,3 +1,20 @@
+2017-01-25 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Refactor drag and drop implementation on Mac
+ https://bugs.webkit.org/show_bug.cgi?id=167427
+
+ Reviewed by Enrica Casucci.
+
+ Refactor some WebKit1 code on the Mac pertaining to drag and drop. See WebCore ChangeLog for more details.
+
+ * Misc/WebNSPasteboardExtras.h:
+ * WebCoreSupport/WebDragClient.mm:
+ * WebView/WebFrame.mm:
+ * WebView/WebFrameInternal.h:
+ * WebView/WebHTMLView.mm:
+ * WebView/WebView.mm:
+ (-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
+
2017-01-24 Youenn Fablet <youe...@gmail.com>
[WebRTC] Introduce libwebrtc abstraction for WK1/WK2 implementations
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm (211191 => 211192)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm 2017-01-26 02:01:29 UTC (rev 211192)
@@ -25,7 +25,7 @@
#import "WebDragClient.h"
-#if ENABLE(DRAG_SUPPORT)
+#if ENABLE(DRAG_SUPPORT) && PLATFORM(MAC)
#import "DOMElementInternal.h"
#import "WebArchive.h"
@@ -143,4 +143,4 @@
delete this;
}
-#endif // ENABLE(DRAG_SUPPORT)
+#endif // ENABLE(DRAG_SUPPORT) && PLATFORM(MAC)
Modified: trunk/Source/WebKit/mac/WebView/WebFrame.mm (211191 => 211192)
--- trunk/Source/WebKit/mac/WebView/WebFrame.mm 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebKit/mac/WebView/WebFrame.mm 2017-01-26 02:01:29 UTC (rev 211192)
@@ -933,7 +933,7 @@
_private->coreFrame->editor().computeAndSetTypingStyle(properties.get(), undoAction);
}
-#if ENABLE(DRAG_SUPPORT)
+#if ENABLE(DRAG_SUPPORT) && PLATFORM(MAC)
- (void)_dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation
{
if (!_private->coreFrame)
@@ -946,7 +946,7 @@
LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, currentTime(), WebCore::ForceAtClick, WebCore::NoTap);
_private->coreFrame->eventHandler().dragSourceEndedAt(event, (DragOperation)operation);
}
-#endif
+#endif // ENABLE(DRAG_SUPPORT) && PLATFORM(MAC)
- (BOOL)_canProvideDocumentSource
{
Modified: trunk/Source/WebKit/mac/WebView/WebFrameInternal.h (211191 => 211192)
--- trunk/Source/WebKit/mac/WebView/WebFrameInternal.h 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebKit/mac/WebView/WebFrameInternal.h 2017-01-26 02:01:29 UTC (rev 211192)
@@ -179,7 +179,7 @@
- (DOMCSSStyleDeclaration *)_typingStyle;
- (void)_setTypingStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(WebCore::EditAction)undoAction;
-#if ENABLE(DRAG_SUPPORT)
+#if ENABLE(DRAG_SUPPORT) && PLATFORM(MAC)
- (void)_dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation;
#endif
Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (211191 => 211192)
--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm 2017-01-26 02:01:29 UTC (rev 211192)
@@ -4544,7 +4544,7 @@
}
#endif
-#if ENABLE(DRAG_SUPPORT)
+#if ENABLE(DRAG_SUPPORT) && PLATFORM(MAC)
- (void)dragImage:(NSImage *)dragImage
at:(NSPoint)at
offset:(NSSize)offset
@@ -4688,7 +4688,7 @@
return [NSArray arrayWithObject:[path lastPathComponent]];
}
-#endif
+#endif // ENABLE(DRAG_SUPPORT) && PLATFORM(MAC)
#if !PLATFORM(IOS)
- (void)mouseUp:(NSEvent *)event
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (211191 => 211192)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2017-01-26 02:01:29 UTC (rev 211192)
@@ -1608,7 +1608,7 @@
makeUniqueRef<WebCore::LibWebRTCProvider>()
);
pageConfiguration.chromeClient = new WebChromeClientIOS(self);
-#if ENABLE(DRAG_SUPPORT)
+#if ENABLE(DRAG_SUPPORT) && PLATFORM(MAC)
pageConfiguration.dragClient = new WebDragClient(self);
#endif
@@ -6475,7 +6475,7 @@
return [self _elementAtWindowPoint:[self convertPoint:point toView:nil]];
}
-#if ENABLE(DRAG_SUPPORT)
+#if ENABLE(DRAG_SUPPORT) && PLATFORM(MAC)
// The following 2 internal NSView methods are called on the drag destination to make scrolling while dragging work.
// Scrolling while dragging will only work if the drag destination is in a scroll view. The WebView is the drag destination.
// When dragging to a WebView, the document subview should scroll, but it doesn't because it is not the drag destination.
@@ -6596,7 +6596,7 @@
return self;
return hitView;
}
-#endif
+#endif // ENABLE(DRAG_SUPPORT) && PLATFORM(MAC)
- (BOOL)acceptsFirstResponder
{
Modified: trunk/Source/WebKit2/ChangeLog (211191 => 211192)
--- trunk/Source/WebKit2/ChangeLog 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebKit2/ChangeLog 2017-01-26 02:01:29 UTC (rev 211192)
@@ -1,3 +1,18 @@
+2017-01-25 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Refactor drag and drop implementation on Mac
+ https://bugs.webkit.org/show_bug.cgi?id=167427
+
+ Reviewed by Enrica Casucci.
+
+ See WebCore ChangeLog for more details.
+
+ * Shared/WebCoreArgumentCoders.cpp:
+ (IPC::ArgumentCoder<DragData>::encode):
+ (IPC::ArgumentCoder<DragData>::decode):
+ * UIProcess/Cocoa/WebPageProxyCocoa.mm:
+ * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
+
2017-01-25 Andy Estes <aes...@apple.com>
Use #pragma once in a few places
Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (211191 => 211192)
--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp 2017-01-26 02:01:29 UTC (rev 211192)
@@ -1223,8 +1223,10 @@
encoder << dragData.globalPosition();
encoder.encodeEnum(dragData.draggingSourceOperationMask());
encoder.encodeEnum(dragData.flags());
+#if PLATFORM(COCOA)
+ encoder << dragData.pasteboardName();
+#endif
#if PLATFORM(MAC)
- encoder << dragData.pasteboardName();
encoder << dragData.fileNames();
#endif
}
@@ -1248,13 +1250,15 @@
return false;
String pasteboardName;
-#if PLATFORM(MAC)
+#if PLATFORM(COCOA)
if (!decoder.decode(pasteboardName))
return false;
#endif
Vector<String> fileNames;
+#if PLATFORM(MAC)
if (!decoder.decode(fileNames))
return false;
+#endif
dragData = DragData(pasteboardName, clientPosition, globalPosition, draggingSourceOperationMask, applicationFlags);
dragData.setFileNames(fileNames);
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebPageProxyCocoa.mm (211191 => 211192)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebPageProxyCocoa.mm 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebPageProxyCocoa.mm 2017-01-26 02:01:29 UTC (rev 211192)
@@ -34,6 +34,10 @@
#import <WebCore/ValidationBubble.h>
#import <wtf/cf/TypeCastsCF.h>
+#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/WebPageProxyAdditions.mm>)
+#import <WebKitAdditions/WebPageProxyAdditions.mm>
+#endif
+
namespace WebKit {
#if ENABLE(DATA_DETECTION)
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm (211191 => 211192)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm 2017-01-26 01:43:44 UTC (rev 211191)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm 2017-01-26 02:01:29 UTC (rev 211192)
@@ -51,6 +51,12 @@
using namespace WebCore;
using namespace WebKit;
+#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/WebDragClientAdditions.mm>)
+#import <WebKitAdditions/WebDragClientAdditions.mm>
+#endif
+
+#if PLATFORM(MAC)
+
namespace WebKit {
static PassRefPtr<ShareableBitmap> convertImageToBitmap(NSImage *image, const IntSize& size, Frame& frame)
@@ -160,4 +166,6 @@
} // namespace WebKit
+#endif // PLATFORM(MAC)
+
#endif // ENABLE(DRAG_SUPPORT)