Bug 1406215 - Part 2: Remove the usage of nsINode::GetChildAt() from nsTextServicesDocument::GetCollapsedSelection(); r=masayuki

This commit is contained in:
Ehsan Akhgari 2017-10-05 19:47:28 -04:00
parent 6f1701de55
commit e3ed6f0810

View File

@ -2389,13 +2389,10 @@ nsTextServicesDocument::GetCollapsedSelection(nsITextServicesDocument::TSDBlockS
// If the parent has children, position the iterator
// on the child that is to the left of the offset.
uint32_t childIndex = offset;
if (childIndex > 0) {
childIndex -= 1;
nsIContent* content = range->GetChildAtStartOffset();
if (content && parent->GetFirstChild() != content) {
content = content->GetPreviousSibling();
}
nsIContent* content = parent->GetChildAt(childIndex);
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
rv = iter->PositionAt(content);