summaryrefslogtreecommitdiffstats
path: root/layout/forms
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-04-17 05:28:43 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-04-17 05:28:43 -0400
commit940d191ef8b61309f4ea83d0fea77828f361251b (patch)
tree328a57b6d2e2b018343e2c5d20e0602d613f0e19 /layout/forms
parentef689a705ffdd79cdeeca8e68438b4ad6597f38d (diff)
downloadUXP-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 'layout/forms')
-rw-r--r--layout/forms/nsTextControlFrame.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp
index aa3185d39..b34e132e6 100644
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -758,7 +758,12 @@ nsTextControlFrame::SetSelectionInternal(nsIDOMNode *aStartNode,
// we have access to the node.
nsCOMPtr<nsINode> start = do_QueryInterface(aStartNode);
nsCOMPtr<nsINode> end = do_QueryInterface(aEndNode);
- nsresult rv = range->Set(start, aStartOffset, end, aEndOffset);
+ // XXXbz nsRange::SetStartAndEnd takes int32_t (and ranges generally work on
+ // int32_t), but we're passing uint32_t. The good news is that at this point
+ // our endpoints should really be within our length, so not really that big.
+ // And if they _are_ that big, SetStartAndEnd() will simply error out, which
+ // is not too bad for a case we don't expect to happen.
+ nsresult rv = range->SetStartAndEnd(start, aStartOffset, end, aEndOffset);
NS_ENSURE_SUCCESS(rv, rv);
// Get the selection, clear it and add the new range to it!