CF_HTML Bug when pasting from Word and Excel if you use a , instead of . for your decimal point

VERIFIED FIXED in Firefox 11

Status

()

Core
Widget: Win32
VERIFIED FIXED
5 years ago
5 years ago

People

(Reporter: Loic, Assigned: bbondy)

Tracking

({regression})

9 Branch
mozilla12
All
Windows 7
regression
Points:
---

Firefox Tracking Flags

(firefox11 verified)

Details

(Whiteboard: workaround in comment 22 [qa!])

Attachments

(5 attachments)

(Reporter)

Description

5 years ago
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1
Build ID: 20111220165912

Steps to reproduce:

STR:

1) Open a .doc file containing a text with styles, links, notes, etc. with MS Office Word or MS Word Viewer (see http://support.microsoft.com/kb/891090).
NB: you can use the testcase (.doc file) attached to the bug report.
2) Select all the text (Ctrl+A) and copy (Ctrl+C).
3) Paste (Ctrl+V) the text into HTML editors like http://www.tinymce.com/tryit/full.php or http://ckeditor.com/demo


Actual results:

Only the text is copied, all elements like styles, links, notes, etc are removed. HTML structure is rebuilded too.


Expected results:

Elements should be preserved after copying the text from MS Word to HTML editors in Firefox.
It works in FF8 (and previous versions) but not in FF9 (and later like FF12).
(Reporter)

Comment 1

5 years ago
Created attachment 584800 [details]
Testcase .doc file
(Reporter)

Updated

5 years ago
Attachment #584800 - Attachment mime type: application/octet-stream → application/msword
(Reporter)

Updated

5 years ago
Component: General → General
Keywords: regression
Product: Firefox → Core
Hardware: x86_64 → All

Comment 2

5 years ago
Thanks for the report, Loic! Could you narrow down when this regressed by using the mozregression tool (http://harthur.github.com/mozregression/)?
(Reporter)

Comment 3

5 years ago
Okay, I'm going to try, that will be my first regression narrowing. :)
(Reporter)

Comment 4

5 years ago
So, my 1st result of narrowing (that was fun):

--repo=mozilla-central
Last good nightly: 2011-09-21
First bad nightly: 2011-09-22
Pushlog: http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=e8bd19f6abbb&tochange=4495e1f795c2

--repo=mozilla-inbound
Last good nightly: 2011-09-21
First bad nightly: 2011-09-22
http://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=069e927983a9&tochange=cf4a13b84474

I'm not completely sure but I would say the regression is in:
Bug 598289 - Unable to paste CF_HTML from clipboard if StartHTML/EndHTML set to -1
(Reporter)

Updated

5 years ago
Component: General → Widget: Win32

Comment 5

5 years ago
Great, thank you for investigating! I agree with your assessment, and I've kicked off a build with the patches from bug 598289 backed out. You should be able to download it from http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/josh@joshmatthews.net-92323f1901d2 in a couple hours, and then we can confirm our suspicions.
(Reporter)

Comment 6

5 years ago
Josh, I tested with your try-build (92323f1901d2) and I can confirm the regression is gone. In both HTML editors, the text copied from MS Word keeps its styles, notes, etc.

Comment 7

5 years ago
Brian, looks like the ball's in your court now.
Blocks: 598289
Status: UNCONFIRMED → NEW
Ever confirmed: true
(Assignee)

Updated

5 years ago
Assignee: nobody → netzen
(Assignee)

Comment 8

5 years ago
Just wanted to mention with Word 2010 this works correctly even in FF9-FF12, but I'll investigate further by using Word Viewer.
(Reporter)

Comment 9

5 years ago
Yes, I forgot to mention I tried with Word 2003 (in my STR). And I think Word Viewer is based on Word 2003 kernel.
(Reporter)

Comment 10

5 years ago
Some users reported copying fails from LibreOffice 3.4.4 Final too.
Cf http://www.libreoffice.org/download/
(Reporter)

Updated

5 years ago
Summary: Copying content from MS Office Word removes automatically styles, links, notes, etc → Copying content from some word processors (Office Word, Word Viewer, LibreOffice Writer) to HTML editors removes automatically layout

Comment 11

5 years ago
hello,
i'm using ms word 2010 with ff 9.0.1 but it still doesn't work.
Is there any solution to this issue ?
thx
(Assignee)

Comment 12

5 years ago
I plan to look into this task this week.

> i'm using ms word 2010 with ff 9.0.1 but it still doesn't work.
> Is there any solution to this issue ?

Word 2010 shouldn't be affected, maybe what your issue is, is unrelated to this task?  Can you try with Firefox 8 or lower?

Comment 13

5 years ago
works with ff8 but that's not the best solution =p
(Assignee)

Comment 14

5 years ago
Thanks for the info.  
Sorry I just wanted more information, wasn't proposing it as a workaround or solution :)
(Assignee)

Comment 15

5 years ago
Still could not reproduce with Nightly nor Aurora by using Word Viewer 2003.

1. Downloaded and installed http://www.microsoft.com/download/en/details.aspx?id=4
2. Opened your attachment .doc file.
3. Ctrl + A, Ctrl + C in the .doc file.
4. Ctrl + V in either of the 2 sites you referenced.

All formatting stays intact. 
I also tried copying just a portion of the document and that also works.

I suspect I'm missing a step? I'm on Windows 7 x64 by the way.
(Reporter)

Comment 16

5 years ago
Nope, your STR are the same as mine. I have just retested with the latest Aurora & Nightly, and I'm able to reproduce the bug, it's weird.

Snapshot of what I see after pasting the text:
+ ckeditor.com: http://i.imgur.com/Yj7Aw.jpg
+ tinymce.com: http://i.imgur.com/pI53w.jpg

I'm on the same OS as you. Are you running Word Viewer 2003 in a special compatibility mode? Mine is WORDVIEW.EXE *32.
(Assignee)

Comment 17

5 years ago
Created attachment 588218 [details] [diff] [review]
ClipSpy

Ya on my screen it keeps the formatting (same as FF8 for me).  The process name is the same for me. I am just using the default just installed mode for Word viewer. 

I have an idea, could you please download this:
http://www.codeproject.com/KB/clipboard/clipspy.aspx
In the download package there is a .exe in the bin folder.
(I attached just ClipSpy.exe to this ticket)

1. Start ClipSpy.exe
2. copy from word Viewer in the same way you have been. 
3. Click on HTML Format in ClipSpy
4. Click on File Save selected data, call it out.txt
5. Attach that file to this ticket, also a screenshot of ClipSpy would help too.

I have a feeling that your HTML Format will be different from mine, or maybe you won't have one at all.
(Assignee)

Comment 18

5 years ago
do your decimal points display as , or .?
(Reporter)

Comment 19

5 years ago
Created attachment 588228 [details]
testcase.doc_HTML.format_outpout
(Reporter)

Comment 20

5 years ago
Created attachment 588230 [details]
testcase.doc_HTML.format_snapshot
(Reporter)

Comment 21

5 years ago
(In reply to Brian R. Bondy [:bbondy] from comment #17)

> 5. Attach that file to this ticket, also a screenshot of ClipSpy would help
> too.
Done.

(In reply to Brian R. Bondy [:bbondy] from comment #18)
> do your decimal points display as , or .?
Where? Screen? OS? Applications?
I'm using a French OS, so it's essentially with ",".
(Assignee)

Comment 22

5 years ago
Awesome thanks for the info.

Control panel | Region and Language | Formats | Customize Format | Decimal Symbol:
If I change from . to , I can reproduce.
If I change from , to . I cannot reproduce.
Note: You have to restart Firefox in between changes to see the effect, but you can keep the same clipboard content from Word.


Fix shouldn't be hard.
(Assignee)

Updated

5 years ago
Duplicate of this bug: 717218
(Assignee)

Comment 24

5 years ago
The problem seems to be from this line:

+  int numFound = sscanf((char*)*outData, "Version:%f\nStartHTML:%d\nEndHTML:%d", 
+                         &vers, &startOfData, &endOfData);

The CF_HTML format has a period in its version (as per the spec), but this call will fail with %f if your local settings are set to , for the decimal point.  sscanf with %f I think will only work with comma decimal points if that's your locale settings on Windows.
(Reporter)

Comment 25

5 years ago
You're right, changing the decimal point from "," to "." fixes the bug. Good catch! :)
(Assignee)

Updated

5 years ago
Summary: Copying content from some word processors (Office Word, Word Viewer, LibreOffice Writer) to HTML editors removes automatically layout → CF_HTML Bug when pasting from Word and Excel if you use a , instead of . for your decimal point
(Assignee)

Comment 26

5 years ago
Created attachment 588256 [details] [diff] [review]
Patch v1.

Tested and it works with any type of decimal point.
After this review I'll request Aurora and Beta approval for this patch.
Attachment #588256 - Flags: review?(roc)
(Reporter)

Comment 27

5 years ago
I tested with various characters/strings as decimal point.

Windows defines a max 3-digit value as decimal point.
If the 1st digit begings by "." (".XY" where X & Y are random chars), it works, but it doesn't if the 1st digit is different from "." (like ":" or "b8").
(Assignee)

Comment 28

5 years ago
Thanks, I'm just reading it in as a string since we don't actually use the value that was causing problems.
Attachment #588256 - Flags: review?(roc) → review+
(Assignee)

Comment 29

5 years ago
I tested the format string on both Windows VS10 and g++ on Ubuntu by the way.
(Assignee)

Comment 30

5 years ago
Pushed to try, will push to inbound once that passes.  Thanks for the quick review.
Duplicate of this bug: 717588
(Reporter)

Updated

5 years ago
Whiteboard: workaround in comment 22
(Assignee)

Comment 32

5 years ago
Pushed to mozilla-inbound:
http://hg.mozilla.org/integration/mozilla-inbound/rev/9fdf008925ce
Target Milestone: --- → mozilla12
(Assignee)

Comment 33

5 years ago
Comment on attachment 588256 [details] [diff] [review]
Patch v1.

[Approval Request Comment]
Regression caused by (bug #): bug 598289 
User impact if declined: HTML format pasting will not work, instead will be another format like text or image that is available in clipboard.
Testing completed (on m-c, etc.): local testing, pushed to m-i, will be on m-c soon.
Risk to taking this patch (and alternatives if risky): low

This is a regression introduced in Mozilla 9.  The HTML format is very important in Windows and won't be used as of Mozilla 9 code if you have a comma instead of a period as your decimal point in Windows settings.  I would like to see this fixed on both beta and aurora as the risk is low.
Attachment #588256 - Flags: approval-mozilla-beta?
Attachment #588256 - Flags: approval-mozilla-aurora?
https://hg.mozilla.org/mozilla-central/rev/9fdf008925ce
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Blocks: 714621
(Assignee)

Updated

5 years ago
No longer blocks: 714621
Duplicate of this bug: 714621
(In reply to Brian R. Bondy [:bbondy] from comment #33)
> [Approval Request Comment]
> Regression caused by (bug #): bug 598289 
> Risk to taking this patch (and alternatives if risky): low

Hi Brian - given where we are in the beta cycle, we have to exercise caution. Do you believe this patch is on par with the risk of backing out bug 598289, or that keeping 598289 in FF10 has significant reward?

I'm currently leaning towards taking this patch on Aurora and backing out 598289 for FF10.
Comment on attachment 588256 [details] [diff] [review]
Patch v1.

[Triage Comment]
Although we're still considering whether or not to take this for beta, there's no need to block uplifting to aurora.
Attachment #588256 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
(Assignee)

Comment 38

5 years ago
> or that keeping 598289 in FF10 has significant reward?

I don't think the reward is significant. I do believe 598289 does provide benefit but not enough to justify any amount of last minute risk.

> I'm currently leaning towards taking this patch on Aurora and backing out 
> 598289 for FF10.

That sounds good, the 3 patches from bug 598289 would have to be backed out from FF10.  

Please advise, I can do as you say tonight for Aurora and Beta.
(Assignee)

Comment 39

5 years ago
I don't think the reward is significant to have either a backout or this patch applied though to Beta.
(Assignee)

Comment 40

5 years ago
sorry Comment 39 should read:
I DO think the reward is significant to have either a backout, or this patch applied to Beta.
(Assignee)

Updated

5 years ago
Duplicate of this bug: 718592
(Assignee)

Comment 42

5 years ago
Pushed to aurora:
http://hg.mozilla.org/releases/mozilla-aurora/rev/274a4cfbf3fd

Recommendation for beta is to backout the 3 patches from bug 598289.

Updated

5 years ago
Duplicate of this bug: 718592
Comment on attachment 588256 [details] [diff] [review]
Patch v1.

[Triage Comment]
Going with Brian's recommendation to backout bug 598289. Feel free to use either bug for the backout (we're now tracking both).
Attachment #588256 - Flags: approval-mozilla-beta? → approval-mozilla-beta-
(Assignee)

Updated

5 years ago
Target Milestone: mozilla12 → mozilla11
(Assignee)

Comment 45

5 years ago
Bug 598289 was backed out of beta, I indicated the changeset in that bug.

Updated

5 years ago
status-firefox11: --- → fixed
Target Milestone: mozilla11 → mozilla12
Whiteboard: workaround in comment 22 → workaround in comment 22 [qa+]

Updated

5 years ago
Duplicate of this bug: 718592

Comment 47

5 years ago
Verified as fixed on:
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0

The elements are preserved when performing the steps from comment 0.
Status: RESOLVED → VERIFIED
status-firefox11: fixed → verified
Whiteboard: workaround in comment 22 [qa+] → workaround in comment 22 [qa!]
(Reporter)

Comment 48

5 years ago
(In reply to Ioana Budnar [QA] from comment #47)
> The elements are preserved when performing the steps from comment 0.
Hi. Did you set the decimal point as "," (or another random char different of ".") in Windows before testing?

Comment 49

5 years ago
(In reply to Loic from comment #48)
> (In reply to Ioana Budnar [QA] from comment #47)
> > The elements are preserved when performing the steps from comment 0.
> Hi. Did you set the decimal point as "," (or another random char different
> of ".") in Windows before testing?

Yes, Loic, I verified it works well both with "." and ",".
You need to log in before you can comment on or make changes to this bug.