summaryrefslogtreecommitdiffstats
path: root/editor/libeditor/HTMLEditor.cpp
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-04-17 06:10:23 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-04-17 06:10:23 -0400
commit70c8ff8e5af7d2661b64fb92a158f2860af7766c (patch)
treee7fd37d81858a7dfa06fbf59880d837d9e7fa256 /editor/libeditor/HTMLEditor.cpp
parent53428ad3f04ff1e01f0596ef0c592bdbe5fdd15b (diff)
downloadUXP-70c8ff8e5af7d2661b64fb92a158f2860af7766c.tar
UXP-70c8ff8e5af7d2661b64fb92a158f2860af7766c.tar.gz
UXP-70c8ff8e5af7d2661b64fb92a158f2860af7766c.tar.lz
UXP-70c8ff8e5af7d2661b64fb92a158f2860af7766c.tar.xz
UXP-70c8ff8e5af7d2661b64fb92a158f2860af7766c.zip
Bug 1377978 - Make nsRange use uint32_t to offset
Tag #1375
Diffstat (limited to 'editor/libeditor/HTMLEditor.cpp')
-rw-r--r--editor/libeditor/HTMLEditor.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/editor/libeditor/HTMLEditor.cpp b/editor/libeditor/HTMLEditor.cpp
index fd11d1a45..766ab81cf 100644
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -2405,21 +2405,19 @@ HTMLEditor::GetSelectedElement(const nsAString& aTagName,
NS_ENSURE_STATE(range);
nsCOMPtr<nsIDOMNode> startParent;
- int32_t startOffset, endOffset;
nsresult rv = range->GetStartContainer(getter_AddRefs(startParent));
NS_ENSURE_SUCCESS(rv, rv);
- rv = range->GetStartOffset(&startOffset);
- NS_ENSURE_SUCCESS(rv, rv);
+ uint32_t startOffset = range->StartOffset();
nsCOMPtr<nsIDOMNode> endParent;
rv = range->GetEndContainer(getter_AddRefs(endParent));
NS_ENSURE_SUCCESS(rv, rv);
- rv = range->GetEndOffset(&endOffset);
- NS_ENSURE_SUCCESS(rv, rv);
+ uint32_t endOffset = range->EndOffset();
// Optimization for a single selected element
if (startParent && startParent == endParent && endOffset - startOffset == 1) {
- nsCOMPtr<nsIDOMNode> selectedNode = GetChildAt(startParent, startOffset);
+ nsCOMPtr<nsIDOMNode> selectedNode =
+ GetChildAt(startParent, static_cast<int32_t>(startOffset));
NS_ENSURE_SUCCESS(rv, NS_OK);
if (selectedNode) {
selectedNode->GetNodeName(domTagName);