Bug 1414581 - Part 1. Require more nullptr check of parent node. r?masayuki
Bug 1402904 added nullptr check for parent node, but I forgot to add this
nullptr check of selected node for outdent command.
So I need to add more nullptr check.
MozReview-Commit-ID: Au9wrG6htk8
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -4326,18 +4326,22 @@ HTMLEditRules::WillOutdent(Selection& aS
bool curBlockQuoteIsIndentedWithCSS = false;
for (uint32_t i = 0; i < arrayOfNodes.Length(); i++) {
if (!arrayOfNodes[i]->IsContent()) {
continue;
}
OwningNonNull<nsIContent> curNode = *arrayOfNodes[i]->AsContent();
// Here's where we actually figure out what to do
- nsCOMPtr<nsINode> curParent = curNode->GetParentNode();
- int32_t offset = curParent ? curParent->IndexOf(curNode) : -1;
+ int32_t offset;
+ nsCOMPtr<nsINode> curParent =
+ EditorBase::GetNodeLocation(curNode, &offset);
+ if (!curParent) {
+ continue;
+ }
// Is it a blockquote?
if (curNode->IsHTMLElement(nsGkAtoms::blockquote)) {
// If it is a blockquote, remove it. So we need to finish up dealng
// with any curBlockQuote first.
if (curBlockQuote) {
rv = OutdentPartOfBlock(*curBlockQuote, *firstBQChild, *lastBQChild,
curBlockQuoteIsIndentedWithCSS,