Title: [171394] branches/safari-600.1-branch/Source/WebCore
- Revision
- 171394
- Author
- dburk...@apple.com
- Date
- 2014-07-22 21:54:26 -0700 (Tue, 22 Jul 2014)
Log Message
Merge r171376
Modified Paths
Diff
Modified: branches/safari-600.1-branch/Source/WebCore/ChangeLog (171393 => 171394)
--- branches/safari-600.1-branch/Source/WebCore/ChangeLog 2014-07-23 04:53:54 UTC (rev 171393)
+++ branches/safari-600.1-branch/Source/WebCore/ChangeLog 2014-07-23 04:54:26 UTC (rev 171394)
@@ -1,3 +1,24 @@
+2014-07-22 Dana Burkart <dburk...@apple.com>
+
+ Merge r171376.
+
+ 2014-07-22 Tim Horton <timothy_hor...@apple.com>
+
+ REGRESSION (r171016): Reproducible infinite spin selecting phone number
+ https://bugs.webkit.org/show_bug.cgi?id=135183
+ <rdar://problem/17727342>
+
+ Reviewed by Ryosuke Niwa.
+
+ * editing/Editor.cpp:
+ (WebCore::Editor::scanRangeForTelephoneNumbers):
+ Make use of TextIterator::subrange, which knows how to make a subrange from character positions,
+ instead of assuming that our character positions translate directly to positions in the incoming range.
+ Make use of DocumentMarkerController::addMarker, which takes a range and applies the marker to
+ all text nodes inside the range as appropriate.
+ Fix naming of the shadowed 'length' local.
+ Fix a typo in the comment.
+
2014-07-17 Dean Jackson <d...@apple.com>
<rdar://problem/17675068> Disable some features on this branch.
Modified: branches/safari-600.1-branch/Source/WebCore/editing/Editor.cpp (171393 => 171394)
--- branches/safari-600.1-branch/Source/WebCore/editing/Editor.cpp 2014-07-23 04:53:54 UTC (rev 171393)
+++ branches/safari-600.1-branch/Source/WebCore/editing/Editor.cpp 2014-07-23 04:54:26 UTC (rev 171394)
@@ -3460,23 +3460,20 @@
while (scannerPosition < length && TelephoneNumberDetector::find(&characters[scannerPosition], length - scannerPosition, &relativeStartPosition, &relativeEndPosition)) {
// The convention in the Data Detectors framework is that the end position is the first character NOT in the phone number
- // (that is, the length of the range is relativeEndPosition - relativeStartPosition). So substract 1 to get the same
+ // (that is, the length of the range is relativeEndPosition - relativeStartPosition). So subtract 1 to get the same
// convention as the old WebCore phone number parser (so that the rest of the code is still valid if we want to go back
// to the old parser).
--relativeEndPosition;
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 (!startNode->isTextNode())
- continue;
+ unsigned subrangeOffset = scannerPosition + relativeStartPosition;
+ unsigned subrangeLength = relativeEndPosition - relativeStartPosition + 1;
- unsigned startOffset = range.startOffset() + scannerPosition + relativeStartPosition;
- unsigned length = relativeEndPosition - relativeStartPosition + 1;
+ RefPtr<Range> subrange = TextIterator::subrange(&range, subrangeOffset, subrangeLength);
+ markedRanges.append(subrange);
+ range.ownerDocument().markers().addMarker(subrange.get(), 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
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes