Title: [169235] trunk/Source/WebCore
Revision
169235
Author
[email protected]
Date
2014-05-22 18:29:30 -0700 (Thu, 22 May 2014)

Log Message

Don't scan for phone numbers in editable regions
<rdar://problem/16949846> and https://bugs.webkit.org/show_bug.cgi?id=133192

Reviewed by Enrica Casucci.

No new tests (Currently untested WK2-only feature)

* editing/Editor.cpp:
(WebCore::Editor::scanRangeForTelephoneNumbers): Skip the range if the Node is editable.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (169234 => 169235)


--- trunk/Source/WebCore/ChangeLog	2014-05-23 01:04:43 UTC (rev 169234)
+++ trunk/Source/WebCore/ChangeLog	2014-05-23 01:29:30 UTC (rev 169235)
@@ -1,3 +1,15 @@
+2014-05-22  Brady Eidson  <[email protected]>
+
+        Don't scan for phone numbers in editable regions
+        <rdar://problem/16949846> and https://bugs.webkit.org/show_bug.cgi?id=133192
+
+        Reviewed by Enrica Casucci.
+
+        No new tests (Currently untested WK2-only feature)
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::scanRangeForTelephoneNumbers): Skip the range if the Node is editable.
+
 2014-05-22  Jeremy Jones  <[email protected]>
 
         Captions layout incorrectly in fullscreen.

Modified: trunk/Source/WebCore/editing/Editor.cpp (169234 => 169235)


--- trunk/Source/WebCore/editing/Editor.cpp	2014-05-23 01:04:43 UTC (rev 169234)
+++ trunk/Source/WebCore/editing/Editor.cpp	2014-05-23 01:29:30 UTC (rev 169235)
@@ -3385,6 +3385,12 @@
 
 void Editor::scanRangeForTelephoneNumbers(Range& range, const StringView& stringView, Vector<RefPtr<Range>>& markedRanges)
 {
+    // Don't scan for phone numbers inside editable regions.
+    Node* startNode = range.startContainer();
+    ASSERT(startNode);
+    if (startNode->hasEditableStyle())
+        return;
+
     // relativeStartPosition and relativeEndPosition are the endpoints of the phone number range,
     // relative to the scannerPosition
     unsigned length = stringView.length();
@@ -3404,14 +3410,14 @@
         ASSERT(scannerPosition + relativeEndPosition < length);
 
         // It doesn't make sense to add the document marker to a match that's not in a text node.
-        if (!range.startContainer()->isTextNode())
+        if (!startNode->isTextNode())
             continue;
 
         unsigned startOffset = range.startOffset() + scannerPosition + relativeStartPosition;
         unsigned length = relativeEndPosition - relativeStartPosition + 1;
 
-        markedRanges.append(Range::create(range.ownerDocument(), range.startContainer(), startOffset, range.startContainer(), startOffset + length));
-        range.ownerDocument().markers().addMarkerToNode(range.startContainer(), startOffset, length, DocumentMarker::TelephoneNumber);
+        markedRanges.append(Range::create(range.ownerDocument(), startNode, startOffset, startNode, startOffset + length));
+        range.ownerDocument().markers().addMarkerToNode(startNode, startOffset, length, DocumentMarker::TelephoneNumber);
 
         scannerPosition += relativeEndPosition + 1;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to