Closed Bug 464890 Opened 17 years ago Closed 9 years ago

Text copied to the clipboard with nsIClipboardCommands results in CanPaste() returning PR_FALSE

Categories

(Core Graveyard :: Widget: Qt, defect)

x86
Linux
defect
Not set
minor

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: steffen.imhof, Unassigned)

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) Gecko/20070730 SUSE/2.0.0.6-25 Firefox/2.0.0.6 Build Identifier: MOZILLA_VERSION 1.9.1b2pre If I copy text into the clipboard from another application, the CanPaste() returns PR_TRUE and the paste operation succeeds. If I ignore the result of CanPaste() and Paste() anyway, it seems to work, too (probably not for every charset, etc.) Reproducible: Always Steps to Reproduce: 1. Copy text from a website into the clipboard with nsIClipboardCommands::Copy() 2. Set focus to a text input field 3. Call nsIClipboardCommands::CanPaste() Actual Results: PR_FALSE Expected Results: PR_TRUE The text is copied correctly, but with limited MIME-Types. CanPaste() asks the native clipboard implementation, which expects "text/plain;charset=utf-8", but the native clipboard puts text into the clipboard without this MIME-Type. One solution would be to be more lenient about what is possible to paste, but simple "text/plain" seems to be ignored on purpose. So the correct solution is probably to fill the clipboard with the correct data/MIME type combination.
The proposed patch fills the clipboard additionally with a "text/plain;charset=utf-8" version of the text. So that CanPaste() concludes it really can paste the text. This solves the issue for copy-pasting inside Mozilla. If another application writes only "text/plain" text the CanPaste() still returns PR_FALSE.
Can you create testcase for this problem? For me clipboard handling very strange, text which is copied by CTRL+C, not visible by other elements (menu, CSM menu). I think we need to fix general clipboard problems, and provide fix which will fix at least most of them.
Status: UNCONFIRMED → NEW
Ever confirmed: true
It seems to me that if we find clipboard contents of just "text/plain" (from another application), CanPaste() should return PR_TRUE and the Paste operation should (attempt to) interpret the text according to the system's default codepage.
In bug 1282866, I have removed the QT code from the Firefox tree with the approval of the active peer. That code is not currently maintained by any team. I have looked through the bugs in the Widget: Qt bugzilla component and I believe all of these are no longer relevant because the Qt code has been removed. If you believe that this bug is still valid, please move it to another more appropriate bugzilla component as you reopen it.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → INCOMPLETE
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: