summaryrefslogtreecommitdiff
path: root/dom/events
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 /dom/events
parentef689a705ffdd79cdeeca8e68438b4ad6597f38d (diff)
downloaduxp-940d191ef8b61309f4ea83d0fea77828f361251b.tar.gz
Bug 1367683 - Optimize initializing nsRange
Tag #1375
Diffstat (limited to 'dom/events')
-rw-r--r--dom/events/ContentEventHandler.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/dom/events/ContentEventHandler.cpp b/dom/events/ContentEventHandler.cpp
index 935ade23f4..df54a4d44a 100644
--- a/dom/events/ContentEventHandler.cpp
+++ b/dom/events/ContentEventHandler.cpp
@@ -980,11 +980,7 @@ ContentEventHandler::SetRangeFromFlatTextOffset(nsRange* aRange,
// Special case like <br contenteditable>
if (!mRootContent->HasChildren()) {
- nsresult rv = aRange->SetStart(mRootContent, 0);
- if (NS_WARN_IF(NS_FAILED(rv))) {
- return rv;
- }
- rv = aRange->SetEnd(mRootContent, 0);
+ nsresult rv = aRange->CollapseTo(mRootContent, 0);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
@@ -2880,8 +2876,7 @@ ContentEventHandler::AdjustCollapsedRangeMaybeIntoTextNode(nsRange* aRange)
return NS_OK;
}
- nsresult rv = aRange->Set(childNode, offsetInChildNode,
- childNode, offsetInChildNode);
+ nsresult rv = aRange->CollapseTo(childNode, offsetInChildNode);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}