Open Bug 776299 Opened 12 years ago Updated 2 years ago

Pasting into inline elements style as "display: block" in ContentEditable causes them to split

Categories

(Core :: DOM: Editor, defect)

14 Branch
defect

Tracking

()

People

(Reporter: samjclarke, Unassigned)

Details

Attachments

(1 file)

Attached file InlineBug.html
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1
Build ID: 20120713224749

Steps to reproduce:

1. Copy any part of the first (or any) paragraph on the attached page
2. Place the cursor in the middle of the word test in any of the examples
3. Paste the copied paragraph or paragraph section


Actual results:

The second example which is a span styled as "display: block" splits as if it was inline.


Expected results:

The second example shouldn't split, it should act like the last example which is a block level pre tag.

It doesn't split in Chrome, IE or Opera. Although IE doesn't split the inline one either and Opera doesn't seem to paste anything other than plain text.
OS: Linux → All
Hardware: x86_64 → All
Attachment #644700 - Attachment mime type: text/plain → text/html
Component: Untriaged → Editor
Product: Firefox → Core
Assignee: nobody → krosylight
Status: UNCONFIRMED → NEW
Ever confirmed: true

Although I have a fix, Chrome and Safari have this issue too. Should we ignore CSS and keep the existing behavior here?

Flags: needinfo?(masayuki)

(In reply to Kagami :saschanaz from comment #1)

Although I have a fix, Chrome and Safari have this issue too. Should we ignore CSS and keep the existing behavior here?

Really? I see different result on Windows. Chrome splits <span> element in the first testcase, and insert a text node between them. And also Chrome splits <span> element in the second testcase, and keep new text node and right <span> element to be in same hard line with setting style="display: inline !important;". I think that Chrome's behavior does make sense.

Flags: needinfo?(masayuki)

Ah, I mean they still split <span>. I think the result can simply be <span>TeCopy any part of me.st</span>, why should it be <span>Te<span style="display: inline !important;">Copy any part of me.</span><span style="display: inline !important;">st</span>? Chrome also does the same splitting for <div> which makes me confused.

Flags: needinfo?(masayuki)

In my understanding, user does not try to copy/paste line breaks in the testcase. So, not breaking existing line with pasting content which does not include line breaks must be expected by user. So, I think your idea is also fine to me.

(And I forgot that quoted text of Thunderbird's plaintext email composer is wrapped with <span style="white-space: pre-wrap; display: block; width: 98vw;">, be careful about this. But I guess that, it does not become problem because EditorBase::IsPlaintextEditor() returns true in this case.)

Flags: needinfo?(masayuki)

Haven't been working on it, unassigning myself...

Assignee: krosylight → nobody
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: