Aryeh Gregor wrote:

for instance, here's a real-world bit of code from nsWSRunObject:

     if ((aRun->mRightType & WSType::block) &&
         IsBlockNode(nsCOMPtr<nsINode>(GetWSBoundingParent()))) {

GetWSBoundingParent() returns an already_AddRefed<nsINode>

Well there's your problem: GetWSBoundingParent doesn't need to own the nodes it works on. This is what it should do:

nsINode*
nsWSRunObject::GetWSBoundingParent()
{
 NS_ENSURE_TRUE(mNode, nullptr);
 nsINode* wsBoundingParent = mNode;
 while (!IsBlockNode(wsBoundingParent)) {
   nsINode* parent = wsBoundingParent->GetParentNode();
   if (!parent || !mHTMLEditor->IsEditable(parent)) {
     break;
   }
   wsBoundingParent = parent;
 }
 return wsBoundingParent;
}

--
Warning: May contain traces of nuts.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to