Bug 373077. getTextAtOffset() failing when there are list bullet frames involved. r=parente

This commit is contained in:
aaronleventhal%moonset.net 2007-03-13 14:56:49 +00:00
Родитель 11646b54bd
Коммит 20eccbdeca
1 изменённых файлов: 14 добавлений и 1 удалений

Просмотреть файл

@ -561,7 +561,20 @@ PRInt32 nsHyperTextAccessible::GetRelativeOffset(nsIPresShell *aPresShell, nsIFr
kIsScrollViewAStop, kIsKeyboardSelect, kIsVisualBidi,
wordMovementType);
nsresult rv = aFromFrame->PeekOffset(&pos);
NS_ENSURE_SUCCESS(rv, -1);
if (NS_FAILED(rv)) {
if (aDirection == eDirPrevious) {
// Use passed-in frame as starting point in failure case for now,
// this is a hack to deal with starting on a list bullet frame,
// which fails in PeekOffset() because the line iterator doesn't see it.
// XXX Need to look at our overall handling of list bullets, which are an odd case
pos.mResultContent = aFromFrame->GetContent();
PRInt32 endOffsetUnused;
aFromFrame->GetOffsets(pos.mContentOffset, endOffsetUnused);
}
else {
return rv;
}
}
// Turn the resulting node and offset into a hyperTextOffset
PRInt32 hyperTextOffset;