Bug 51006

Summary: Range::processContents needs cleanup
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: DOMAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Enhancement CC: abarth, commit-queue, darin, eae, eric, mitz, ojan, sam, tkent, tony
Priority: P3    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 51005, 54282, 54425    
Bug Blocks:    
Attachments:
Description Flags
Patch none

Description Ryosuke Niwa 2010-12-13 21:11:10 PST
Range::processContents is one giant function that implements multiple features for Range.  We should split up this function into smaller pieces.
Comment 1 Ryosuke Niwa 2011-01-03 20:47:54 PST
I'm seeing some similarities between processContents and StyledMarkupAccumulator::serializeNodes but I'm not sure how we can share code.
Comment 2 Ryosuke Niwa 2011-02-16 23:38:23 PST
Created attachment 82761 [details]
Patch
Comment 3 Ryosuke Niwa 2011-02-23 21:24:10 PST
Could someone review my patch?
Comment 4 Kent Tamura 2011-02-28 00:48:54 PST
Comment on attachment 82761 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=82761&action=review

> Source/WebCore/dom/Range.cpp:630
> +    // This switch statement must be consistent with that of Range::processContentsBetweenOffsets.

So, we had better add a comment to Range::processContentBetweenoffsets().

> Source/WebCore/dom/Range.cpp:760
> +    // This switch statement must be consistent with that of lengthOfContentsInNode.

ditto.
Comment 5 Kent Tamura 2011-02-28 00:49:50 PST
(In reply to comment #4)
> (From update of attachment 82761 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=82761&action=review
> 
> > Source/WebCore/dom/Range.cpp:630
> > +    // This switch statement must be consistent with that of Range::processContentsBetweenOffsets.
> 
> So, we had better add a comment to Range::processContentBetweenoffsets().
> 
> > Source/WebCore/dom/Range.cpp:760
> > +    // This switch statement must be consistent with that of lengthOfContentsInNode.
> 
> ditto.

Oh, I was confused.  Ignore comments :-)
Comment 6 Ryosuke Niwa 2011-02-28 00:50:58 PST
Comment on attachment 82761 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=82761&action=review

>> Source/WebCore/dom/Range.cpp:630
>> +    // This switch statement must be consistent with that of Range::processContentsBetweenOffsets.
> 
> So, we had better add a comment to Range::processContentBetweenoffsets().

I have.

>> Source/WebCore/dom/Range.cpp:760
>> +    // This switch statement must be consistent with that of lengthOfContentsInNode.
> 
> ditto.

This comment is added in processContentsBetweenOffsets, and refers back to lengthOfContentsInNode.
Comment 7 Ryosuke Niwa 2011-02-28 00:51:01 PST
Comment on attachment 82761 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=82761&action=review

>> Source/WebCore/dom/Range.cpp:630
>> +    // This switch statement must be consistent with that of Range::processContentsBetweenOffsets.
> 
> So, we had better add a comment to Range::processContentBetweenoffsets().

I have.

>> Source/WebCore/dom/Range.cpp:760
>> +    // This switch statement must be consistent with that of lengthOfContentsInNode.
> 
> ditto.

This comment is added in processContentsBetweenOffsets, and refers back to lengthOfContentsInNode.
Comment 8 Ryosuke Niwa 2011-02-28 00:52:52 PST
(In reply to comment #5)
> (In reply to comment #4)
> > (From update of attachment 82761 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=82761&action=review
> > 
> > > Source/WebCore/dom/Range.cpp:630
> > > +    // This switch statement must be consistent with that of Range::processContentsBetweenOffsets.
> > 
> > So, we had better add a comment to Range::processContentBetweenoffsets().
> > 
> > > Source/WebCore/dom/Range.cpp:760
> > > +    // This switch statement must be consistent with that of lengthOfContentsInNode.
> > 
> > ditto.
> 
> Oh, I was confused.  Ignore comments :-)

Ah, ok.  Thanks for the review anyways :)
Comment 9 WebKit Commit Bot 2011-02-28 05:24:42 PST
Comment on attachment 82761 [details]
Patch

Clearing flags on attachment: 82761

Committed r79854: <http://trac.webkit.org/changeset/79854>
Comment 10 WebKit Commit Bot 2011-02-28 05:24:48 PST
All reviewed patches have been landed.  Closing bug.