remove redundant code and unused variables, cleanup (r=glazman, sr=tor, a=asa, bug=216054)

This commit is contained in:
brade%comcast.net 2003-09-03 13:56:21 +00:00
parent 8b0ca47657
commit f1dedc3d24

View File

@ -83,7 +83,6 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLEditorMouseListener, nsTextEditorMouseListene
nsresult
nsHTMLEditorMouseListener::MouseUp(nsIDOMEvent* aMouseEvent)
{
NS_ENSURE_ARG_POINTER(aMouseEvent);
nsCOMPtr<nsIDOMMouseEvent> mouseEvent ( do_QueryInterface(aMouseEvent) );
if (!mouseEvent) {
//non-ui event passed in. bad things.
@ -113,7 +112,6 @@ nsHTMLEditorMouseListener::MouseUp(nsIDOMEvent* aMouseEvent)
nsresult
nsHTMLEditorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
{
NS_ENSURE_TRUE(aMouseEvent, NS_ERROR_NULL_POINTER);
nsCOMPtr<nsIDOMMouseEvent> mouseEvent ( do_QueryInterface(aMouseEvent) );
if (!mouseEvent) {
//non-ui event passed in. bad things.
@ -159,13 +157,13 @@ nsHTMLEditorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
mEditor->GetSelection(getter_AddRefs(selection));
if (!selection) return NS_OK;
nsCOMPtr<nsIDOMNode> parent;
PRInt32 offset = 0;
// Get location of mouse within target node
nsCOMPtr<nsIDOMNSUIEvent> uiEvent = do_QueryInterface(aMouseEvent);
if (!uiEvent) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMNode> parent;
PRInt32 offset = 0;
res = uiEvent->GetRangeParent(getter_AddRefs(parent));
if (NS_FAILED(res)) return res;
if (!parent) return NS_ERROR_FAILURE;
@ -213,13 +211,6 @@ nsHTMLEditorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
if (isContextClick)
{
// Set the selection to the point under the mouse cursor:
nsCOMPtr<nsIDOMNode> parent;
if (NS_FAILED(uiEvent->GetRangeParent(getter_AddRefs(parent))))
return NS_ERROR_NULL_POINTER;
PRInt32 offset = 0;
if (NS_FAILED(uiEvent->GetRangeOffset(&offset)))
return NS_ERROR_NULL_POINTER;
selection->Collapse(parent, offset);
}
else
@ -236,20 +227,15 @@ nsHTMLEditorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
// and not the entire body, or table-related elements
if (element)
{
nsCOMPtr<nsIDOMNode> eleNode = do_QueryInterface(element);
nsCOMPtr<nsIDOMNode> selectAllNode = mHTMLEditor->FindUserSelectAllNode(element);
if (eleNode)
if (selectAllNode)
{
nsCOMPtr<nsIDOMNode> selectAllNode = mHTMLEditor->FindUserSelectAllNode(eleNode);
if (selectAllNode)
nsCOMPtr<nsIDOMElement> newElement = do_QueryInterface(selectAllNode);
if (newElement)
{
nsCOMPtr<nsIDOMElement> newElement = do_QueryInterface(selectAllNode);
if (newElement)
{
node = selectAllNode;
element = newElement;
}
node = selectAllNode;
element = newElement;
}
}
@ -298,16 +284,15 @@ nsHTMLEditorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
nsresult
nsHTMLEditorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
{
NS_ENSURE_ARG_POINTER(aMouseEvent);
nsCOMPtr<nsIDOMMouseEvent> mouseEvent ( do_QueryInterface(aMouseEvent) );
if (!mouseEvent) {
//non-ui event passed in. bad things.
return NS_OK;
}
// Don't do anything special if not an HTML editor
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(mEditor);
if (htmlEditor)
// Don't do anything special if not an HTML inline table editor
nsCOMPtr<nsIHTMLInlineTableEditor> inlineTableEditing = do_QueryInterface(mEditor);
if (inlineTableEditing)
{
nsCOMPtr<nsIDOMEventTarget> target;
nsresult res = aMouseEvent->GetTarget(getter_AddRefs(target));
@ -315,7 +300,6 @@ nsHTMLEditorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
if (!target) return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(target);
nsCOMPtr<nsIHTMLInlineTableEditor> inlineTableEditing = do_QueryInterface(htmlEditor);
inlineTableEditing->DoInlineTableEditingAction(element);
}