Commit 09f33d88 authored by Dawit Alemayehu's avatar Dawit Alemayehu
Browse files

- Use QWebPage's built-in actions to copy link url so that URL are properly encoded.

- Make sure the URL we copy from a media element, which is not supported by a
  QWebPage action, is properly precent encoded.

CCBUG: 255070
(cherry picked from commit bcc11e76)
parent c8d428c7
......@@ -454,19 +454,8 @@ void WebKitBrowserExtension::slotBlockHost()
void WebKitBrowserExtension::slotCopyLinkURL()
{
if (!view())
return;
KUrl safeURL(view()->contextMenuResult().linkUrl());
safeURL.setPass(QString());
// Set it in both the mouse selection and in the clipboard
QMimeData* mimeData = new QMimeData;
safeURL.populateMimeData(mimeData);
QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard);
mimeData = new QMimeData;
safeURL.populateMimeData(mimeData);
QApplication::clipboard()->setMimeData(mimeData, QClipboard::Selection);
if (view())
view()->triggerPageAction(QWebPage::CopyLinkToClipboard);
}
void WebKitBrowserExtension::slotSaveLinkAs()
......@@ -584,7 +573,7 @@ static KUrl mediaUrlFrom(QWebElement& element)
if (src.isEmpty())
return KUrl();
return KUrl(frame->baseUrl().resolved(QUrl::fromEncoded(src.toAscii(), QUrl::StrictMode)));
return KUrl(frame->baseUrl().resolved(QUrl::fromEncoded(QUrl::toPercentEncoding(src), QUrl::StrictMode)));
}
void WebKitBrowserExtension::slotSaveMedia()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment