nsresult HTMLEditor::HideInlineTableEditingUI() { mInlineEditedCell = nullptr; RemoveMouseClickListener(mAddColumnBeforeButton); RemoveMouseClickListener(mRemoveColumnButton); RemoveMouseClickListener(mAddColumnAfterButton); RemoveMouseClickListener(mAddRowBeforeButton); RemoveMouseClickListener(mRemoveRowButton); RemoveMouseClickListener(mAddRowAfterButton); // get the presshell's document observer interface. nsCOMPtr<nsIPresShell> ps = GetPresShell(); // We allow the pres shell to be null; when it is, we presume there // are no document observers to notify, but we still want to // UnbindFromTree. DeleteRefToAnonymousNode(Move(mAddColumnBeforeButton), ps); DeleteRefToAnonymousNode(Move(mRemoveColumnButton), ps); DeleteRefToAnonymousNode(Move(mAddColumnAfterButton), ps); DeleteRefToAnonymousNode(Move(mAddRowBeforeButton), ps); DeleteRefToAnonymousNode(Move(mRemoveRowButton), ps); DeleteRefToAnonymousNode(Move(mAddRowAfterButton), ps); return NS_OK; }
NS_IMETHODIMP nsHTMLEditor::HideInlineTableEditingUI() { mInlineEditedCell = nsnull; RemoveMouseClickListener(mAddColumnBeforeButton); RemoveMouseClickListener(mRemoveColumnButton); RemoveMouseClickListener(mAddColumnAfterButton); RemoveMouseClickListener(mAddRowBeforeButton); RemoveMouseClickListener(mRemoveRowButton); RemoveMouseClickListener(mAddRowAfterButton); // get the presshell's document observer interface. nsCOMPtr<nsIPresShell> ps; GetPresShell(getter_AddRefs(ps)); // We allow the pres shell to be null; when it is, we presume there // are no document observers to notify, but we still want to // UnbindFromTree. // get the root content node. nsIDOMElement *bodyElement = GetRoot(); nsCOMPtr<nsIContent> bodyContent( do_QueryInterface(bodyElement) ); NS_ENSURE_TRUE(bodyContent, NS_ERROR_FAILURE); DeleteRefToAnonymousNode(mAddColumnBeforeButton, bodyContent, ps); mAddColumnBeforeButton = nsnull; DeleteRefToAnonymousNode(mRemoveColumnButton, bodyContent, ps); mRemoveColumnButton = nsnull; DeleteRefToAnonymousNode(mAddColumnAfterButton, bodyContent, ps); mAddColumnAfterButton = nsnull; DeleteRefToAnonymousNode(mAddRowBeforeButton, bodyContent, ps); mAddRowBeforeButton = nsnull; DeleteRefToAnonymousNode(mRemoveRowButton, bodyContent, ps); mRemoveRowButton = nsnull; DeleteRefToAnonymousNode(mAddRowAfterButton, bodyContent, ps); mAddRowAfterButton = nsnull; return NS_OK; }