Changeset 171376 in webkit
- Timestamp:
- Jul 22, 2014 5:36:13 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r171375 r171376 1 2014-07-22 Tim Horton <timothy_horton@apple.com> 2 3 REGRESSION (r171016): Reproducible infinite spin selecting phone number 4 https://bugs.webkit.org/show_bug.cgi?id=135183 5 <rdar://problem/17727342> 6 7 Reviewed by Ryosuke Niwa. 8 9 * editing/Editor.cpp: 10 (WebCore::Editor::scanRangeForTelephoneNumbers): 11 Make use of TextIterator::subrange, which knows how to make a subrange from character positions, 12 instead of assuming that our character positions translate directly to positions in the incoming range. 13 Make use of DocumentMarkerController::addMarker, which takes a range and applies the marker to 14 all text nodes inside the range as appropriate. 15 Fix naming of the shadowed 'length' local. 16 Fix a typo in the comment. 17 1 18 2014-07-22 Myles C. Maxfield <mmaxfield@apple.com> 2 19 -
trunk/Source/WebCore/editing/Editor.cpp
r171016 r171376 3461 3461 while (scannerPosition < length && TelephoneNumberDetector::find(&characters[scannerPosition], length - scannerPosition, &relativeStartPosition, &relativeEndPosition)) { 3462 3462 // The convention in the Data Detectors framework is that the end position is the first character NOT in the phone number 3463 // (that is, the length of the range is relativeEndPosition - relativeStartPosition). So sub stract 1 to get the same3463 // (that is, the length of the range is relativeEndPosition - relativeStartPosition). So subtract 1 to get the same 3464 3464 // convention as the old WebCore phone number parser (so that the rest of the code is still valid if we want to go back 3465 3465 // to the old parser). … … 3468 3468 ASSERT(scannerPosition + relativeEndPosition < length); 3469 3469 3470 // It doesn't make sense to add the document marker to a match that's not in a text node. 3471 if (!startNode->isTextNode()) 3472 continue; 3473 3474 unsigned startOffset = range.startOffset() + scannerPosition + relativeStartPosition; 3475 unsigned length = relativeEndPosition - relativeStartPosition + 1; 3476 3477 markedRanges.append(Range::create(range.ownerDocument(), startNode, startOffset, startNode, startOffset + length)); 3478 range.ownerDocument().markers().addMarkerToNode(startNode, startOffset, length, DocumentMarker::TelephoneNumber); 3470 unsigned subrangeOffset = scannerPosition + relativeStartPosition; 3471 unsigned subrangeLength = relativeEndPosition - relativeStartPosition + 1; 3472 3473 RefPtr<Range> subrange = TextIterator::subrange(&range, subrangeOffset, subrangeLength); 3474 markedRanges.append(subrange); 3475 range.ownerDocument().markers().addMarker(subrange.get(), DocumentMarker::TelephoneNumber); 3479 3476 3480 3477 scannerPosition += relativeEndPosition + 1;
Note: See TracChangeset
for help on using the changeset viewer.