diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 06:10:23 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 06:10:23 -0400 |
commit | 70c8ff8e5af7d2661b64fb92a158f2860af7766c (patch) | |
tree | e7fd37d81858a7dfa06fbf59880d837d9e7fa256 /editor/libeditor/HTMLTableEditor.cpp | |
parent | 53428ad3f04ff1e01f0596ef0c592bdbe5fdd15b (diff) | |
download | uxp-70c8ff8e5af7d2661b64fb92a158f2860af7766c.tar.gz |
Bug 1377978 - Make nsRange use uint32_t to offset
Tag #1375
Diffstat (limited to 'editor/libeditor/HTMLTableEditor.cpp')
-rw-r--r-- | editor/libeditor/HTMLTableEditor.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/editor/libeditor/HTMLTableEditor.cpp b/editor/libeditor/HTMLTableEditor.cpp index 06d6cae265..b26466179b 100644 --- a/editor/libeditor/HTMLTableEditor.cpp +++ b/editor/libeditor/HTMLTableEditor.cpp @@ -2932,11 +2932,10 @@ HTMLEditor::GetCellFromRange(nsRange* aRange, NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_TRUE(startParent, NS_ERROR_FAILURE); - int32_t startOffset; - rv = aRange->GetStartOffset(&startOffset); - NS_ENSURE_SUCCESS(rv, rv); + uint32_t startOffset = aRange->StartOffset(); - nsCOMPtr<nsIDOMNode> childNode = GetChildAt(startParent, startOffset); + nsCOMPtr<nsIDOMNode> childNode = + GetChildAt(startParent, static_cast<int32_t>(startOffset)); // This means selection is probably at a text node (or end of doc?) if (!childNode) { return NS_ERROR_FAILURE; @@ -2947,15 +2946,11 @@ HTMLEditor::GetCellFromRange(nsRange* aRange, NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_TRUE(startParent, NS_ERROR_FAILURE); - int32_t endOffset; - rv = aRange->GetEndOffset(&endOffset); - NS_ENSURE_SUCCESS(rv, rv); - // If a cell is deleted, the range is collapse - // (startOffset == endOffset) + // (startOffset == aRange->EndOffset()) // so tell caller the cell wasn't found if (startParent == endParent && - endOffset == startOffset+1 && + aRange->EndOffset() == startOffset+1 && HTMLEditUtils::IsTableCell(childNode)) { // Should we also test if frame is selected? (Use GetCellDataAt()) // (Let's not for now -- more efficient) |