<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[164569] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/164569">164569</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2014-02-23 17:35:02 -0800 (Sun, 23 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Extract platform specific parts of telephone number detection 
https://bugs.webkit.org/show_bug.cgi?id=129238

Reviewed by Dean Jackson.

* WebCore.xcodeproj/project.pbxproj:
Add new files.

* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::linkifyPhoneNumbers):
(WebCore::HTMLTreeBuilder::processCharacterBufferForInBody):
* platform/TelephoneNumberDetector.h: Added.
* platform/cocoa/TelephoneNumberDetectorCocoa.cpp: Added.
(WebCore::TelephoneNumberDetector::phoneNumbersScanner):
(WebCore::TelephoneNumberDetector::isSupported):
(WebCore::TelephoneNumberDetector::find):
Move code to TelephoneNumberDetector.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLTreeBuildercpp">trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformTelephoneNumberDetectorh">trunk/Source/WebCore/platform/TelephoneNumberDetector.h</a></li>
<li><a href="#trunkSourceWebCoreplatformcocoaTelephoneNumberDetectorCocoacpp">trunk/Source/WebCore/platform/cocoa/TelephoneNumberDetectorCocoa.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (164568 => 164569)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-24 01:23:57 UTC (rev 164568)
+++ trunk/Source/WebCore/ChangeLog        2014-02-24 01:35:02 UTC (rev 164569)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2014-02-23  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        Extract platform specific parts of telephone number detection 
+        https://bugs.webkit.org/show_bug.cgi?id=129238
+
+        Reviewed by Dean Jackson.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        Add new files.
+
+        * html/parser/HTMLTreeBuilder.cpp:
+        (WebCore::HTMLTreeBuilder::linkifyPhoneNumbers):
+        (WebCore::HTMLTreeBuilder::processCharacterBufferForInBody):
+        * platform/TelephoneNumberDetector.h: Added.
+        * platform/cocoa/TelephoneNumberDetectorCocoa.cpp: Added.
+        (WebCore::TelephoneNumberDetector::phoneNumbersScanner):
+        (WebCore::TelephoneNumberDetector::isSupported):
+        (WebCore::TelephoneNumberDetector::find):
+        Move code to TelephoneNumberDetector.
+
</ins><span class="cx"> 2014-02-23  Gyuyoung Kim  &lt;gyuyoung.kim@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Change a url parameter type with URL in NavigatorContentUtils
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (164568 => 164569)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-02-24 01:23:57 UTC (rev 164568)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-02-24 01:35:02 UTC (rev 164569)
</span><span class="lines">@@ -2299,6 +2299,8 @@
</span><span class="cx">                 7C74D43818823B1900E5ED57 /* UTextProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C74D43618823B1900E5ED57 /* UTextProvider.h */; };
</span><span class="cx">                 7C74D43B1882400400E5ED57 /* UTextProviderUTF16.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C74D4391882400400E5ED57 /* UTextProviderUTF16.cpp */; };
</span><span class="cx">                 7C74D43C1882400400E5ED57 /* UTextProviderUTF16.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C74D43A1882400400E5ED57 /* UTextProviderUTF16.h */; };
</span><ins>+                7CC564B818BABEA6001B9652 /* TelephoneNumberDetector.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC564B618BABEA6001B9652 /* TelephoneNumberDetector.h */; };
+                7CC564BA18BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CC564B918BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp */; };
</ins><span class="cx">                 7CC7E3D717208C0F003C5277 /* IDNScriptWhiteList.txt in Resources */ = {isa = PBXBuildFile; fileRef = 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */; };
</span><span class="cx">                 7CE6CBFB187F370700D46BF5 /* FormatConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE6CBFA187F370700D46BF5 /* FormatConverter.h */; };
</span><span class="cx">                 7CE6CBFD187F394900D46BF5 /* FormatConverter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE6CBFC187F394900D46BF5 /* FormatConverter.cpp */; };
</span><span class="lines">@@ -9249,6 +9251,8 @@
</span><span class="cx">                 7C74D43618823B1900E5ED57 /* UTextProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProvider.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C74D4391882400400E5ED57 /* UTextProviderUTF16.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTextProviderUTF16.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C74D43A1882400400E5ED57 /* UTextProviderUTF16.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTextProviderUTF16.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                7CC564B618BABEA6001B9652 /* TelephoneNumberDetector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TelephoneNumberDetector.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7CC564B918BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TelephoneNumberDetectorCocoa.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDNScriptWhiteList.txt; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CE6CBFA187F370700D46BF5 /* FormatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormatConverter.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CE6CBFC187F394900D46BF5 /* FormatConverter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormatConverter.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -10624,8 +10628,8 @@
</span><span class="cx">                 A5AFB34D115151A700B045CB /* StepRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StepRange.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A5AFB34E115151A700B045CB /* StepRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StepRange.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A5C566AA127A3AAD00E8A3FF /* DiskImageCacheClientIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiskImageCacheClientIOS.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                A5C974CF11485FF10066F2AB /* KeyEventCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KeyEventCocoa.h; path = cocoa/KeyEventCocoa.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                A5C974D011485FF10066F2AB /* KeyEventCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = KeyEventCocoa.mm; path = cocoa/KeyEventCocoa.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                A5C974CF11485FF10066F2AB /* KeyEventCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyEventCocoa.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                A5C974D011485FF10066F2AB /* KeyEventCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KeyEventCocoa.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 A5DEBD9F16FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitPlaybackTargetAvailabilityEvent.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A5DEBDA016FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitPlaybackTargetAvailabilityEvent.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A5DEBDA116FB908700836FE0 /* WebKitPlaybackTargetAvailabilityEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitPlaybackTargetAvailabilityEvent.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -17983,10 +17987,11 @@
</span><span class="cx">                 A5C974CE11485FDA0066F2AB /* cocoa */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                7CC564B918BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp */,
</ins><span class="cx">                                 A5C974CF11485FF10066F2AB /* KeyEventCocoa.h */,
</span><span class="cx">                                 A5C974D011485FF10066F2AB /* KeyEventCocoa.mm */,
</span><span class="cx">                         );
</span><del>-                        name = cocoa;
</del><ins>+                        path = cocoa;
</ins><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="cx">                 };
</span><span class="cx">                 A75E8B7F0E1DE2B0007F2481 /* filters */ = {
</span><span class="lines">@@ -20819,6 +20824,7 @@
</span><span class="cx">                                 F587866202DE3B1101EA4122 /* SSLKeyGenerator.h */,
</span><span class="cx">                                 93B2D8150F9920D2006AE6B2 /* SuddenTermination.h */,
</span><span class="cx">                                 97627B9714FB5424002CDCA1 /* Supplementable.h */,
</span><ins>+                                7CC564B618BABEA6001B9652 /* TelephoneNumberDetector.h */,
</ins><span class="cx">                                 BCE65D310EAD1211007E4533 /* Theme.cpp */,
</span><span class="cx">                                 BCE658FE0EA9248A007E4533 /* Theme.h */,
</span><span class="cx">                                 BCE659A80EA927B9007E4533 /* ThemeTypes.h */,
</span><span class="lines">@@ -24146,6 +24152,7 @@
</span><span class="cx">                                 1AE2AA210A1CDAB400B42B25 /* JSHTMLBaseFontElement.h in Headers */,
</span><span class="cx">                                 1AE2AA230A1CDAB400B42B25 /* JSHTMLBodyElement.h in Headers */,
</span><span class="cx">                                 1AE2AA250A1CDAB400B42B25 /* JSHTMLBRElement.h in Headers */,
</span><ins>+                                7CC564B818BABEA6001B9652 /* TelephoneNumberDetector.h in Headers */,
</ins><span class="cx">                                 A80E7E9F0A1A83E3007FB8C5 /* JSHTMLButtonElement.h in Headers */,
</span><span class="cx">                                 938E666209F09B87008A48EC /* JSHTMLCanvasElement.h in Headers */,
</span><span class="cx">                                 BCCBAD410C18C14200CE890F /* JSHTMLCollection.h in Headers */,
</span><span class="lines">@@ -27874,6 +27881,7 @@
</span><span class="cx">                                 8542A7960AE5C94200DF58DF /* JSSVGPoint.cpp in Sources */,
</span><span class="cx">                                 B2FA3DE20AB75A6F000E5AC4 /* JSSVGPointList.cpp in Sources */,
</span><span class="cx">                                 B2FA3DE50AB75A6F000E5AC4 /* JSSVGPolygonElement.cpp in Sources */,
</span><ins>+                                7CC564BA18BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp in Sources */,
</ins><span class="cx">                                 B2FA3DE70AB75A6F000E5AC4 /* JSSVGPolylineElement.cpp in Sources */,
</span><span class="cx">                                 B2FA3DE90AB75A6F000E5AC4 /* JSSVGPreserveAspectRatio.cpp in Sources */,
</span><span class="cx">                                 B2FA3DEB0AB75A6F000E5AC4 /* JSSVGRadialGradientElement.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLTreeBuildercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp (164568 => 164569)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp        2014-02-24 01:23:57 UTC (rev 164568)
+++ trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp        2014-02-24 01:35:02 UTC (rev 164569)
</span><span class="lines">@@ -44,30 +44,10 @@
</span><span class="cx"> #include &lt;wtf/MainThread.h&gt;
</span><span class="cx"> #include &lt;wtf/unicode/CharacterNames.h&gt;
</span><span class="cx"> 
</span><del>-// FIXME: Extract the following iOS-specific code into a separate file.
</del><span class="cx"> #if ENABLE(TELEPHONE_NUMBER_DETECTION)
</span><del>-#include &quot;SoftLinking.h&quot;
-
-#ifdef __has_include
-#if __has_include(&lt;DataDetectorsCore/DDDFACache.h&gt;)
-#include &lt;DataDetectorsCore/DDDFACache.h&gt;
-#else
-typedef void* DDDFACacheRef;
</del><ins>+#include &quot;TelephoneNumberDetector.h&quot;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if __has_include(&lt;DataDetectorsCore/DDDFAScanner.h&gt;)
-#include &lt;DataDetectorsCore/DDDFAScanner.h&gt;
-#else
-typedef void* DDDFAScannerRef;
-#endif
-#endif
-
-SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(DataDetectorsCore)
-SOFT_LINK(DataDetectorsCore, DDDFACacheCreateFromFramework, DDDFACacheRef, (), ())
-SOFT_LINK(DataDetectorsCore, DDDFAScannerCreateFromCache, DDDFAScannerRef, (DDDFACacheRef cache), (cache))
-SOFT_LINK(DataDetectorsCore, DDDFAScannerFirstResultInUnicharArray, Boolean, (DDDFAScannerRef scanner, const UniChar* str, unsigned length, int* startPos, int* endPos), (scanner, str, length, startPos, endPos))
-#endif
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> using namespace HTMLNames;
</span><span class="lines">@@ -2358,14 +2338,8 @@
</span><span class="cx"> // 4. Appends the rest of the string as a text node.
</span><span class="cx"> void HTMLTreeBuilder::linkifyPhoneNumbers(const String&amp; string)
</span><span class="cx"> {
</span><del>-    static DDDFACacheRef phoneNumbersCache = DDDFACacheCreateFromFramework();
-    if (!phoneNumbersCache) {
-        m_tree.insertTextNode(string);
-        return;
-    }
</del><ins>+    ASSERT(TelephoneNumberDetector::isSupported());
</ins><span class="cx"> 
</span><del>-    static DDDFAScannerRef phoneNumbersScanner = DDDFAScannerCreateFromCache(phoneNumbersCache);
-
</del><span class="cx">     // relativeStartPosition and relativeEndPosition are the endpoints of the phone number range,
</span><span class="cx">     // relative to the scannerPosition
</span><span class="cx">     unsigned length = string.length();
</span><span class="lines">@@ -2374,7 +2348,7 @@
</span><span class="cx">     int relativeEndPosition = 0;
</span><span class="cx"> 
</span><span class="cx">     // While there's a phone number in the rest of the string...
</span><del>-    while ((scannerPosition &lt; length) &amp;&amp; DDDFAScannerFirstResultInUnicharArray(phoneNumbersScanner, &amp;string.deprecatedCharacters()[scannerPosition], length - scannerPosition, &amp;relativeStartPosition, &amp;relativeEndPosition)) {
</del><ins>+    while ((scannerPosition &lt; length) &amp;&amp; TelephoneNumberDetector::find(&amp;string.deprecatedCharacters()[scannerPosition], length - scannerPosition, &amp;relativeStartPosition, &amp;relativeEndPosition)) {
</ins><span class="cx">         // The convention in the Data Detectors framework is that the end position is the first character NOT in the phone number
</span><span class="cx">         // (that is, the length of the range is relativeEndPosition - relativeStartPosition). So substract 1 to get the same
</span><span class="cx">         // convention as the old WebCore phone number parser (so that the rest of the code is still valid if we want to go back
</span><span class="lines">@@ -2600,7 +2574,7 @@
</span><span class="cx">     m_tree.reconstructTheActiveFormattingElements();
</span><span class="cx">     String characters = buffer.takeRemaining();
</span><span class="cx"> #if ENABLE(TELEPHONE_NUMBER_DETECTION)
</span><del>-    if (!isParsingFragment() &amp;&amp; m_tree.isTelephoneNumberParsingEnabled() &amp;&amp; shouldParseTelephoneNumbersInNode(*m_tree.currentNode()) &amp;&amp; DataDetectorsCoreLibrary())
</del><ins>+    if (!isParsingFragment() &amp;&amp; m_tree.isTelephoneNumberParsingEnabled() &amp;&amp; shouldParseTelephoneNumbersInNode(*m_tree.currentNode()) &amp;&amp; TelephoneNumberDetector::isSupported())
</ins><span class="cx">         linkifyPhoneNumbers(characters);
</span><span class="cx">     else
</span><span class="cx">         m_tree.insertTextNode(characters);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformTelephoneNumberDetectorh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/TelephoneNumberDetector.h (0 => 164569)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/TelephoneNumberDetector.h                                (rev 0)
+++ trunk/Source/WebCore/platform/TelephoneNumberDetector.h        2014-02-24 01:35:02 UTC (rev 164569)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TelephoneNumberDetector_h
+#define TelephoneNumberDetector_h
+
+//#if ENABLE(TELEPHONE_NUMBER_DETECTION)
+
+#include &lt;unicode/utypes.h&gt;
+
+namespace WebCore {
+namespace TelephoneNumberDetector {
+
+bool isSupported();
+bool find(const UChar* buffer, unsigned length, int* startPos, int* endPos);
+
+} // namespace TelephoneNumberDetector
+} // namespace WebCore
+
+//#endif // ENABLE(TELEPHONE_NUMBER_DETECTION)
+#endif // TelephoneNumberDetector_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaTelephoneNumberDetectorCocoacpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/cocoa/TelephoneNumberDetectorCocoa.cpp (0 => 164569)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/TelephoneNumberDetectorCocoa.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/cocoa/TelephoneNumberDetectorCocoa.cpp        2014-02-24 01:35:02 UTC (rev 164569)
</span><span class="lines">@@ -0,0 +1,82 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;TelephoneNumberDetector.h&quot;
+
+#if ENABLE(TELEPHONE_NUMBER_DETECTION)
+
+#include &quot;SoftLinking.h&quot;
+
+#ifdef __has_include
+#if __has_include(&lt;DataDetectorsCore/DDDFACache.h&gt;)
+#include &lt;DataDetectorsCore/DDDFACache.h&gt;
+#else
+typedef void* DDDFACacheRef;
+#endif
+
+#if __has_include(&lt;DataDetectorsCore/DDDFAScanner.h&gt;)
+#include &lt;DataDetectorsCore/DDDFAScanner.h&gt;
+#else
+typedef void* DDDFAScannerRef;
+#endif
+#endif
+
+SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(DataDetectorsCore)
+SOFT_LINK(DataDetectorsCore, DDDFACacheCreateFromFramework, DDDFACacheRef, (), ())
+SOFT_LINK(DataDetectorsCore, DDDFAScannerCreateFromCache, DDDFAScannerRef, (DDDFACacheRef cache), (cache))
+SOFT_LINK(DataDetectorsCore, DDDFAScannerFirstResultInUnicharArray, Boolean, (DDDFAScannerRef scanner, const UniChar* str, unsigned length, int* startPos, int* endPos), (scanner, str, length, startPos, endPos))
+
+namespace WebCore {
+namespace TelephoneNumberDetector {
+
+static DDDFAScannerRef phoneNumbersScanner()
+{
+    if (!DataDetectorsCoreLibrary())
+        return nullptr;
+
+    static DDDFACacheRef cache = DDDFACacheCreateFromFramework();
+    if (!cache)
+        return nullptr;
+
+    static DDDFAScannerRef scanner = DDDFAScannerCreateFromCache(cache);
+    return scanner;
+}
+
+bool isSupported()
+{
+    return phoneNumbersScanner() != nullptr;
+}
+
+bool find(const UChar* buffer, unsigned length, int* startPos, int* endPos)
+{
+    ASSERT(isSupported());
+    return DDDFAScannerFirstResultInUnicharArray(phoneNumbersScanner(), buffer, length, startPos, endPos);
+}
+
+} // namespace TelephoneNumberDetector
+} // namespace WebCore
+
+#endif // ENABLE(TELEPHONE_NUMBER_DETECTION)
</ins></span></pre>
</div>
</div>

</body>
</html>