Diff
Modified: trunk/Source/WebCore/ChangeLog (218854 => 218855)
--- trunk/Source/WebCore/ChangeLog 2017-06-27 23:55:27 UTC (rev 218854)
+++ trunk/Source/WebCore/ChangeLog 2017-06-28 00:36:31 UTC (rev 218855)
@@ -1,3 +1,31 @@
+2017-06-27 Wenson Hsieh <wenson_hs...@apple.com>
+
+ [iOS DnD] Support dragging out of contenteditable areas without a prior selection
+ https://bugs.webkit.org/show_bug.cgi?id=173854
+ <rdar://problem/32236827>
+
+ Reviewed by Ryosuke Niwa and Tim Horton.
+
+ Allows elements to be dragged from contenteditable areas for both WebKit1 and WebKit2 iOS. There are two main
+ changes in WebCore: move the touch point adjustment code into EventHandler::tryToBeginDataInteractionAtPoint, so
+ that the clientPosition specified will be adjusted to an appropriate clickable node if needed. This is necessary
+ because UIWebDocumentView and WKContentView no longer send adjusted points to WebCore when requesting drag
+ start. See <https://bugs.webkit.org/show_bug.cgi?id=173855> for a followup regarding the globalPosition and
+ clientPositions passed in to the MouseEvents when performing a drag or synthetic click.
+
+ Secondly, image elements in Mail's contenteditable area are not draggable unless the heuristic in
+ DragController::draggableElement is tweaked to not reject image dragging across the board if the
+ loadsImagesAutomatically setting is turned off. Instead, even if images are not automatically loaded, allow the
+ image drag to commence if the image renderer already has a cached image.
+
+ Test: DataInteractionTests.DragImageFromContentEditable
+
+ * page/DragController.cpp:
+ (WebCore::imageElementIsDraggable):
+ (WebCore::DragController::draggableElement):
+ * page/ios/EventHandlerIOS.mm:
+ (WebCore::EventHandler::tryToBeginDataInteractionAtPoint):
+
2017-06-27 Antoine Quint <grao...@apple.com>
[Modern Media Controls] Accessibility labels should be formatted using NSDateComponentsFormatter
Modified: trunk/Source/WebCore/page/DragController.cpp (218854 => 218855)
--- trunk/Source/WebCore/page/DragController.cpp 2017-06-27 23:55:27 UTC (rev 218854)
+++ trunk/Source/WebCore/page/DragController.cpp 2017-06-28 00:36:31 UTC (rev 218855)
@@ -713,6 +713,19 @@
return true;
}
+static bool imageElementIsDraggable(const HTMLImageElement& image, const Frame& sourceFrame)
+{
+ if (sourceFrame.settings().loadsImagesAutomatically())
+ return true;
+
+ auto* renderer = image.renderer();
+ if (!is<RenderImage>(renderer))
+ return false;
+
+ auto* cachedImage = downcast<RenderImage>(*renderer).cachedImage();
+ return cachedImage && !cachedImage->errorOccurred() && cachedImage->imageForRenderer(renderer);
+}
+
Element* DragController::draggableElement(const Frame* sourceFrame, Element* startElement, const IntPoint& dragOrigin, DragState& state) const
{
state.type = (sourceFrame->selection().contains(dragOrigin)) ? DragSourceActionSelection : DragSourceActionNone;
@@ -748,7 +761,7 @@
if (dragMode == DRAG_AUTO) {
if ((m_dragSourceAction & DragSourceActionImage)
&& is<HTMLImageElement>(*element)
- && sourceFrame->settings().loadsImagesAutomatically()) {
+ && imageElementIsDraggable(downcast<HTMLImageElement>(*element), *sourceFrame)) {
state.type = static_cast<DragSourceAction>(state.type | DragSourceActionImage);
return element;
}
Modified: trunk/Source/WebCore/page/ios/EventHandlerIOS.mm (218854 => 218855)
--- trunk/Source/WebCore/page/ios/EventHandlerIOS.mm 2017-06-27 23:55:27 UTC (rev 218854)
+++ trunk/Source/WebCore/page/ios/EventHandlerIOS.mm 2017-06-28 00:36:31 UTC (rev 218855)
@@ -572,19 +572,30 @@
return false;
}
-bool EventHandler::tryToBeginDataInteractionAtPoint(const IntPoint& clientPosition, const IntPoint& globalPosition)
+bool EventHandler::tryToBeginDataInteractionAtPoint(const IntPoint& clientPosition, const IntPoint&)
{
Ref<Frame> protectedFrame(m_frame);
- PlatformMouseEvent syntheticMousePressEvent(clientPosition, globalPosition, LeftButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime(), 0, NoTap);
- PlatformMouseEvent syntheticMouseMoveEvent(clientPosition, globalPosition, LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, currentTime(), 0, NoTap);
+ auto* document = m_frame.document();
+ if (!document)
+ return false;
+ document->updateLayoutIgnorePendingStylesheets();
+
+ FloatPoint adjustedClientPositionAsFloatPoint(clientPosition);
+ protectedFrame->nodeRespondingToClickEvents(clientPosition, adjustedClientPositionAsFloatPoint);
+ IntPoint adjustedClientPosition = roundedIntPoint(adjustedClientPositionAsFloatPoint);
+ IntPoint adjustedGlobalPosition = protectedFrame->view()->windowToContents(adjustedClientPosition);
+
+ PlatformMouseEvent syntheticMousePressEvent(adjustedClientPosition, adjustedGlobalPosition, LeftButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime(), 0, NoTap);
+ PlatformMouseEvent syntheticMouseMoveEvent(adjustedClientPosition, adjustedGlobalPosition, LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, currentTime(), 0, NoTap);
+
HitTestRequest request(HitTestRequest::Active | HitTestRequest::DisallowUserAgentShadowContent);
auto documentPoint = protectedFrame->view() ? protectedFrame->view()->windowToContents(syntheticMouseMoveEvent.position()) : syntheticMouseMoveEvent.position();
- auto hitTestedMouseEvent = m_frame.document()->prepareMouseEvent(request, documentPoint, syntheticMouseMoveEvent);
+ auto hitTestedMouseEvent = document->prepareMouseEvent(request, documentPoint, syntheticMouseMoveEvent);
RefPtr<Frame> subframe = subframeForHitTestResult(hitTestedMouseEvent);
- if (subframe && subframe->eventHandler().tryToBeginDataInteractionAtPoint(clientPosition, globalPosition))
+ if (subframe && subframe->eventHandler().tryToBeginDataInteractionAtPoint(adjustedClientPosition, adjustedGlobalPosition))
return true;
// FIXME: This needs to be refactored, along with handleMousePressEvent and handleMouseMoveEvent, so that state associated only with dragging
@@ -597,7 +608,6 @@
dragState().source = nullptr;
dragState().draggedContentRange = nullptr;
m_mouseDownPos = protectedFrame->view()->windowToContents(syntheticMouseMoveEvent.position());
- protectedFrame->document()->updateStyleIfNeeded();
return handleMouseDraggedEvent(hitTestedMouseEvent, DontCheckDragHysteresis);
}
Modified: trunk/Source/WebKit/mac/ChangeLog (218854 => 218855)
--- trunk/Source/WebKit/mac/ChangeLog 2017-06-27 23:55:27 UTC (rev 218854)
+++ trunk/Source/WebKit/mac/ChangeLog 2017-06-28 00:36:31 UTC (rev 218855)
@@ -1,5 +1,26 @@
2017-06-27 Wenson Hsieh <wenson_hs...@apple.com>
+ [iOS DnD] Support dragging out of contenteditable areas without a prior selection
+ https://bugs.webkit.org/show_bug.cgi?id=173854
+ <rdar://problem/32236827>
+
+ Reviewed by Ryosuke Niwa and Tim Horton.
+
+ Vends some information from the DragItem passed into -[WebView _startDrag:] through the WebView as SPI for
+ WebKit1 clients. No behavior change with these changes alone -- see <rdar://problem/32991062> for more detail.
+
+ * WebView/WebView.mm:
+ (-[WebView _startDrag:]):
+ (-[WebView _dragSourceAction]):
+ (-[WebView _draggedLinkTitle]):
+ (-[WebView _draggedLinkURL]):
+ (-[WebView _draggedElementBounds]):
+ (-[WebView _endedDataInteraction:global:]):
+ * WebView/WebViewData.h:
+ * WebView/WebViewPrivate.h:
+
+2017-06-26 Wenson Hsieh <wenson_hs...@apple.com>
+
Refactor drag start codepaths to plumb a DragItem to client layers
https://bugs.webkit.org/show_bug.cgi?id=173832
Work towards <rdar://problem/32236827>
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (218854 => 218855)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2017-06-27 23:55:27 UTC (rev 218854)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2017-06-28 00:36:31 UTC (rev 218855)
@@ -1840,6 +1840,10 @@
_private->textIndicatorData = adoptNS([[WebUITextIndicatorData alloc] initWithImage:image textIndicatorData:indicatorData.value() scale:_private->page->deviceScaleFactor()]);
else
_private->textIndicatorData = adoptNS([[WebUITextIndicatorData alloc] initWithImage:image scale:_private->page->deviceScaleFactor()]);
+ _private->draggedLinkURL = dragItem.url.isEmpty() ? nil : (NSURL *)dragItem.url;
+ _private->draggedLinkTitle = dragItem.title.isEmpty() ? nil : (NSString *)dragItem.title;
+ _private->draggedElementBounds = dragItem.elementBounds;
+ _private->dragSourceAction = static_cast<WebDragSourceAction>(dragItem.sourceAction);
}
- (CGRect)_dataInteractionCaretRect
@@ -1855,6 +1859,26 @@
return _private->dataOperationTextIndicator.get();
}
+- (WebDragSourceAction)_dragSourceAction
+{
+ return _private->dragSourceAction;
+}
+
+- (NSString *)_draggedLinkTitle
+{
+ return _private->draggedLinkTitle.get();
+}
+
+- (NSURL *)_draggedLinkURL
+{
+ return _private->draggedLinkURL.get();
+}
+
+- (CGRect)_draggedElementBounds
+{
+ return _private->draggedElementBounds;
+}
+
- (WebUITextIndicatorData *)_getDataInteractionData
{
return _private->textIndicatorData.get();
@@ -1908,6 +1932,10 @@
WebThreadLock();
_private->page->dragController().dragEnded();
_private->dataOperationTextIndicator = nullptr;
+ _private->draggedElementBounds = CGRectNull;
+ _private->dragSourceAction = WebDragSourceActionNone;
+ _private->draggedLinkTitle = nil;
+ _private->draggedLinkURL = nil;
}
- (void)_didConcludeEditDataInteraction
Modified: trunk/Source/WebKit/mac/WebView/WebViewData.h (218854 => 218855)
--- trunk/Source/WebKit/mac/WebView/WebViewData.h 2017-06-27 23:55:27 UTC (rev 218854)
+++ trunk/Source/WebKit/mac/WebView/WebViewData.h 2017-06-28 00:36:31 UTC (rev 218855)
@@ -29,6 +29,7 @@
#import "WebTypesInternal.h"
#import "WebDelegateImplementationCaching.h"
+#import "WebUIDelegate.h"
#if HAVE(TOUCH_BAR)
#import <WebCore/AVKitSPI.h>
#endif
@@ -300,6 +301,10 @@
#if ENABLE(DATA_INTERACTION)
RetainPtr<WebUITextIndicatorData> textIndicatorData;
RetainPtr<WebUITextIndicatorData> dataOperationTextIndicator;
+ CGRect draggedElementBounds;
+ WebDragSourceAction dragSourceAction;
+ RetainPtr<NSURL> draggedLinkURL;
+ RetainPtr<NSString> draggedLinkTitle;
#endif
Modified: trunk/Source/WebKit/mac/WebView/WebViewPrivate.h (218854 => 218855)
--- trunk/Source/WebKit/mac/WebView/WebViewPrivate.h 2017-06-27 23:55:27 UTC (rev 218854)
+++ trunk/Source/WebKit/mac/WebView/WebViewPrivate.h 2017-06-28 00:36:31 UTC (rev 218855)
@@ -473,6 +473,10 @@
- (BOOL)_requestStartDataInteraction:(CGPoint)clientPosition globalPosition:(CGPoint)globalPosition;
- (WebUITextIndicatorData *)_getDataInteractionData;
@property (nonatomic, readonly, strong, getter=_dataOperationTextIndicator) WebUITextIndicatorData *dataOperationTextIndicator;
+@property (nonatomic, readonly) NSUInteger _dragSourceAction;
+@property (nonatomic, strong, readonly) NSString *_draggedLinkTitle;
+@property (nonatomic, strong, readonly) NSURL *_draggedLinkURL;
+@property (nonatomic, readonly) CGRect _draggedElementBounds;
- (uint64_t)_enteredDataInteraction:(id <UIDropSession>)session client:(CGPoint)clientPosition global:(CGPoint)globalPosition operation:(uint64_t)operation;
- (uint64_t)_updatedDataInteraction:(id <UIDropSession>)session client:(CGPoint)clientPosition global:(CGPoint)globalPosition operation:(uint64_t)operation;
- (void)_exitedDataInteraction:(id <UIDropSession>)session client:(CGPoint)clientPosition global:(CGPoint)globalPosition operation:(uint64_t)operation;
Modified: trunk/Source/WebKit2/ChangeLog (218854 => 218855)
--- trunk/Source/WebKit2/ChangeLog 2017-06-27 23:55:27 UTC (rev 218854)
+++ trunk/Source/WebKit2/ChangeLog 2017-06-28 00:36:31 UTC (rev 218855)
@@ -1,3 +1,32 @@
+2017-06-27 Wenson Hsieh <wenson_hs...@apple.com>
+
+ [iOS DnD] Support dragging out of contenteditable areas without a prior selection
+ https://bugs.webkit.org/show_bug.cgi?id=173854
+ <rdar://problem/32236827>
+
+ Reviewed by Ryosuke Niwa and Tim Horton.
+
+ Instead of allowing a drag to occur only if a position information request discovers a clickable node, remove
+ the position information request entirely and just call into WebCore to try and begin the drag. Currently, the
+ position information request serves two purposes:
+ 1. To adjust the hit-test location to account for nearby clickable nodes.
+ 2. To obtain information about the content being dragged.
+
+ The first requirement is fulfilled by performing the drag location adjustment in WebCore instead (see
+ ChangeLogs for more detail). The second requirement is fulfilled by refactoring in
+ https://bugs.webkit.org/show_bug.cgi?id=173832 to fold all information relevant to starting a drag into the
+ DragItem struct, and then propagating the DragItem struct. The relevant information from the position
+ information update is now populated when the UI process receives the drag start response.
+
+ * UIProcess/ios/WKContentViewInteraction.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _startDrag:item:]):
+ (-[WKContentView computeClientAndGlobalPointsForDropSession:outClientPoint:outGlobalPoint:]):
+ (-[WKContentView _dragInteraction:prepareForSession:completion:]):
+ (-[WKContentView _api_dropInteraction:sessionDidEnter:]):
+ (-[WKContentView _api_dropInteraction:sessionDidUpdate:]):
+ (positionInformationMayStartDataInteraction): Deleted.
+
2017-06-27 Chris Dumez <cdu...@apple.com>
[iOS] Avoid taking / releasing process assertions too quickly due to database activity
Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (218854 => 218855)
--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm 2017-06-27 23:55:27 UTC (rev 218854)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm 2017-06-28 00:36:31 UTC (rev 218855)
@@ -4228,6 +4228,10 @@
_dataInteractionState.image = adoptNS([[UIImage alloc] initWithCGImage:image.get() scale:_page->deviceScaleFactor() orientation:UIImageOrientationUp]);
_dataInteractionState.indicatorData = item.image.indicatorData();
_dataInteractionState.sourceAction = static_cast<DragSourceAction>(item.sourceAction);
+ _dataInteractionState.adjustedOrigin = item.eventPositionInContentCoordinates;
+ _dataInteractionState.elementBounds = item.elementBounds;
+ _dataInteractionState.linkTitle = item.title.isEmpty() ? nil : (NSString *)item.title;
+ _dataInteractionState.linkURL = item.url.isEmpty() ? nil : (NSURL *)item.url;
}
- (void)_didHandleStartDataInteractionRequest:(BOOL)started
@@ -4500,11 +4504,6 @@
return WKDragDestinationActionAny & ~WKDragDestinationActionLoad;
}
-static BOOL positionInformationMayStartDataInteraction(const InteractionInformationAtPosition& positionInformation)
-{
- return positionInformation.isImage || positionInformation.isLink || positionInformation.isAttachment || positionInformation.hasSelectionAtPosition;
-}
-
- (id <UIDragDropSession>)currentDragOrDropSession
{
if (_dataInteractionState.dropSession)
@@ -4528,28 +4527,12 @@
[self cleanUpDragSourceSessionState];
- CGPoint dragOrigin = [session locationInView:self];
- RetainPtr<WKContentView> retainedSelf(self);
+ auto dragOrigin = roundedIntPoint([session locationInView:self]);
+ _dataInteractionState.dragStartCompletionBlock = completion;
+ _dataInteractionState.dragSession = session;
+ _page->requestStartDataInteraction(dragOrigin, roundedIntPoint([self convertPoint:dragOrigin toView:self.window]));
- [self doAfterPositionInformationUpdate:[retainedSelf, session, dragOrigin, capturedBlock = makeBlockPtr(completion)] (InteractionInformationAtPosition positionInformation) {
- if (!positionInformationMayStartDataInteraction(positionInformation)) {
- RELEASE_LOG(DragAndDrop, "Drag session failed: %p (no draggable content at {%.1f, %.1f})", session, dragOrigin.x, dragOrigin.y);
- capturedBlock();
- return;
- }
-
- auto& state = retainedSelf->_dataInteractionState;
- state.dragStartCompletionBlock = capturedBlock;
- state.adjustedOrigin = retainedSelf->_positionInformation.adjustedPointForNodeRespondingToClickEvents;
- state.elementBounds = retainedSelf->_positionInformation.bounds;
- state.linkTitle = retainedSelf->_positionInformation.title;
- state.linkURL = retainedSelf->_positionInformation.url;
- state.dragSession = session;
- retainedSelf->_page->requestStartDataInteraction(roundedIntPoint(state.adjustedOrigin), roundedIntPoint([retainedSelf convertPoint:state.adjustedOrigin toView:[retainedSelf window]]));
-
- auto elementBounds = state.elementBounds;
- RELEASE_LOG(DragAndDrop, "Drag session requested: %p at element bounds: {{%.1f, %.1f}, {%.1f, %.1f}}", session, elementBounds.origin.x, elementBounds.origin.y, elementBounds.size.width, elementBounds.size.height);
- } forRequest:InteractionInformationRequest(roundedIntPoint(dragOrigin))];
+ RELEASE_LOG(DragAndDrop, "Drag session requested: %p at origin: {%d, %d}", session, dragOrigin.x(), dragOrigin.y());
}
- (NSArray<UIDragItem *> *)dragInteraction:(UIDragInteraction *)interaction itemsForBeginningSession:(id <UIDragSession>)session
Modified: trunk/Tools/ChangeLog (218854 => 218855)
--- trunk/Tools/ChangeLog 2017-06-27 23:55:27 UTC (rev 218854)
+++ trunk/Tools/ChangeLog 2017-06-28 00:36:31 UTC (rev 218855)
@@ -1,3 +1,18 @@
+2017-06-27 Wenson Hsieh <wenson_hs...@apple.com>
+
+ [iOS DnD] Support dragging out of contenteditable areas without a prior selection
+ https://bugs.webkit.org/show_bug.cgi?id=173854
+ <rdar://problem/32236827>
+
+ Reviewed by Ryosuke Niwa and Tim Horton.
+
+ Adds a new test to check that an image can be dragged out of a contenteditable and dropped.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2Cocoa/contenteditable-and-target.html: Added.
+ * TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
+ (TestWebKitAPI::TEST):
+
2017-06-27 Don Olmstead <don.olmst...@sony.com>
[PAL] Add symbol export macros for PAL
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (218854 => 218855)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2017-06-27 23:55:27 UTC (rev 218854)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2017-06-28 00:36:31 UTC (rev 218855)
@@ -642,6 +642,7 @@
F4538EF71E8473E600B5C953 /* large-red-square.png in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4538EF01E846B4100B5C953 /* large-red-square.png */; };
F46849BE1EEF58E400B937FE /* UIPasteboardTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F46849BD1EEF58E400B937FE /* UIPasteboardTests.mm */; };
F46849C01EEF5EF300B937FE /* rich-and-plain-text.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F46849BF1EEF5EDC00B937FE /* rich-and-plain-text.html */; };
+ F469FB241F01804B00401539 /* contenteditable-and-target.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F469FB231F01803500401539 /* contenteditable-and-target.html */; };
F46A095A1ED8A6E600D4AA55 /* apple.gif in Copy Resources */ = {isa = PBXBuildFile; fileRef = F47D30EB1ED28619000482E1 /* apple.gif */; };
F46A095B1ED8A6E600D4AA55 /* gif-and-file-input.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F47D30ED1ED28A6C000482E1 /* gif-and-file-input.html */; };
F47728991E4AE3C1007ABF6A /* full-page-contenteditable.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F47728981E4AE3AD007ABF6A /* full-page-contenteditable.html */; };
@@ -727,6 +728,7 @@
dstPath = TestWebKitAPI.resources;
dstSubfolderSpec = 7;
files = (
+ F469FB241F01804B00401539 /* contenteditable-and-target.html in Copy Resources */,
F4B825D81EF4DBFB006E417F /* compressed-files.zip in Copy Resources */,
F41AB99F1EF4696B0083FA08 /* autofocus-contenteditable.html in Copy Resources */,
F41AB9A01EF4696B0083FA08 /* background-image-link-and-input.html in Copy Resources */,
@@ -1609,6 +1611,7 @@
F4538EF01E846B4100B5C953 /* large-red-square.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "large-red-square.png"; sourceTree = "<group>"; };
F46849BD1EEF58E400B937FE /* UIPasteboardTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = UIPasteboardTests.mm; sourceTree = "<group>"; };
F46849BF1EEF5EDC00B937FE /* rich-and-plain-text.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "rich-and-plain-text.html"; sourceTree = "<group>"; };
+ F469FB231F01803500401539 /* contenteditable-and-target.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "contenteditable-and-target.html"; sourceTree = "<group>"; };
F47728981E4AE3AD007ABF6A /* full-page-contenteditable.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "full-page-contenteditable.html"; sourceTree = "<group>"; };
F47D30EB1ED28619000482E1 /* apple.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = apple.gif; sourceTree = "<group>"; };
F47D30ED1ED28A6C000482E1 /* gif-and-file-input.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "gif-and-file-input.html"; sourceTree = "<group>"; };
@@ -2008,6 +2011,7 @@
F4B825D61EF4DBD4006E417F /* compressed-files.zip */,
F41AB9981EF4692C0083FA08 /* autofocus-contenteditable.html */,
F41AB9971EF4692C0083FA08 /* background-image-link-and-input.html */,
+ F469FB231F01803500401539 /* contenteditable-and-target.html */,
F41AB99C1EF4692C0083FA08 /* contenteditable-and-textarea.html */,
F41AB99E1EF4692C0083FA08 /* div-and-large-image.html */,
F41AB99B1EF4692C0083FA08 /* file-uploading.html */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/contenteditable-and-target.html (0 => 218855)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/contenteditable-and-target.html (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/contenteditable-and-target.html 2017-06-28 00:36:31 UTC (rev 218855)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta name="viewport" content="width=device-width">
+ <style>
+ body {
+ width: 100%;
+ height: 100%;
+ margin: 0;
+ }
+
+ img {
+ height: 200px;
+ }
+
+ #source, #target {
+ width: 100%;
+ height: 200px;
+ font-size: 150px;
+ white-space: nowrap;
+ box-sizing: border-box;
+ }
+
+ #target {
+ border: green 1px dashed;
+ color: green;
+ border-width: 5px;
+ }
+ </style>
+</head>
+
+<body>
+ <div contenteditable id="source"><img src=""
+ <code><div id="target"></div></code>
+ <script>
+ target.addEventListener("dragenter", event => event.preventDefault());
+ target.addEventListener("dragover", event => event.preventDefault());
+ target.addEventListener("drop", event => {
+ target.textContent = "PASS";
+ event.preventDefault();
+ });
+ </script>
+</body>
+</html>
Modified: trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm (218854 => 218855)
--- trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm 2017-06-27 23:55:27 UTC (rev 218854)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm 2017-06-28 00:36:31 UTC (rev 218855)
@@ -274,6 +274,17 @@
checkSelectionRectsWithLogging(@[ makeCGRectValue(190, 100, 130, 20), makeCGRectValue(0, 120, 320, 100), makeCGRectValue(0, 220, 252, 20) ], [dataInteractionSimulator finalSelectionRects]);
}
+TEST(DataInteractionTests, DragImageFromContentEditable)
+{
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
+ auto dataInteractionSimulator = adoptNS([[DataInteractionSimulator alloc] initWithWebView:webView.get()]);
+
+ [webView synchronouslyLoadTestPageNamed:@"contenteditable-and-target"];
+ [dataInteractionSimulator runFrom:CGPointMake(100, 100) to:CGPointMake(100, 300)];
+
+ EXPECT_WK_STREQ("PASS", [webView stringByEvaluatingJavaScript:@"target.textContent"]);
+}
+
TEST(DataInteractionTests, TextAreaToInput)
{
RetainPtr<TestWKWebView> webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);