<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[182957] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/182957">182957</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2015-04-17 11:21:30 -0700 (Fri, 17 Apr 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>REGRESSION: SVG does not support link dragging
https://bugs.webkit.org/show_bug.cgi?id=141597
Reviewed by Darin Adler.
Source/WebCore:
Fixes an issue where a SVG hyperlink cannot be dragged. We should support
dragging an SVG A element just as we support dragging an HTML A element.
Test: fast/events/drag-and-drop-link.html
* page/DragController.cpp: Removed explicit include of header Element.h as it will
be ultimately included by HTMLAnchorElement.h, among other headers.
(WebCore::isDraggableLink): Added. Extracted code from HitTestResult::isLiveLink().
(WebCore::DragController::draggableElement): Call WebCore::isDraggableLink() to
determine whether a element is a hyperlink that can be dragged.
* page/DragController.h:
* page/EventHandler.cpp:
(WebCore::EventHandler::selectClosestWordOrLinkFromMouseEvent): Write code in terms of
WebCore::isDraggableLink().
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::isLiveLink): Deleted.
* rendering/HitTestResult.h:
Source/WebKit/mac:
Write -[WebElementDictionary _isLiveLink] in terms of WebCore::isDraggableLink().
* Misc/WebElementDictionary.mm:
(-[WebElementDictionary _isLiveLink]):
LayoutTests:
Add a test to ensure we do not regress dragging of a HTML hyperlink or a SVG hyperlink.
* fast/events/drag-and-drop-link-expected.txt: Added.
* fast/events/drag-and-drop-link.html: Added.
* platform/efl/TestExpectations: Mark the test as "failure" since EFL does not support drag-and-drop.
* platform/gtk/TestExpectations: Mark the test as "failure" until we implement drag-and-drop support for
GTK+ as part of fixing <https://bugs.webkit.org/show_bug.cgi?id=42194>.
* platform/ios-simulator/TestExpectations: Skip the test since iOS does not implement
drag-and-drop support.
* platform/mac-wk2/TestExpectations: Skip the test until we implement drag-and-drop support in EventSender
for Mac as part of fixing <https://bugs.webkit.org/show_bug.cgi?id=42194>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformeflTestExpectations">trunk/LayoutTests/platform/efl/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformgtkTestExpectations">trunk/LayoutTests/platform/gtk/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorTestExpectations">trunk/LayoutTests/platform/ios-simulator/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2TestExpectations">trunk/LayoutTests/platform/mac-wk2/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageDragControllercpp">trunk/Source/WebCore/page/DragController.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDragControllerh">trunk/Source/WebCore/page/DragController.h</a></li>
<li><a href="#trunkSourceWebCorepageEventHandlercpp">trunk/Source/WebCore/page/EventHandler.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingHitTestResultcpp">trunk/Source/WebCore/rendering/HitTestResult.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingHitTestResulth">trunk/Source/WebCore/rendering/HitTestResult.h</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebElementDictionarymm">trunk/Source/WebKit/mac/Misc/WebElementDictionary.mm</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfasteventsdraganddroplinkexpectedtxt">trunk/LayoutTests/fast/events/drag-and-drop-link-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventsdraganddroplinkhtml">trunk/LayoutTests/fast/events/drag-and-drop-link.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (182956 => 182957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-04-17 17:33:21 UTC (rev 182956)
+++ trunk/LayoutTests/ChangeLog        2015-04-17 18:21:30 UTC (rev 182957)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2015-04-17 Daniel Bates <dabates@apple.com>
+
+ REGRESSION: SVG does not support link dragging
+ https://bugs.webkit.org/show_bug.cgi?id=141597
+
+ Reviewed by Darin Adler.
+
+ Add a test to ensure we do not regress dragging of a HTML hyperlink or a SVG hyperlink.
+
+ * fast/events/drag-and-drop-link-expected.txt: Added.
+ * fast/events/drag-and-drop-link.html: Added.
+ * platform/efl/TestExpectations: Mark the test as "failure" since EFL does not support drag-and-drop.
+ * platform/gtk/TestExpectations: Mark the test as "failure" until we implement drag-and-drop support for
+ GTK+ as part of fixing <https://bugs.webkit.org/show_bug.cgi?id=42194>.
+ * platform/ios-simulator/TestExpectations: Skip the test since iOS does not implement
+ drag-and-drop support.
+ * platform/mac-wk2/TestExpectations: Skip the test until we implement drag-and-drop support in EventSender
+ for Mac as part of fixing <https://bugs.webkit.org/show_bug.cgi?id=42194>.
+
</ins><span class="cx"> 2015-04-17 Commit Queue <commit-queue@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r182912 and r182920.
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsdraganddroplinkexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/drag-and-drop-link-expected.txt (0 => 182957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/drag-and-drop-link-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/events/drag-and-drop-link-expected.txt        2015-04-17 18:21:30 UTC (rev 182957)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+This test checks that drag-and-drop support works for a hyperlink.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Dragging HTML hyperlink
+
+PASS event.dataTransfer.getData("url") is "http://www.whatwg.org/html"
+
+Dragging SVG hyperlink
+
+PASS event.dataTransfer.getData("url") is "http://www.w3.org/TR/SVG11/"
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventsdraganddroplinkhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/drag-and-drop-link.html (0 => 182957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/drag-and-drop-link.html         (rev 0)
+++ trunk/LayoutTests/fast/events/drag-and-drop-link.html        2015-04-17 18:21:30 UTC (rev 182957)
</span><span class="lines">@@ -0,0 +1,139 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<style>
+#drop-container > div {
+ height: 256px;
+ width: 256px;
+ color: gray;
+}
+#drop-instructions {
+ display: -webkit-box;
+ display: -moz-box;
+ display: -ms-flexbox;
+ -webkit-box-align: center;
+ -moz-box-align: center;
+ -ms-flex-align: center;
+ -webkit-box-pack: center;
+ -moz-box-pack: center;
+ -ms-flex-pack: center;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ pointer-events: none;
+}
+#drop-target {
+ border: 1px dashed black;
+ margin-top: -256px; /* Paint on top of #drop-instructions. */
+}
+</style>
+<script>
+var dropTarget;
+var draggingElement;
+var event;
+
+var svgHyperlink;
+var htmlHyperlink;
+var numberOfTestsToRun;
+
+window.jsTestIsAsync = true;
+
+window.onload = function ()
+{
+ svgHyperlink = document.getElementById("svgHyperlink");
+ htmlHyperlink = document.getElementById("htmlHyperlink");
+
+ svgHyperlink.ondragstart = dragStart;
+ svgHyperlink.ondragend = dragEnd;
+ htmlHyperlink.ondragstart = dragStart;
+ htmlHyperlink.ondragend = dragEnd;
+
+ dropTarget = document.getElementById("drop-target");
+ dropTarget.ondrop = drop;
+
+ runTests();
+}
+
+function dragStart(e)
+{
+ event = e;
+ draggingElement = e.target;
+}
+
+function dragEnd(e)
+{
+ dropTarget.innerHTML = "";
+ draggingElement = null;
+}
+
+function drop(e)
+{
+ event = e;
+ var expectedHref = draggingElement instanceof SVGElement ? draggingElement.href.baseVal : draggingElement.href;
+ shouldBeEqualToString('event.dataTransfer.getData("url")', expectedHref);
+ if (window.testRunner && !--numberOfTestsToRun)
+ done();
+}
+
+function done()
+{
+ var testContainer = document.getElementById("test-container");
+ if (testContainer)
+ document.body.removeChild(testContainer);
+ 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;
+
+ var endX = dropTarget.offsetLeft + 10;
+ var endY = dropTarget.offsetTop + dropTarget.offsetHeight / 2;
+
+ numberOfTestsToRun = 2;
+
+ debug("<br>Dragging HTML hyperlink<br>");
+ dragAndDrop(htmlHyperlink.offsetLeft, htmlHyperlink.offsetTop + htmlHyperlink.offsetHeight / 2, endX, endY);
+
+ debug("<br>Dragging SVG hyperlink<br>");
+ // Only the SVG root element has a CSS layout box. And Offset{Left, Top, Width, Height} only work for elements that have a CSS layout box
+ // per <http://www.w3.org/TR/cssom-view/#extensions-to-the-htmlelement-interface>.
+ dragAndDrop(svgHyperlink.ownerSVGElement.offsetLeft, svgHyperlink.ownerSVGElement.offsetTop + 10, endX, endY);
+}
+</script>
+</head>
+<body>
+<div id="description"></div>
+<div id="test-container">
+ <div id="drop-container">
+ <div id="drop-instructions">Drop a hyperlink on me.</div>
+ <div id="drop-target" contenteditable="true"></div>
+ </div>
+ <hr>
+ <p>Items that can be dragged to the drop target:</p>
+ <svg width="200" height="30">
+ <a xlink:href="http://www.w3.org/TR/SVG11/" id="svgHyperlink"><text x="0" y="20" style="text-decoration: underline">SVG hyperlink</text></a>
+ </svg>
+ <a href="http://www.whatwg.org/html" id="htmlHyperlink">HTML hyperlink</a>
+ <hr>
+</div>
+<div id="console"></div>
+<script>
+description("This test checks that drag-and-drop support works for a hyperlink.");
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformeflTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/efl/TestExpectations (182956 => 182957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/efl/TestExpectations        2015-04-17 17:33:21 UTC (rev 182956)
+++ trunk/LayoutTests/platform/efl/TestExpectations        2015-04-17 18:21:30 UTC (rev 182957)
</span><span class="lines">@@ -343,6 +343,7 @@
</span><span class="cx"> webkit.org/b/86623 fast/events/drag-dataTransferItemList.html
</span><span class="cx"> webkit.org/b/86623 fast/events/drag-image-filename.html [ Timeout ]
</span><span class="cx"> webkit.org/b/86623 fast/events/drag-in-frames.html [ Failure ]
</span><ins>+webkit.org/b/86623 fast/events/drag-and-drop-link.html [ Failure ]
</ins><span class="cx"> webkit.org/b/86623 fast/events/drag-and-drop-link-into-focused-contenteditable.html [ Failure ]
</span><span class="cx"> webkit.org/b/86623 fast/events/drag-parent-node.html [ Failure ]
</span><span class="cx"> webkit.org/b/86623 fast/events/drag-selects-image.html
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk/TestExpectations (182956 => 182957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/TestExpectations        2015-04-17 17:33:21 UTC (rev 182956)
+++ trunk/LayoutTests/platform/gtk/TestExpectations        2015-04-17 18:21:30 UTC (rev 182957)
</span><span class="lines">@@ -1410,6 +1410,7 @@
</span><span class="cx"> webkit.org/b/63706 fast/events/drag-and-drop-fire-drag-dragover.html [ Failure ]
</span><span class="cx"> webkit.org/b/63706 fast/events/drag-and-drop.html [ Failure Timeout ]
</span><span class="cx"> webkit.org/b/63706 fast/events/drag-and-drop-subframe-dataTransfer.html [ Failure Timeout ]
</span><ins>+webkit.org/b/42194 fast/events/drag-and-drop-link.html [ Failure ]
</ins><span class="cx"> webkit.org/b/63706 fast/events/drag-and-drop-link-into-focused-contenteditable.html [ Failure ]
</span><span class="cx"> webkit.org/b/63706 fast/events/drag-parent-node.html [ Failure ]
</span><span class="cx"> webkit.org/b/63706 fast/events/dropzone-001.html [ Failure Timeout ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (182956 => 182957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/TestExpectations        2015-04-17 17:33:21 UTC (rev 182956)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations        2015-04-17 18:21:30 UTC (rev 182957)
</span><span class="lines">@@ -157,6 +157,7 @@
</span><span class="cx"> fast/events/drag-file-crash.html
</span><span class="cx"> fast/events/drag-image-filename.html
</span><span class="cx"> fast/events/drag-in-frames.html
</span><ins>+fast/events/drag-and-drop-link.html
</ins><span class="cx"> fast/events/drag-and-drop-link-into-focused-contenteditable.html
</span><span class="cx"> fast/events/drag-outside-window.html
</span><span class="cx"> fast/events/drag-parent-node.html
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (182956 => 182957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/TestExpectations        2015-04-17 17:33:21 UTC (rev 182956)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations        2015-04-17 18:21:30 UTC (rev 182957)
</span><span class="lines">@@ -76,6 +76,7 @@
</span><span class="cx"> fast/events/drag-and-drop-dataTransfer-types-nocrash.html
</span><span class="cx"> fast/events/drag-and-drop-fire-drag-dragover.html
</span><span class="cx"> fast/events/drag-and-drop.html
</span><ins>+fast/events/drag-and-drop-link.html
</ins><span class="cx"> fast/events/drag-in-frames.html
</span><span class="cx"> fast/events/drag-parent-node.html
</span><span class="cx"> fast/events/dropzone-001.html
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (182956 => 182957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-04-17 17:33:21 UTC (rev 182956)
+++ trunk/Source/WebCore/ChangeLog        2015-04-17 18:21:30 UTC (rev 182957)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2015-04-17 Daniel Bates <dabates@apple.com>
+
+ REGRESSION: SVG does not support link dragging
+ https://bugs.webkit.org/show_bug.cgi?id=141597
+
+ Reviewed by Darin Adler.
+
+ Fixes an issue where a SVG hyperlink cannot be dragged. We should support
+ dragging an SVG A element just as we support dragging an HTML A element.
+
+ Test: fast/events/drag-and-drop-link.html
+
+ * page/DragController.cpp: Removed explicit include of header Element.h as it will
+ be ultimately included by HTMLAnchorElement.h, among other headers.
+ (WebCore::isDraggableLink): Added. Extracted code from HitTestResult::isLiveLink().
+ (WebCore::DragController::draggableElement): Call WebCore::isDraggableLink() to
+ determine whether a element is a hyperlink that can be dragged.
+ * page/DragController.h:
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::selectClosestWordOrLinkFromMouseEvent): Write code in terms of
+ WebCore::isDraggableLink().
+ * rendering/HitTestResult.cpp:
+ (WebCore::HitTestResult::isLiveLink): Deleted.
+ * rendering/HitTestResult.h:
+
</ins><span class="cx"> 2015-04-17 Commit Queue <commit-queue@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r182912 and r182920.
</span></span></pre></div>
<a id="trunkSourceWebCorepageDragControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DragController.cpp (182956 => 182957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DragController.cpp        2015-04-17 17:33:21 UTC (rev 182956)
+++ trunk/Source/WebCore/page/DragController.cpp        2015-04-17 18:21:30 UTC (rev 182957)
</span><span class="lines">@@ -26,8 +26,10 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "DragController.h"
</span><span class="cx">
</span><ins>+#include "HTMLAnchorElement.h"
+#include "SVGAElement.h"
+
</ins><span class="cx"> #if ENABLE(DRAG_SUPPORT)
</span><del>-
</del><span class="cx"> #include "CachedImage.h"
</span><span class="cx"> #include "CachedResourceLoader.h"
</span><span class="cx"> #include "DataTransfer.h"
</span><span class="lines">@@ -40,7 +42,6 @@
</span><span class="cx"> #include "DragState.h"
</span><span class="cx"> #include "Editor.h"
</span><span class="cx"> #include "EditorClient.h"
</span><del>-#include "Element.h"
</del><span class="cx"> #include "EventHandler.h"
</span><span class="cx"> #include "ExceptionCodePlaceholder.h"
</span><span class="cx"> #include "FloatRect.h"
</span><span class="lines">@@ -48,7 +49,6 @@
</span><span class="cx"> #include "FrameLoader.h"
</span><span class="cx"> #include "FrameSelection.h"
</span><span class="cx"> #include "FrameView.h"
</span><del>-#include "HTMLAnchorElement.h"
</del><span class="cx"> #include "HTMLAttachmentElement.h"
</span><span class="cx"> #include "HTMLImageElement.h"
</span><span class="cx"> #include "HTMLInputElement.h"
</span><span class="lines">@@ -80,9 +80,21 @@
</span><span class="cx"> #include "markup.h"
</span><span class="cx"> #include <wtf/CurrentTime.h>
</span><span class="cx"> #include <wtf/RefPtr.h>
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+bool isDraggableLink(const Element& element)
+{
+ if (is<HTMLAnchorElement>(element))
+ return downcast<HTMLAnchorElement>(element).isLiveLink();
+ if (is<SVGAElement>(element))
+ return element.isLink();
+ return false;
+}
+
+#if ENABLE(DRAG_SUPPORT)
+
</ins><span class="cx"> static PlatformMouseEvent createMouseEvent(DragData& dragData)
</span><span class="cx"> {
</span><span class="cx"> int keyState = dragData.modifierKeyState();
</span><span class="lines">@@ -652,9 +664,7 @@
</span><span class="cx"> state.type = static_cast<DragSourceAction>(state.type | DragSourceActionImage);
</span><span class="cx"> return element;
</span><span class="cx"> }
</span><del>- if ((m_dragSourceAction & DragSourceActionLink)
- && is<HTMLAnchorElement>(*element)
- && downcast<HTMLAnchorElement>(*element).isLiveLink()) {
</del><ins>+ if ((m_dragSourceAction & DragSourceActionLink) && isDraggableLink(*element)) {
</ins><span class="cx"> state.type = static_cast<DragSourceAction>(state.type | DragSourceActionLink);
</span><span class="cx"> return element;
</span><span class="cx"> }
</span><span class="lines">@@ -988,6 +998,6 @@
</span><span class="cx"> m_page.dragCaretController().setCaretPosition(frame->visiblePositionForPoint(framePoint));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#endif // ENABLE(DRAG_SUPPORT)
+
</ins><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // ENABLE(DRAG_SUPPORT)
</del></span></pre></div>
<a id="trunkSourceWebCorepageDragControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DragController.h (182956 => 182957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DragController.h        2015-04-17 17:33:21 UTC (rev 182956)
+++ trunk/Source/WebCore/page/DragController.h        2015-04-17 18:21:30 UTC (rev 182957)
</span><span class="lines">@@ -140,6 +140,8 @@
</span><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+ WEBCORE_EXPORT bool isDraggableLink(const Element&);
+
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorepageEventHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/EventHandler.cpp (182956 => 182957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/EventHandler.cpp        2015-04-17 17:33:21 UTC (rev 182956)
+++ trunk/Source/WebCore/page/EventHandler.cpp        2015-04-17 18:21:30 UTC (rev 182957)
</span><span class="lines">@@ -598,17 +598,17 @@
</span><span class="cx">
</span><span class="cx"> void EventHandler::selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHitTestResults& result)
</span><span class="cx"> {
</span><del>- if (!result.hitTestResult().isLiveLink())
</del><ins>+ Element* urlElement = result.hitTestResult().URLElement();
+ if (!urlElement || !isDraggableLink(*urlElement))
</ins><span class="cx"> return selectClosestWordFromMouseEvent(result);
</span><span class="cx">
</span><span class="cx"> Node* targetNode = result.targetNode();
</span><span class="cx">
</span><span class="cx"> if (targetNode && targetNode->renderer() && m_mouseDownMayStartSelect) {
</span><span class="cx"> VisibleSelection newSelection;
</span><del>- Element* URLElement = result.hitTestResult().URLElement();
</del><span class="cx"> VisiblePosition pos(targetNode->renderer()->positionForPoint(result.localPoint(), nullptr));
</span><del>- if (pos.isNotNull() && pos.deepEquivalent().deprecatedNode()->isDescendantOf(URLElement))
- newSelection = VisibleSelection::selectionFromContentsOfNode(URLElement);
</del><ins>+ if (pos.isNotNull() && pos.deepEquivalent().deprecatedNode()->isDescendantOf(urlElement))
+ newSelection = VisibleSelection::selectionFromContentsOfNode(urlElement);
</ins><span class="cx">
</span><span class="cx"> updateSelectionForMouseDownDispatchingSelectStart(targetNode, expandSelectionToRespectSelectOnMouseDown(*targetNode, newSelection), WordGranularity);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingHitTestResultcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/HitTestResult.cpp (182956 => 182957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/HitTestResult.cpp        2015-04-17 17:33:21 UTC (rev 182956)
+++ trunk/Source/WebCore/rendering/HitTestResult.cpp        2015-04-17 18:21:30 UTC (rev 182957)
</span><span class="lines">@@ -608,20 +608,6 @@
</span><span class="cx"> return URL();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool HitTestResult::isLiveLink() const
-{
- if (!m_innerURLElement)
- return false;
-
- if (is<HTMLAnchorElement>(*m_innerURLElement))
- return downcast<HTMLAnchorElement>(*m_innerURLElement).isLiveLink();
-
- if (is<SVGAElement>(*m_innerURLElement))
- return m_innerURLElement->isLink();
-
- return false;
-}
-
</del><span class="cx"> bool HitTestResult::isOverLink() const
</span><span class="cx"> {
</span><span class="cx"> return m_innerURLElement && m_innerURLElement->isLink();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingHitTestResulth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/HitTestResult.h (182956 => 182957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/HitTestResult.h        2015-04-17 17:33:21 UTC (rev 182956)
+++ trunk/Source/WebCore/rendering/HitTestResult.h        2015-04-17 18:21:30 UTC (rev 182957)
</span><span class="lines">@@ -111,7 +111,6 @@
</span><span class="cx"> WEBCORE_EXPORT URL absoluteAttachmentURL() const;
</span><span class="cx"> #endif
</span><span class="cx"> WEBCORE_EXPORT String textContent() const;
</span><del>- WEBCORE_EXPORT bool isLiveLink() const;
</del><span class="cx"> bool isOverLink() const;
</span><span class="cx"> WEBCORE_EXPORT bool isContentEditable() const;
</span><span class="cx"> void toggleMediaControlsDisplay() const;
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (182956 => 182957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2015-04-17 17:33:21 UTC (rev 182956)
+++ trunk/Source/WebKit/mac/ChangeLog        2015-04-17 18:21:30 UTC (rev 182957)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-04-17 Daniel Bates <dabates@apple.com>
+
+ REGRESSION: SVG does not support link dragging
+ https://bugs.webkit.org/show_bug.cgi?id=141597
+
+ Reviewed by Darin Adler.
+
+ Write -[WebElementDictionary _isLiveLink] in terms of WebCore::isDraggableLink().
+
+ * Misc/WebElementDictionary.mm:
+ (-[WebElementDictionary _isLiveLink]):
+
</ins><span class="cx"> 2015-04-16 Sam Weinig <sam@webkit.org>
</span><span class="cx">
</span><span class="cx"> Expose JavaScriptMarkupEnabled preference for WebKit1
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebElementDictionarymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebElementDictionary.mm (182956 => 182957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebElementDictionary.mm        2015-04-17 17:33:21 UTC (rev 182956)
+++ trunk/Source/WebKit/mac/Misc/WebElementDictionary.mm        2015-04-17 18:21:30 UTC (rev 182957)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #import "WebTypesInternal.h"
</span><span class="cx"> #import "WebView.h"
</span><span class="cx"> #import "WebViewPrivate.h"
</span><ins>+#import <WebCore/DragController.h>
</ins><span class="cx"> #import <WebCore/Frame.h>
</span><span class="cx"> #import <WebCore/HitTestResult.h>
</span><span class="cx"> #import <WebCore/Image.h>
</span><span class="lines">@@ -265,7 +266,8 @@
</span><span class="cx">
</span><span class="cx"> - (NSNumber *)_isLiveLink
</span><span class="cx"> {
</span><del>- return [NSNumber numberWithBool:_result->isLiveLink()];
</del><ins>+ Element* urlElement = _result->URLElement();
+ return [NSNumber numberWithBool:(urlElement && isDraggableLink(*urlElement))];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSNumber *)_isContentEditable
</span></span></pre>
</div>
</div>
</body>
</html>