Open Bug 732608 Opened 13 years ago Updated 3 years ago

Clipboard HTML contents do not match screen selection on copy (table with an image in one cell and text in another).

Categories

(Core :: Layout, defect)

x86_64
All
defect

Tracking

()

People

(Reporter: karlden, Unassigned)

Details

(Keywords: reproducible, testcase)

Attachments

(2 files, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11 Steps to reproduce: Steps to reproduce the bug, using the files in the attached zip are: 1. Install the selectcopypastebug.xpi in firefox 10. 2. Open the html file "\\SelectCopyPasteBug\demo\ SCPHTML\Stake Pocket _ Stake Body Parts at Trailer Parts Superstore.htm". This is a saved commercial web page where this bug was discovered. 3. Open the screen shot file "\\ SelectCopyPasteBug \demo\ScreenShotRangeBug.JPG" to see where to make the selection (although many similar selections reproduce this bug from this page). 4. In the browser, position the mouse pointer to the left of the selection as shown in the screen shot, but as near to the adjacent image on the left as possible without activating the hyperlink associated with that image. 5. Press the left mouse button down and drag it to the right selecting the initial part of the text that begins "Weld-On Stake Pocket". The selection should appear approximately like the selection in the screenshot image. 6. Right click the mouse to bring up the selection context menu and select the item "Check Range Left Boundary". (If this item is not seen, then the rangevaliditybug.xpi was likely not installed properly in step 1.) 7. Observe the alert panel that comes up, if the alert describes how the value of range.startOffset (the selection range offset value) is beyond the end of the last child node where the start boundary is defined, then go to step 8. If not, then try again starting at step 5. 8. Bring up the selection context menu again, and this time select "copy". 9. Paste the clipboard into a document that accepts the HTML version of the clipboard content. MS Word works amongst others. 10. Observe the results of the paste. If you see the image with the selection in the paste, you have reproduced the bug. The source code is in the zip. The relevant part of the script reads: self.on("click", function () { var sel = window.getSelection(); var range = sel.getRangeAt(0); if( range.startContainer.childNodes.length>0 && range.startOffset >= range.startContainer.childNodes.length ) alert( "Range offset beyond child nodes; " + "\nrange.startOffset is: " + range.startOffset + "\nrange.startContainer.childNodes.length is: " +range.startContainer.childNodes.length ); else alert( " Did not repro bug this time " ); }); This is related to bug: Bug 732358 , it may be helpful to read it. This bug only occurs when the start offset is beyond the last child node, hence the code to check for that in the repro process. Actual results: The adjacent image was included in the copy, even though it was not in the selection. Expected results: The selection and the copied content should match.
Attachment #602515 - Attachment mime type: text/plain → application/x-zip
Attached file reduced html
Attachment #602564 - Attachment is obsolete: true
This is not recent regression. I can reproduce in Firefox1.5.0.12-Nightly13.0a1. but I cannot in Chrome and Opera. In IE9, range.startContainer.childNodes[0] is a image element, but paste to MS Word is as empty cell.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Using attachment 602567 [details], reproduced (so it said) with 2003-08-08-17-trunk.MozillaFirebird-i686-linux-gtk2+xft 2014-08-09-03-02-02-mozilla-central-firefox-34.0a1.ru.linux-x86_64
Component: Untriaged → Layout
OS: Windows 7 → All
Product: Firefox → Core
Summary: Clipboard HTML contents do not match screen selection on copy. → Clipboard HTML contents do not match screen selection on copy (table with an image in one cell and text in another).
Version: 10 Branch → Trunk
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: