Bug 1383641 - GetFlatTextLengthInRange shouldn't use nsIDOMNode version of nsRange::SetStart. r=masayuki

nsGenericDOMDataNode::SetData uses GetFlatTextLengthInRange.  But GetFlatTextLengthInRange still use nsIDOMNode.  It means that we need additional QI twice.  So we should use nsINode version directly instead.

MozReview-Commit-ID: 3FX0uPGh53O

--HG--
extra : rebase_source : 1a4689ae8744062af8cc1f112b89075ddf3e1271
This commit is contained in:
Makoto Kato 2017-07-24 18:29:19 +09:00
Родитель a46b077ea1
Коммит 27cd039649
1 изменённых файлов: 18 добавлений и 6 удалений

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

@ -166,18 +166,30 @@ public:
}
nsresult SetToRangeStart(nsRange* aRange) const
{
nsCOMPtr<nsIDOMNode> domNode(do_QueryInterface(mNode));
return aRange->SetStart(domNode, mOffset);
if (!IsValid()) {
return NS_ERROR_FAILURE;
}
ErrorResult errorResult;
aRange->SetStart(*mNode, mOffset, errorResult);
return errorResult.StealNSResult();
}
nsresult SetToRangeEnd(nsRange* aRange) const
{
nsCOMPtr<nsIDOMNode> domNode(do_QueryInterface(mNode));
return aRange->SetEnd(domNode, mOffset);
if (!IsValid()) {
return NS_ERROR_FAILURE;
}
ErrorResult errorResult;
aRange->SetEnd(*mNode, mOffset, errorResult);
return errorResult.StealNSResult();
}
nsresult SetToRangeEndAfter(nsRange* aRange) const
{
nsCOMPtr<nsIDOMNode> domNode(do_QueryInterface(mNode));
return aRange->SetEndAfter(domNode);
if (!IsValid()) {
return NS_ERROR_FAILURE;
}
ErrorResult errorResult;
aRange->SetEndAfter(*mNode, errorResult);
return errorResult.StealNSResult();
}
};