Bug 34737

Summary: copy and paste of list items should work for styled list items
Product: WebKit Reporter: Tony Chang <tony>
Component: HTML EditingAssignee: Tony Chang <tony>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, commit-queue, eric, jparent, sullivan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
Patch none

Description Tony Chang 2010-02-08 18:54:45 PST
In bug 24872, I added support for copying and pasting list items.  Unfortunately, if the bulleted item has styles applied to it, it doesn't work.

Patch coming to handle the styled case.
Comment 1 Tony Chang 2010-02-08 19:00:28 PST
Created attachment 48382 [details]
Patch
Comment 2 Tony Chang 2010-02-08 19:02:07 PST
Comment on attachment 48382 [details]
Patch

I wasn't taking into account the <span> that we put around fragment HTML when we copy to the clipboard.  The span is talked about in bug 26937.
Comment 3 Adam Barth 2010-02-09 12:30:12 PST
I wanted to review this patch, but the editing code is too complicated for me.
Comment 4 Eric Seidel (no email) 2010-02-17 15:57:43 PST
Comment on attachment 48382 [details]
Patch

So you check if the first child of the style span is a list item.

What if the style span includes more than just list items?  Either before or after the list?  What is the correct behavior for those cases?

This is an improvement, so r+.  But I'm not sure it's a fully correct fix.
Comment 5 Tony Chang 2010-02-17 18:43:00 PST
(In reply to comment #4)
> (From update of attachment 48382 [details])
> So you check if the first child of the style span is a list item.
> 
> What if the style span includes more than just list items?  Either before or
> after the list?  What is the correct behavior for those cases?
> 
> This is an improvement, so r+.  But I'm not sure it's a fully correct fix.

If the style span includes non-list items before the list, this code never triggers so we paste everything into the current list item node.  This would result in the stuff before the list then a sub list.  This is the same behavior before the patch on bug 24872.

If the style span includes non-list items after the list, we insert into the current list, then the stuff after the list gets added to the last node we insert.  Firefox breaks out of the list in this case, maybe we should too.  I've filed bug 35068 about this case.

Neither of these behavior change from this patch, as you said, this is just an improvement.  There's still work to be done.
Comment 6 WebKit Commit Bot 2010-02-17 22:28:35 PST
Comment on attachment 48382 [details]
Patch

Clearing flags on attachment: 48382

Committed r54931: <http://trac.webkit.org/changeset/54931>
Comment 7 WebKit Commit Bot 2010-02-17 22:28:40 PST
All reviewed patches have been landed.  Closing bug.