Revert accidentally smushed commit.
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Apr 2017 01:01:57 +0000 (01:01 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Apr 2017 01:01:57 +0000 (01:01 +0000)
* editing/cocoa/DataDetection.h:
* editing/cocoa/DataDetection.mm:
(WebCore::DataDetection::dataDetectorURLProtocol): Deleted.
(WebCore::DataDetection::isDataDetectorURL): Deleted.
* page/DragController.cpp:
(WebCore::isDraggableLink):
* platform/mac/DragImageMac.mm:
(WebCore::createDragImageForLink):

* TestExpectations:
* fast/events/do-not-drag-and-drop-data-detectors-link-expected.txt: Removed.
* fast/events/do-not-drag-and-drop-data-detectors-link.html: Removed.
* platform/mac/TestExpectations:

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

LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/fast/events/do-not-drag-and-drop-data-detectors-link-expected.txt [deleted file]
LayoutTests/fast/events/do-not-drag-and-drop-data-detectors-link.html [deleted file]
LayoutTests/platform/mac/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/editing/cocoa/DataDetection.h
Source/WebCore/editing/cocoa/DataDetection.mm
Source/WebCore/page/DragController.cpp
Source/WebCore/platform/mac/DragImageMac.mm

index a6ccb0e..c156456 100644 (file)
@@ -1,13 +1,11 @@
 2017-04-26  Tim Horton  <timothy_horton@apple.com>
 
-        Should not drag x-apple-data-detectors links
-        https://bugs.webkit.org/show_bug.cgi?id=171352
-        <rdar://problem/31309081>
+        Revert accidentally smushed commit.
 
-        Reviewed by Beth Dakin.
-
-        * fast/events/do-not-drag-and-drop-data-detectors-link-expected.txt: Added.
-        * fast/events/do-not-drag-and-drop-data-detectors-link.html: Added.
+        * TestExpectations:
+        * fast/events/do-not-drag-and-drop-data-detectors-link-expected.txt: Removed.
+        * fast/events/do-not-drag-and-drop-data-detectors-link.html: Removed.
+        * platform/mac/TestExpectations:
 
 2017-04-26  Matt Lewis  <jlewis3@apple.com>
 
index c75204a..ceee8e4 100644 (file)
@@ -106,9 +106,6 @@ fast/visual-viewport/rubberbanding-viewport-rects-header-footer.html  [ Skip ]
 # FKA focus ring only make sense on Mac
 media/modern-media-controls/icon-button/icon-button-focus-state.html [ Skip ]
 
-# DataDetectors tests only make sense on Mac
-fast/events/do-not-drag-and-drop-data-detectors-link.html [ Skip ]
-
 #//////////////////////////////////////////////////////////////////////////////////////////
 # End platform-specific tests.
 #//////////////////////////////////////////////////////////////////////////////////////////
diff --git a/LayoutTests/fast/events/do-not-drag-and-drop-data-detectors-link-expected.txt b/LayoutTests/fast/events/do-not-drag-and-drop-data-detectors-link-expected.txt
deleted file mode 100644 (file)
index 6e21ec4..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-This test checks that drag-and-drop is blocked for Data Detectors links.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-Trying to drag Data Detectors link (should fail)
-
-
-TEST COMPLETE
-
diff --git a/LayoutTests/fast/events/do-not-drag-and-drop-data-detectors-link.html b/LayoutTests/fast/events/do-not-drag-and-drop-data-detectors-link.html
deleted file mode 100644 (file)
index 51e55ad..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src="../../resources/js-test-pre.js"></script>
-<script>
-var ddLink;
-var didDragStart = false;
-
-window.jsTestIsAsync = true;
-
-window.onload = function ()
-{
-    ddLink = document.getElementById("ddLink");
-
-    ddLink.ondragstart = dragStart;
-    document.body.onmouseup = mouseUp;
-
-    runTests();
-}
-
-function dragStart(e)
-{
-    didDragStart = true;
-    debug('<br><span class="fail">FAIL! Got dragStart().</span>');
-}
-
-function mouseUp(e)
-{
-    var testContainer = document.getElementById("test-container");
-    if (testContainer)
-        document.body.removeChild(testContainer);
-    if (!didDragStart)
-        debug('<br><span class="pass">TEST COMPLETE</span>');
-    finishJSTest();
-}
-
-function dragAndDrop(beginX, beginY, endX, endY)
-{
-    if (!window.eventSender)
-        return;
-    eventSender.mouseMoveTo(beginX, beginY);
-    eventSender.mouseDown();
-    eventSender.leapForward(100);
-    eventSender.mouseMoveTo(endX, endY);
-    eventSender.mouseUp();
-}
-
-function runTests()
-{
-    if (!window.testRunner)
-        return;
-
-    debug("<br>Trying to drag Data Detectors link (should fail)<br>");
-    dragAndDrop(ddLink.offsetLeft, ddLink.offsetTop + ddLink.offsetHeight / 2, 100, 100);
-}
-</script>
-</head>
-<body>
-<div id="description"></div>
-<div id="test-container">
-    <a href="x-apple-data-detectors://1" id="ddLink">Data Detectors Link</a>
-</div>
-<div id="console"></div>
-<script>
-description("This test checks that drag-and-drop is blocked for Data Detectors links.");
-</script>
-</body>
-</html>
index 28435ae..b18551d 100644 (file)
@@ -29,8 +29,6 @@ fast/harness/uiscriptcontroller [ Pass ]
 
 media/modern-media-controls/icon-button/icon-button-focus-state.html [ Pass ]
 
-fast/events/do-not-drag-and-drop-data-detectors-link.html [ Pass ]
-
 #//////////////////////////////////////////////////////////////////////////////////////////
 # End platform-specific directories.
 #//////////////////////////////////////////////////////////////////////////////////////////
index b2eaad9..c4baf27 100644 (file)
@@ -1,23 +1,15 @@
 2017-04-26  Tim Horton  <timothy_horton@apple.com>
 
-        Should not drag x-apple-data-detectors links
-        https://bugs.webkit.org/show_bug.cgi?id=171352
-        <rdar://problem/31309081>
-
-        Reviewed by Beth Dakin.
-
-        Test: fast/events/do-not-drag-and-drop-data-detectors-link.html
-
-        These links are only meaningful in the context of the original document,
-        so they should not be draggable.
+        Revert accidentally smushed commit.
 
         * editing/cocoa/DataDetection.h:
         * editing/cocoa/DataDetection.mm:
-        (WebCore::DataDetection::dataDetectorURLProtocol):
-        (WebCore::DataDetection::isDataDetectorURL):
+        (WebCore::DataDetection::dataDetectorURLProtocol): Deleted.
+        (WebCore::DataDetection::isDataDetectorURL): Deleted.
         * page/DragController.cpp:
         (WebCore::isDraggableLink):
-        Disallow dragging of <a href="x-apple-data-detectors://..."> links.
+        * platform/mac/DragImageMac.mm:
+        (WebCore::createDragImageForLink):
 
 2017-04-26  Alex Christensen  <achristensen@webkit.org>
 
index afaf664..f5e8970 100644 (file)
@@ -39,7 +39,6 @@ class Element;
 class FloatRect;
 class HitTestResult;
 class Range;
-class URL;
 
 enum DataDetectorTypes {
     DataDetectorTypeNone = 0,
@@ -65,9 +64,6 @@ public:
     WEBCORE_EXPORT static bool shouldCancelDefaultAction(Element&);
     WEBCORE_EXPORT static bool requiresExtendedContext(Element&);
 #endif
-
-    static const String& dataDetectorURLProtocol();
-    static bool isDataDetectorURL(const URL&);
 };
 
 } // namespace WebCore
index 6fdce48..54daf51 100644 (file)
@@ -659,16 +659,4 @@ NSArray *DataDetection::detectContentInRange(RefPtr<Range>&, DataDetectorTypes,
     return nil;
 }
 #endif
-
-const String& DataDetection::dataDetectorURLProtocol()
-{
-    static NeverDestroyed<String> protocol(ASCIILiteral("x-apple-data-detectors"));
-    return protocol;
-}
-
-bool DataDetection::isDataDetectorURL(const URL& url)
-{
-    return url.protocolIs(dataDetectorURLProtocol());
-}
-
 } // namespace WebCore
index ef70f88..657db33 100644 (file)
 #include <wtf/RefPtr.h>
 #endif
 
-#if PLATFORM(COCOA)
-#include "DataDetection.h"
-#endif
-
 namespace WebCore {
 
 bool isDraggableLink(const Element& element)
 {
-    if (is<HTMLAnchorElement>(element)) {
-        auto& anchorElement = downcast<HTMLAnchorElement>(element);
-        if (!anchorElement.isLiveLink())
-            return false;
-#if PLATFORM(COCOA)
-        return !DataDetection::isDataDetectorURL(anchorElement.href());
-#else
-        return true;
-#endif
-    }
+    if (is<HTMLAnchorElement>(element))
+        return downcast<HTMLAnchorElement>(element).isLiveLink();
     if (is<SVGAElement>(element))
         return element.isLink();
     return false;
index 2c0286b..2a8dfd3 100644 (file)
@@ -269,32 +269,7 @@ static void drawDoubledAtPoint(NSString *string, NSPoint textPoint, NSColor *top
 
 DragImageRef createDragImageForLink(Element&, URL& url, const String& title, TextIndicatorData&, FontRenderingMode, float)
 {
-    // FIXME: Soft link.
-
-    NSURL *cocoaURL = url;
-
-    RetainPtr<LPLinkMetadata> metadata = adoptNS([[LPLinkMetadata alloc] init]);
-    [metadata setOriginalURL:cocoaURL];
-    [metadata setTitle:(NSString *)title];
-
-    RetainPtr<LPLinkView> linkView = adoptNS([[LPLinkView alloc] initWithURL:cocoaURL]);
-    [linkView setMetadata:metadata.get()];
-
-    CGSize imageSize = [linkView sizeThatFits:CGSizeMake(400, 400)];
-
-    [linkView setFrame:CGRectMake(0, 0, imageSize.width, imageSize.height)];
-    [linkView layoutSubtreeIfNeeded];
-
-    NSBitmapImageRep *rep = [linkView bitmapImageRepForCachingDisplayInRect:[linkView bounds]];
-    [linkView cacheDisplayInRect:[linkView bounds] toBitmapImageRep:rep];
-
-    NSImage *dragImage = [[[NSImage alloc] initWithSize:imageSize] autorelease];
-    [dragImage addRepresentation:rep];
-
-    return dragImage;
-    // [dragImage lockFocus];
-
-    /*NSString *label = nsStringNilIfEmpty(title);
+    NSString *label = nsStringNilIfEmpty(title);
     NSURL *cocoaURL = url;
     NSString *urlString = [cocoaURL absoluteString];
 
@@ -368,7 +343,7 @@ DragImageRef createDragImageForLink(Element&, URL& url, const String& title, Tex
         drawDoubledAtPoint(label, NSMakePoint(DragLabelBorderX, imageSize.height - LabelBorderYOffset - [labelFont pointSize]), topColor, bottomColor, labelFont);
     }
 
-    [dragImage unlockFocus];*/
+    [dragImage unlockFocus];
 
     return dragImage;
 }