Open Bug 302597 Opened 20 years ago Updated 4 years ago

Unable to paste HTML-formatted text after copying part of a table contained in <span>

Categories

(Core :: DOM: Editor, defect, P5)

defect

Tracking

()

mozilla1.9alpha1

People

(Reporter: stephend, Unassigned)

Details

Attachments

(3 files)

Build ID: 2005-07-28-06, Windows XP SeaMonkey trunk. Steps to Reproduce: 1. http://www.fixedorbit.com/AS/10/AS10565.htm 2. Select from the A in ASN Name down to the O in Verio 3. Attempt to paste into the HTML compose window in mail. Expected Results: Able to paste Actual Results: Silent failure to paste (no JS console messages logged) Raw HTML source: <b>ASN</b></td><td width="80%"><b>Name</b></td></tr><tr><td>2914</td><td><a href="/AS/2/AS2914.htm">VERIO</a> Plain-text output ASN Name 2914 VERIO
Flags: blocking1.8b4?
Can anyone confirm that this occurs in FF or TBird? Until then minusing for beta.
Flags: blocking1.8b4? → blocking1.8b4-
(In reply to comment #1) > Can anyone confirm that this occurs in FF or TBird? Until then minusing for beta. Yes, I can confirm that. Tried with today's Firefox trunk and yesterday's Thunderbird trunk; can't paste.
Flags: blocking1.8b4- → blocking1.8b4?
When did this regress and can we get a reduced testcase? It appears that selecting and copying only part of the table causes the failure but the full table works.
ASN Name 2 That's the reduced testcase. If I select just ASN Name, it works, and pastes a table with a row. Sorry, no idea when this regressed.
Blake - can you take a look and figure out where to redirect? Unless we can get someone to own this looks like it is not going to make it for 1.5b
Assignee: mozeditor → mrbkap
Severity: critical → minor
Flags: blocking1.8b4? → blocking1.8b4-
Better steps: 1. Load http://www.fixedorbit.com/AS/10/AS10565.htm 2. Select from the "e" in Name _to_ the "2" in 2914. That gives you the following HTML: e</b></td></tr><tr><td>2
This also doesn't work for me with Mozilla1.7
Select from B down to 2, then try to paste into Thunderbird or SeaMonkey.
Mats--think you might be able to take a look?
Attached file minimal testcase
The key here is the inline element (<span> in this testcase, <font> in the original) which wraps the table. Without it everything is OK.
What's being copied into the clipboard in this case is: <span><tr><td>B</td></tr><tr><td>2</td></tr></span> Notice that while the enclosing <span> is included, the <table> is not. This probably later confuses the paste operation. The reason that the <span> is included, but the <table> is not (although they are both common ancestors of the selection start and end points) is that nsDocumentEncoder::IncludeInContext(), called by nsDocumentEncoder::SerializeRangeContextStart() for each of the common ancestors, returns TRUE for <span>, <font>, etc., but FALSE for <table>. (see http://lxr.mozilla.org/mozilla/source/content/base/src/nsDocumentEncoder.cpp#1252 ) So that's (I think) the problem. I'll leave it to someone with better understanding than mine to come up with a solution.
Attached patch one optionSplinter Review
This is kind of hackish: Exclude from the "context" anything which is outside the (innermost) <table> element in the common ancestors list. If anybody thinks this makes sense let me know and I'll find out who I should ask for a review. I'm off to sleep now.
Flags: blocking1.9a1?
more descriptive summary, to help searching.
Summary: Unable to paste HTML-formatted text → Unable to paste HTML-formatted text after copying part of a table contained in <span>
Attachment #199863 - Flags: review?(jst) → review?(roc)
I don't really have a clue what's going on here. How about Blake?
Attachment #199863 - Flags: review?(roc) → review?(mrbkap)
Comment on attachment 199863 [details] [diff] [review] one option I'd really rather not do this if possible. It seems that the hacks to paste tables would be lining up one after the other (see also bug 228920). I'll look into this and see if I can see what's going on to fix it in a cleaner way. So I'll minus this for now, but if I can't figure out a cleaner way, I'll plus it.
Attachment #199863 - Flags: review?(mrbkap) → review-
OS: Windows XP → All
Priority: -- → P3
Hardware: PC → All
Target Milestone: --- → mozilla1.9alpha
Severity: minor → normal
Flags: blocking1.9a1? → blocking1.9-
Whiteboard: [wanted-1.9]
QA Contact: editor
Flags: wanted1.9+
Whiteboard: [wanted-1.9]
Flags: wanted1.9-
Flags: wanted1.9+
Flags: wanted-next+
Is this the same as bug 428096?
No, bug 428096 is OSX-only.
Assignee: mrbkap → nobody

Bulk-downgrade of unassigned, >=5 years untouched DOM/Storage bugs' priority.

If you have reason to believe this is wrong (especially for the severity), please write a comment and ni :jstutte.

Severity: normal → S4
Priority: P3 → P5
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: