diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 05:28:43 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 05:28:43 -0400 |
commit | 940d191ef8b61309f4ea83d0fea77828f361251b (patch) | |
tree | 328a57b6d2e2b018343e2c5d20e0602d613f0e19 /editor/txtsvc | |
parent | ef689a705ffdd79cdeeca8e68438b4ad6597f38d (diff) | |
download | UXP-940d191ef8b61309f4ea83d0fea77828f361251b.tar UXP-940d191ef8b61309f4ea83d0fea77828f361251b.tar.gz UXP-940d191ef8b61309f4ea83d0fea77828f361251b.tar.lz UXP-940d191ef8b61309f4ea83d0fea77828f361251b.tar.xz UXP-940d191ef8b61309f4ea83d0fea77828f361251b.zip |
Bug 1367683 - Optimize initializing nsRange
Tag #1375
Diffstat (limited to 'editor/txtsvc')
-rw-r--r-- | editor/txtsvc/nsTextServicesDocument.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/editor/txtsvc/nsTextServicesDocument.cpp b/editor/txtsvc/nsTextServicesDocument.cpp index e0c779683..ccf964d2c 100644 --- a/editor/txtsvc/nsTextServicesDocument.cpp +++ b/editor/txtsvc/nsTextServicesDocument.cpp @@ -406,11 +406,13 @@ nsTextServicesDocument::ExpandRangeToWordBoundaries(nsIDOMRange *aRange) // Now adjust the range so that it uses our new // end points. - - rv = range->SetEnd(rngEndNode, rngEndOffset); - NS_ENSURE_SUCCESS(rv, rv); - - return range->SetStart(rngStartNode, rngStartOffset); + nsCOMPtr<nsINode> startNode = do_QueryInterface(rngStartNode); + nsCOMPtr<nsINode> endNode = do_QueryInterface(rngEndNode); + rv = range->SetStartAndEnd(startNode, rngStartOffset, endNode, rngEndOffset); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } + return NS_OK; } NS_IMETHODIMP |