Bug 62041

Summary: The output of editing/pasteboard/paste-4039777-fix.html is wrong
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: enrica, jparent, sullivan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 34564    
Bug Blocks:    

Description Ryosuke Niwa 2011-06-03 12:43:44 PDT
The output of editing/pasteboard/paste-4039777-fix.html contains expected result but this does not match the actual result on ToT. Namely the div pasted is a child of ul in the actual result as supposed to be a sibling.

Here's paste-4039777-fix-expected.txt (I stripped out whitespace):
Expected result:
| <ul>
|   style="text-align:right;"
|   <li>
|     "A"
| <div>
|   <ul>
|     <li>
|       <a>
|         href=""
|         "B"
|       <br>
|       "
            C 
        "

Actual result:
| <ul>
|   style="text-align:right;"
|   <li>
|     "A"
|   <div>
|     <ul>
|       <li>
|         <a>
|           href=""
|           "B"
|         " "
|         <br>
|         "C<#selection-caret>"
| <div>
|   <ul>
Comment 1 Ryosuke Niwa 2011-06-03 12:47:35 PDT
So here's my question.  While the actual result doesn't match the expected result, is expected result really what a user expects?

In http://simple-rte.rniwa.com/?editor=%3Cul%3E%3Cli%3Ehello%3C/li%3E%3Cli%3Eworld%3C/li%3E%3C/ul%3E%3Cdiv%3EWebKit%3C/div%3E&script=editor%28%29.focus%28%29%3B

If you copy & paste "world
WebKit" and paste it after "hello", then I'd get
<ul><li>hello</li><li>world</li><div>WebKit</div><li>world</li></ul><div>WebKit</div>
on TOT.  i.e. both "world" and "WebKit" will be in the list and in a separate list item.

However, if we fix this bug, we'll get:
<ul><li>hello</li><li>world</li></ul><div>WebKit</div><ul><li>world</li></ul><div>WebKit</div>

As far as I tested, new behavior matches FF3.6.
Comment 2 Ojan Vafai 2011-06-03 13:24:49 PDT
Just looking at the simple-rte.rniwa.com link, the Firefox behavior looks correct to me. I don't see how that link accurately reflects what this test is doing though. Maybe I'm misreading the test.

Just at a quick glance, the expected result in this test looks right to me. What do you think it should be?
Comment 3 Ojan Vafai 2011-06-03 14:10:30 PDT
*** Bug 62047 has been marked as a duplicate of this bug. ***
Comment 4 Ryosuke Niwa 2011-06-03 14:54:20 PDT
It turns out that the bug 34564 blocks this bug because span wraps ul and div being pasted :(