diff --git a/editor/base/nsHTMLEditor.cpp b/editor/base/nsHTMLEditor.cpp index 0f1f82c4ec3..3479cd1e302 100644 --- a/editor/base/nsHTMLEditor.cpp +++ b/editor/base/nsHTMLEditor.cpp @@ -1251,7 +1251,7 @@ nsHTMLEditor::SetInlinePropertyOnNode( nsIDOMNode *aNode, // then loop through the list, set the property on each node PRUint32 listCount; arrayOfNodes->Count(&listCount); - for (j = 0; j < listCount; j++) + for (j = 0; j < (PRInt32)listCount; j++) { isupports = (dont_AddRef)(arrayOfNodes->ElementAt(0)); node = do_QueryInterface(isupports); @@ -1587,7 +1587,7 @@ PRBool nsHTMLEditor::IsAtEndOfNode(nsIDOMNode *aNode, PRInt32 aOffset) if (!aNode) return PR_FALSE; // oops PRUint32 len; GetLengthOfDOMNode(aNode, len); - if (aOffset == len) return PR_TRUE; + if (aOffset == (PRInt32)len) return PR_TRUE; if (IsTextNode(aNode)) { @@ -4348,6 +4348,14 @@ NS_IMETHODIMP nsHTMLEditor::Paste() } } + // Try to scroll the selection into view if the paste succeeded: + if (NS_SUCCEEDED(rv)) + { + nsCOMPtr presShell; + if (NS_SUCCEEDED(GetPresShell(getter_AddRefs(presShell))) && presShell) + presShell->ScrollSelectionIntoView(SELECTION_NORMAL, SELECTION_FOCUS_REGION); + } + return rv; } @@ -6772,7 +6780,6 @@ nsHTMLEditor::MoveContiguousContentIntoNewParent(nsIDOMNode *aStartNode, nsresult result = NS_OK; nsCOMPtrstartNode, endNode; PRInt32 startOffset = aStartOffset; // this will be the left edge of what we change - PRInt32 endOffset = aEndOffset; // this will be the right edge of what we change nsCOMPtrnewLeftNode; // this will be the middle text node if (IsTextNode(aStartNode)) { diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp index 0f1f82c4ec3..3479cd1e302 100644 --- a/editor/libeditor/html/nsHTMLEditor.cpp +++ b/editor/libeditor/html/nsHTMLEditor.cpp @@ -1251,7 +1251,7 @@ nsHTMLEditor::SetInlinePropertyOnNode( nsIDOMNode *aNode, // then loop through the list, set the property on each node PRUint32 listCount; arrayOfNodes->Count(&listCount); - for (j = 0; j < listCount; j++) + for (j = 0; j < (PRInt32)listCount; j++) { isupports = (dont_AddRef)(arrayOfNodes->ElementAt(0)); node = do_QueryInterface(isupports); @@ -1587,7 +1587,7 @@ PRBool nsHTMLEditor::IsAtEndOfNode(nsIDOMNode *aNode, PRInt32 aOffset) if (!aNode) return PR_FALSE; // oops PRUint32 len; GetLengthOfDOMNode(aNode, len); - if (aOffset == len) return PR_TRUE; + if (aOffset == (PRInt32)len) return PR_TRUE; if (IsTextNode(aNode)) { @@ -4348,6 +4348,14 @@ NS_IMETHODIMP nsHTMLEditor::Paste() } } + // Try to scroll the selection into view if the paste succeeded: + if (NS_SUCCEEDED(rv)) + { + nsCOMPtr presShell; + if (NS_SUCCEEDED(GetPresShell(getter_AddRefs(presShell))) && presShell) + presShell->ScrollSelectionIntoView(SELECTION_NORMAL, SELECTION_FOCUS_REGION); + } + return rv; } @@ -6772,7 +6780,6 @@ nsHTMLEditor::MoveContiguousContentIntoNewParent(nsIDOMNode *aStartNode, nsresult result = NS_OK; nsCOMPtrstartNode, endNode; PRInt32 startOffset = aStartOffset; // this will be the left edge of what we change - PRInt32 endOffset = aEndOffset; // this will be the right edge of what we change nsCOMPtrnewLeftNode; // this will be the middle text node if (IsTextNode(aStartNode)) {