Bug 138731

Summary: Move DataDetectors scanning code to WebCore
Product: WebKit Reporter: Tim Horton <thorton>
Component: New BugsAssignee: Tim Horton <thorton>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, bdakin, ddkilzer, ggaren, mitz, sam, simon.fraser
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch andersca: review+

Description Tim Horton 2014-11-14 01:57:29 PST
Move DataDetectors scanning code to WebCore
Comment 1 Tim Horton 2014-11-14 01:58:05 PST
Created attachment 241566 [details]
Patch
Comment 2 Tim Horton 2014-11-14 01:59:08 PST
This would be a prime candidate (one of many) for some kind of small Mac-only "WebKitKit" in between WebCore and WebKit{2}...
Comment 3 mitz 2014-11-14 07:13:18 PST
Comment on attachment 241566 [details]
Patch

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

> Source/WebCore/ChangeLog:22
> +        * platform/mac/DataDetection.h: Copied from Source/WebCore/editing/DictionaryLookup.h.
> +        * platform/mac/DataDetection.mm: Added.
> +        (WebCore::DataDetection::detectItemAroundHitTestResult):
> +        Moved from WebKit2.

platform/ is not the right place for this code, which depends on non-platform WebCore concepts such as the DOM and the render tree.
Comment 4 Anders Carlsson 2014-11-14 07:51:15 PST
(In reply to comment #3)
> Comment on attachment 241566 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=241566&action=review
> 
> > Source/WebCore/ChangeLog:22
> > +        * platform/mac/DataDetection.h: Copied from Source/WebCore/editing/DictionaryLookup.h.
> > +        * platform/mac/DataDetection.mm: Added.
> > +        (WebCore::DataDetection::detectItemAroundHitTestResult):
> > +        Moved from WebKit2.
> 
> platform/ is not the right place for this code, which depends on
> non-platform WebCore concepts such as the DOM and the render tree.

Agreed, maybe we can move it to page/mac/?
Comment 5 Simon Fraser (smfr) 2014-11-14 08:05:54 PST
Comment on attachment 241566 [details]
Patch

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

> Source/WebKit2/ChangeLog:9
> +        Move DataDetectors scanning code to WebCore, so that both WebKits can use it.

Is this a good long-term direction? Why not have WK2 just link with WK1?
Comment 6 Anders Carlsson 2014-11-14 08:24:19 PST
(In reply to comment #5)
> Comment on attachment 241566 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=241566&action=review
> 
> > Source/WebKit2/ChangeLog:9
> > +        Move DataDetectors scanning code to WebCore, so that both WebKits can use it.
> 
> Is this a good long-term direction? Why not have WK2 just link with WK1?

It already does. 😑
Comment 7 Tim Horton 2014-11-14 08:35:00 PST
Oh yes, of course, totally wrong place.

(In reply to comment #5)
> Comment on attachment 241566 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=241566&action=review
> 
> > Source/WebKit2/ChangeLog:9
> > +        Move DataDetectors scanning code to WebCore, so that both WebKits can use it.
> 
> Is this a good long-term direction? Why not have WK2 just link with WK1?

Ideal long term answer, in my book, is https://bugs.webkit.org/show_bug.cgi?id=138731#c, not hiding things in WebKit legacy.
Comment 8 mitz 2014-11-14 08:44:11 PST
I don’t think there’s anuthing wrong, conceptually or practically, with this code being in WebCore.
Comment 9 Geoffrey Garen 2014-11-14 10:48:51 PST
> Agreed, maybe we can move it to page/mac/?

Or editing, perhaps?

Editing already handles related "scan the text and possibly display something" tasks like dictionary lookup, alternative text presentation, linkification, and so on.
Comment 10 Tim Horton 2014-11-14 13:29:05 PST
Created attachment 241621 [details]
Patch
Comment 11 Tim Horton 2014-11-14 13:36:36 PST
http://trac.webkit.org/changeset/176137
Comment 12 David Kilzer (:ddkilzer) 2014-11-15 10:58:43 PST
(In reply to comment #11)
> http://trac.webkit.org/changeset/176137

iOS build fix committed as r176156: <http://trac.webkit.org/changeset/176156>