summaryrefslogtreecommitdiffstats
path: root/editor/libeditor/HTMLStyleEditor.cpp
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 /editor/libeditor/HTMLStyleEditor.cpp
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 'editor/libeditor/HTMLStyleEditor.cpp')
-rw-r--r--editor/libeditor/HTMLStyleEditor.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/editor/libeditor/HTMLStyleEditor.cpp b/editor/libeditor/HTMLStyleEditor.cpp
index 6a1ffe8b4..7141cfd61 100644
--- a/editor/libeditor/HTMLStyleEditor.cpp
+++ b/editor/libeditor/HTMLStyleEditor.cpp
@@ -541,9 +541,11 @@ HTMLEditor::SplitStyleAboveRange(nsRange* inRange,
NS_ENSURE_SUCCESS(rv, rv);
// reset the range
- rv = inRange->SetStart(startNode, startOffset);
- NS_ENSURE_SUCCESS(rv, rv);
- return inRange->SetEnd(endNode, endOffset);
+ rv = inRange->SetStartAndEnd(startNode, startOffset, endNode, endOffset);
+ if (NS_WARN_IF(NS_FAILED(rv))) {
+ return rv;
+ }
+ return NS_OK;
}
nsresult
@@ -885,10 +887,11 @@ HTMLEditor::PromoteRangeIfStartsOrEndsInNamedAnchor(nsRange& aRange)
endOffset = endNode ? endNode->IndexOf(parent) + 1 : 0;
}
- nsresult rv = aRange.SetStart(startNode, startOffset);
- NS_ENSURE_SUCCESS(rv, rv);
- rv = aRange.SetEnd(endNode, endOffset);
- NS_ENSURE_SUCCESS(rv, rv);
+ nsresult rv = aRange.SetStartAndEnd(startNode, startOffset,
+ endNode, endOffset);
+ if (NS_WARN_IF(NS_FAILED(rv))) {
+ return rv;
+ }
return NS_OK;
}
@@ -918,10 +921,11 @@ HTMLEditor::PromoteInlineRange(nsRange& aRange)
endNode = parent;
}
- nsresult rv = aRange.SetStart(startNode, startOffset);
- NS_ENSURE_SUCCESS(rv, rv);
- rv = aRange.SetEnd(endNode, endOffset);
- NS_ENSURE_SUCCESS(rv, rv);
+ nsresult rv = aRange.SetStartAndEnd(startNode, startOffset,
+ endNode, endOffset);
+ if (NS_WARN_IF(NS_FAILED(rv))) {
+ return rv;
+ }
return NS_OK;
}