summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-07-22 12:40:20 +0200
committerAllan Sandfeld Jensen <allan.jensen@digia.com>2014-07-28 12:02:08 +0200
commit622bd271367a251b87881d53df45467777ee863a (patch)
treed86b36af20d431f012135e77843c6844ff6b8b99
parent1e0e8bbbe3c588d8a8340a26fcf124d50f722633 (diff)
Do not use title as the primary text of dragged or copied links
In trying to preserve the link title, we set the title in the text part of dragged or copied mimedata. This has caused a number of undesired changes in behavior. This patch reverts to placing the url in the text field, but instead stores the rich part of the link as HTML. This is consistent with GTK, and Chromium. Task-number: QTBUG-39995 Change-Id: Id5f2587a93fb9721c728299340f2e3562f3456ca Reviewed-by: Michael Bruning <michael.bruning@digia.com>
-rw-r--r--Source/WebCore/platform/qt/PasteboardQt.cpp9
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp4
2 files changed, 9 insertions, 4 deletions
diff --git a/Source/WebCore/platform/qt/PasteboardQt.cpp b/Source/WebCore/platform/qt/PasteboardQt.cpp
index 1d69398cf..2bcdd5ffa 100644
--- a/Source/WebCore/platform/qt/PasteboardQt.cpp
+++ b/Source/WebCore/platform/qt/PasteboardQt.cpp
@@ -208,8 +208,13 @@ void Pasteboard::writeURL(const KURL& url, const String& title, Frame*)
if (!m_writableData)
m_writableData = new QMimeData;
- if (!title.isEmpty())
- m_writableData->setText(title);
+
+ QString urlString = url.string();
+ m_writableData->setText(urlString);
+
+ QString html = QStringLiteral("<a href=\"") + urlString + QStringLiteral("\">") + QString(title) + QStringLiteral("</a>");
+ m_writableData->setHtml(html);
+
m_writableData->setUrls(QList<QUrl>() << url);
if (isForCopyAndPaste())
updateSystemPasteboard();
diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp
index 9f0e7a564..13fbe88d3 100644
--- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp
@@ -1113,10 +1113,10 @@ void QWebPageAdapter::triggerAction(QWebPageAdapter::MenuAction action, QWebHitT
#if defined(Q_WS_X11)
bool oldSelectionMode = Pasteboard::generalPasteboard()->isSelectionMode();
Pasteboard::generalPasteboard()->setSelectionMode(true);
- editor.copyURL(hitTestResult->linkUrl, WTF::String());
+ editor.copyURL(hitTestResult->linkUrl, hitTestResult->linkText);
Pasteboard::generalPasteboard()->setSelectionMode(oldSelectionMode);
#endif
- editor.copyURL(hitTestResult->linkUrl, WTF::String());
+ editor.copyURL(hitTestResult->linkUrl, hitTestResult->linkText);
break;
}
case OpenImageInNewWindow: