Bug 61089

Summary: JoinTextNodesCommand is never used
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: HTML EditingAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Enhancement CC: commit-queue, darin, dglazkov, enrica, eric, justin.garcia, leviw, morrita, ojan, sullivan, tkent, tony
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Deleted JoinTextNodesCommand none

Description Ryosuke Niwa 2011-05-18 13:16:00 PDT
This command is never used anywhere.  We should just get rid of it.
Comment 1 Ryosuke Niwa 2011-05-18 21:41:44 PDT
Created attachment 94042 [details]
Deleted JoinTextNodesCommand
Comment 2 Ojan Vafai 2011-05-19 07:46:21 PDT
Did this behavior just get rolled into something else or do we just create infinite text nodes every edit you make?
Comment 3 Darin Adler 2011-05-19 07:47:03 PDT
Comment on attachment 94042 [details]
Deleted JoinTextNodesCommand

Lets say you have this markup:

    x<b>y</b>z

Wouldn’t we want to join the x and z into a single text node after that? If not, why not? Is this handled with different code?
Comment 4 Darin Adler 2011-05-19 07:47:29 PDT
I meant if you deleted the "y" and then moved the insertion point away.
Comment 5 Darin Adler 2011-05-19 07:47:58 PDT
I see now that my question and Ojan’s are the same.
Comment 6 Ryosuke Niwa 2011-05-19 08:14:12 PDT
(In reply to comment #3)
> (From update of attachment 94042 [details])
> Lets say you have this markup:
> 
>     x<b>y</b>z
> 
> Wouldn’t we want to join the x and z into a single text node after that? If not, why not? Is this handled with different code?

Yes: http://trac.webkit.org/browser/trunk/Source/WebCore/editing/ApplyStyleCommand.cpp#L1470
Comment 7 Ryosuke Niwa 2011-05-19 08:22:48 PDT
I don't know how other editing commands are merging text nodes.  Maybe we never do.  For example, https://bugs.webkit.org/show_bug.cgi?id=61094 is caused by deletion leaving two adjacent text nodes.
Comment 8 Darin Adler 2011-05-19 08:28:11 PDT
Sorry, I was talking about deletion and not styling, but it’s good to see there is code in the styling code path that does this.
Comment 9 Darin Adler 2011-05-19 08:29:15 PDT
It's also interesting to consider:

    vw<b>x</b>yz

Selecting starting before the w and after the y and then deleting or typing new text. I assume we’d want a single text node.
Comment 10 Darin Adler 2011-05-19 08:30:31 PDT
Comment on attachment 94042 [details]
Deleted JoinTextNodesCommand

It seems OK to remove this because generally speaking there’s no real value to keeping around dead untested code. I’m not sure this offers significant advantages over the explicit insert and delete idiom used in ApplyStyleCommand. We can add it back if we need it later.
Comment 11 Ryosuke Niwa 2011-05-19 08:32:37 PDT
(In reply to comment #10)
> (From update of attachment 94042 [details])
> It seems OK to remove this because generally speaking there’s no real value to keeping around dead untested code. I’m not sure this offers significant advantages over the explicit insert and delete idiom used in ApplyStyleCommand. We can add it back if we need it later.

Thanks for the review.  My intent here was to remove dead code.  Regardless of usefulness, I'd rather not have dead code in our code base.
Comment 12 WebKit Commit Bot 2011-05-19 10:44:44 PDT
The commit-queue encountered the following flaky tests while processing attachment 94042 [details]:

http/tests/websocket/tests/httponly-cookie.pl bug 54097 (author: abarth@webkit.org)
The commit-queue is continuing to process your patch.
Comment 13 WebKit Commit Bot 2011-05-19 10:46:21 PDT
Comment on attachment 94042 [details]
Deleted JoinTextNodesCommand

Clearing flags on attachment: 94042

Committed r86854: <http://trac.webkit.org/changeset/86854>
Comment 14 WebKit Commit Bot 2011-05-19 10:46:27 PDT
All reviewed patches have been landed.  Closing bug.
Comment 15 WebKit Commit Bot 2011-05-19 11:46:54 PDT
The commit-queue encountered the following flaky tests while processing attachment 94042 [details]:

animations/suspend-resume-animation.html bug 48161 (authors: cmarrin@apple.com and simon.fraser@apple.com)
http/tests/websocket/tests/multiple-connections.html bug 53825 (author: abarth@webkit.org)
The commit-queue is continuing to process your patch.