RESOLVED INVALID 34893
[Qt] Copying markup using QWebAction::Copy has problems with <img> tags
https://bugs.webkit.org/show_bug.cgi?id=34893
Summary [Qt] Copying markup using QWebAction::Copy has problems with <img> tags
Sebastian Gottfried
Reported 2010-02-12 07:46:31 PST
If I copy a selection containing text and images via QWebAction::Copy and paste it into MS Word all images are omitted. Layout and formatting are transferred as expected. As it appears QtWebKit embeds the images as data urls into to html code for the clipboard. This isn't necessaraly a bug, but one of the most important paste targets, MS Word, can't handle this. As other popular browsers, like MSIE and Mozilla Firefox just pass the URLs of the images, QtWebKit should follow this behaviour for better compatibility. I'm using WebKit from Qt 4.6.1.
Attachments
Tor Arne Vestbø
Comment 1 2010-03-10 06:32:48 PST
Please follow the QtWebKit bug reporting guidelines when reporting bugs. See http://trac.webkit.org/wiki/QtWebKitBugs Specifically: - The 'QtWebKit' component should only be used for bugs/features in the public QtWebKit API layer, not to signify that the bug is specific to the Qt port of WebKit http://trac.webkit.org/wiki/QtWebKitBugs#Component - Add the keyword 'Qt' to signal that it's a Qt-related bug http://trac.webkit.org/wiki/QtWebKitBugs#Keywords
Tor Arne Vestbø
Comment 2 2010-03-16 04:11:45 PDT
If Microsoft Word does not support data: urls that's a bug/missing feature in their software. That said, it does not look like we're using data-urls to embed images. The markup is copied verbatim and wrapped in document like reporter suggested. But one thing I noticed was that both Chromium and Safari sets the SourceURL for the HTML clipboard part, which we don't. That will cause relative URLs to be broken unless there's some other way we pass that.
Sebastian Gottfried
Comment 3 2010-03-18 02:08:42 PDT
I did some additional research on this bug. Indeed images are not passed data urls. This was an stupid mistake during my first debugging session. As Tor Arne Vestbø already mentioned, relative URLS are passed as is and will, of course, not work if not treated specially. I have fixed the bug by patching WebCore/editing/markup.cpp: In the function appendStartMarkup() I make URLs absolute before passed to appendQuotedURLAttributeValue() if annotate is set. if (el->isURLAttribute(attr)) { if (annotate) appendQuotedURLAttributeValue(result, node->document()->completeURL(attr->value())); else appendQuotedURLAttributeValue(result, attr->value()); } I'm not completely sure if this breaks some other functionality but my investigations told me that annotate is only set for clipboard functionality.
Note You need to log in before you can comment on or make changes to this bug.