Windows HTML clipboard being populated incorrectly

RESOLVED DUPLICATE of bug 158103

Status

()

--
minor
RESOLVED DUPLICATE of bug 158103
14 years ago
5 years ago

People

(Reporter: daniel_atallah, Assigned: bugs)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040803 Firefox/0.8
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040803 Firefox/0.8

It seems that Firefox isn't populating the windows HTML clipboard correctly when
copying the selection.

According to the MSDN specification [link 1], the StartFragment header indicates
where the actual selected text lies in the copied buffer.  This offset seems to
be incorrect - pointing to the beginning of the "<!--StartFragment -->" tag
instead of the actual text that was selected for copying.

Additionally, the format of the <!--StartFragment --> tag is incorrect; there is
a ' ' between "<!--StartFragment" and "-->" which specifically is prohibited in
the MSDN document ("no space allowed between the !-- and the text"). (I realize
that it is a comment and that most applications trim all leading and trailing
whitespace from the HTML clipboard during pastes, but it seems like it would be
a trivial fix to make)

[link1]:http://msdn.microsoft.com/workshop/networking/clipboard/htmlclipboard.asp

Reproducible: Always
Steps to Reproduce:
1.Select a single word on a html webpage in FF. (in my example, the word "clients")
2.Right-Click on it and select "Copy"

Actual Results:  
The following is put into the clipboard:
Version:0.9
StartHTML:00000097
EndHTML:00000179
StartFragment:00000111
EndFragment:00000143
<html><body>
<!--StartFragment -->
clients
<!--EndFragment-->
</body>
</html>

Expected Results:  
The following *should* have been in the clipboard:
Version:0.9
StartHTML:00000097
EndHTML:00000178
StartFragment:00000135
EndFragment:00000142
<html><body>
<!--StartFragment-->
clients
<!--EndFragment-->
</body>
</html>

My offsets in "Expected Results" may be off by one since i did the counting
manually, but you get the idea.

It is important to note that the that the span of the fragment should be the
length of the section's code text that selected when the copy occurred (in this
case strlen("clients") == 7).

Updated

14 years ago
Whiteboard: DUPEME
(Reporter)

Comment 1

14 years ago
Created attachment 158336 [details] [diff] [review]
Proposed patch to fix the win32 HTML Clipboard population

This seems like simple solution to the bug.
3 main changes:

1-The main issue that this fixes is that it changes the StartFragment offset to
after the <!--StartFragment--> tag instead of before it.
2-It also removes the incorrect ' ' that was between "<!--StartFragment" and
"-->"
3-Remove the added "\r\n" before and after the actual text fragment (these are
not part of the actual fragment and shouldn't be there)

Comment 2

14 years ago

*** This bug has been marked as a duplicate of 158103 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → DUPLICATE

Comment 3

14 years ago
Daniel, would you consider working with the patch in bug 157994 to incorporate
both that bug as well your changes here (aka 158103)?
(Reporter)

Comment 4

14 years ago
(In reply to comment #3)
> Daniel, would you consider working with the patch in bug 157994 to incorporate
> both that bug as well your changes here (aka 158103)?

Yes, I'd like very much to get this taken care of - i'll review the patch in bug
157944 and add my changes to it.

Updated

5 years ago
Whiteboard: DUPEME
You need to log in before you can comment on or make changes to this bug.