Bug 135220

Summary: REGRESSION (r171376): Sometimes we detect less than the whole phone number
Product: WebKit Reporter: Tim Horton <thorton>
Component: WebCore Misc.Assignee: Tim Horton <thorton>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson, enrica, rniwa, sam
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
none
patch beidson: review+

Description Tim Horton 2014-07-23 16:50:07 PDT
This is happening because the detection code will happily say that (###) ###-### is a real phone number (it probably is, somewhere), and our approach of using TextIterator and adjusting the ranges sometimes results in a fragment of a number being matched against first — before the whole number is passed in. The code in scanSelectionForTelephoneNumbers doesn't really know how to merge these, and we have no way to predict what the detection code will do, so we should instead hand *the whole extended selection* in one chunk to the detection code, so it can eagerly detect all of the phone numbers.

Doing this made it clear that the code to extend the selection was quite broken in the case of a directional selection (if it was a selection from right to left, the extension code would actually squish the selection instead of expanding it).

I haven't found any cases that this makes *worse*, and it is significantly simpler.

<rdar://problem/17783423>
Comment 1 Tim Horton 2014-07-23 16:54:48 PDT
Created attachment 235391 [details]
patch
Comment 2 Tim Horton 2014-07-23 17:08:43 PDT
Created attachment 235393 [details]
patch
Comment 3 Brady Eidson 2014-07-23 17:12:42 PDT
This sounds great, and is probably what we should've done in the first place.
Comment 4 Brady Eidson 2014-07-23 17:14:08 PDT
Comment on attachment 235393 [details]
patch

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

> Source/WebCore/editing/Editor.cpp:3438
> +

Really necessary?  Paragraphing seemed okay before.
Comment 5 Tim Horton 2014-07-23 17:22:22 PDT
(In reply to comment #4)
> (From update of attachment 235393 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=235393&action=review
> 
> > Source/WebCore/editing/Editor.cpp:3438
> > +
> 
> Really necessary?  Paragraphing seemed okay before.

Not necessary! Just left over from some debugging logging that I failed to remove entirely.

Thanks for your review!
Comment 6 Tim Horton 2014-07-23 17:24:47 PDT
(In reply to comment #5)
> (In reply to comment #4)
> > (From update of attachment 235393 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=235393&action=review
> > 
> > > Source/WebCore/editing/Editor.cpp:3438
> > > +
> > 
> > Really necessary?  Paragraphing seemed okay before.
> 
> Not necessary! Just left over from some debugging logging that I failed to remove entirely.

Though somehow I managed to land it anyway :|

> Thanks for your review!
Comment 7 Tim Horton 2014-07-23 17:25:13 PDT
http://trac.webkit.org/changeset/171499