2011-04-19 Igor Oliveira <igor.oliveira@openbossa.org>

        Reviewed by Andreas Kling.

        [Qt] X11: Text selection is causing oncopy event to be called
        https://bugs.webkit.org/show_bug.cgi?id=58656

        Always when text is selected the oncopy event is fired, this behavior does
        not exist in Firefox or Chrome. Now, when selecting a text, QtWebKit
        is making multi part-copies (with rich text metadata), the multi-part
        data can be obtained by data transfer items interface when supported by QtWebKit.
        Also, copies to the clipboard of a selected image, is not supported by Chrome and
        Firefox and was removed from QtWebKit.

        * Api/qwebpage.cpp:
        (QWebPagePrivate::handleClipboard):

git-svn-id: svn://svn.chromium.org/blink/trunk@84263 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent ec8f8f62
This file tests if text selection is causing oncopy event to get fired. This test requires DRT.
Selecting text with mouse, no copy events should occur:
Event count: 0
Copying text, 1 copy event should occur:
Event count: 1
<!DOCTYPE html>
<html>
<body oncopy="copy(event)" onpaste="paste(event)">
<div id="text">This file tests if text selection is causing oncopy event to get fired. This test requires DRT.</div>
<div id="console"></div>
<script src="../editing.js"></script>
<script>
var oncopyCounter = 0;
function log(text)
{
var console = document.getElementById('console');
console.appendChild(document.createTextNode(text));
console.appendChild(document.createElement('br'));
}
function copy(ev)
{
++oncopyCounter;
}
function runTest() {
if (!window.layoutTestController)
return;
layoutTestController.dumpAsText();
log("Selecting text with mouse, no copy events should occur:");
log("Event count: " + oncopyCounter)
var text = document.getElementById("text")
eventSender.mouseMoveTo(text.offsetLeft, text.offsetTop);
eventSender.mouseDown();
eventSender.mouseMoveTo(text.offsetLeft + text.offsetWidth, text.offsetTop);
eventSender.mouseUp();
log("Copying text, 1 copy event should occur:");
copyCommand();
log("Event count: " + oncopyCounter);
}
runTest();
</script>
</body>
</html>
......@@ -747,7 +747,7 @@ void QWebPagePrivate::handleClipboard(QEvent* ev, Qt::MouseButton button)
WebCore::Frame* focusFrame = page->focusController()->focusedOrMainFrame();
if (button == Qt::LeftButton) {
if (focusFrame && (focusFrame->editor()->canCopy() || focusFrame->editor()->canDHTMLCopy())) {
focusFrame->editor()->copy();
Pasteboard::generalPasteboard()->writeSelection(focusFrame->editor()->selectedRange().get(), focusFrame->editor()->canSmartCopyOrDelete(), focusFrame);
ev->setAccepted(true);
}
} else if (button == Qt::MidButton) {
......
2011-04-19 Igor Oliveira <igor.oliveira@openbossa.org>
Reviewed by Andreas Kling.
[Qt] X11: Text selection is causing oncopy event to be called
https://bugs.webkit.org/show_bug.cgi?id=58656
Always when text is selected the oncopy event is fired, this behavior does
not exist in Firefox or Chrome. Now, when selecting a text, QtWebKit
is making multi part-copies (with rich text metadata), the multi-part
data can be obtained by data transfer items interface when supported by QtWebKit.
Also, copies to the clipboard of a selected image, is not supported by Chrome and
Firefox and was removed from QtWebKit.
* Api/qwebpage.cpp:
(QWebPagePrivate::handleClipboard):
2011-04-18 Csaba Osztrogonác <ossy@webkit.org>
[Qt][WK2] Unreviewed buildfix after r84174.
......
Markdown is supported
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