Backed out changeset 6081479204a0 (bug 1004522)

This commit is contained in:
Carsten "Tomcat" Book 2014-05-12 14:12:52 +02:00
parent 54a8705622
commit d828ad843c
3 changed files with 21 additions and 22 deletions

View File

@ -6630,7 +6630,7 @@ nsHTMLEditRules::ReturnInHeader(nsISelection *aSelection,
nsCOMPtr<nsIDOMNode> headerParent = nsEditor::GetNodeLocation(aHeader, &offset);
// get ws code to adjust any ws
nsCOMPtr<nsINode> selNode(do_QueryInterface(aNode));
nsCOMPtr<nsIDOMNode> selNode = aNode;
NS_ENSURE_STATE(mHTMLEditor);
nsresult res = nsWSRunObject::PrepareToSplitAcrossBlocks(mHTMLEditor,
address_of(selNode),
@ -6640,7 +6640,7 @@ nsHTMLEditRules::ReturnInHeader(nsISelection *aSelection,
// split the header
int32_t newOffset;
NS_ENSURE_STATE(mHTMLEditor);
res = mHTMLEditor->SplitNodeDeep(aHeader, GetAsDOMNode(selNode), aOffset, &newOffset);
res = mHTMLEditor->SplitNodeDeep( aHeader, selNode, aOffset, &newOffset);
NS_ENSURE_SUCCESS(res, res);
// if the leftand heading is empty, put a mozbr in it
@ -6836,9 +6836,7 @@ nsHTMLEditRules::SplitParagraph(nsIDOMNode *aPara,
// get ws code to adjust any ws
nsCOMPtr<nsIDOMNode> leftPara, rightPara;
NS_ENSURE_STATE(mHTMLEditor);
nsCOMPtr<nsINode> selNode(do_QueryInterface(*aSelNode));
res = nsWSRunObject::PrepareToSplitAcrossBlocks(mHTMLEditor, address_of(selNode), aOffset);
*aSelNode = GetAsDOMNode(selNode);
res = nsWSRunObject::PrepareToSplitAcrossBlocks(mHTMLEditor, aSelNode, aOffset);
NS_ENSURE_SUCCESS(res, res);
// split the paragraph
NS_ENSURE_STATE(mHTMLEditor);
@ -6976,14 +6974,14 @@ nsHTMLEditRules::ReturnInListItem(nsISelection *aSelection,
// else we want a new list item at the same list level.
// get ws code to adjust any ws
nsCOMPtr<nsINode> selNode(do_QueryInterface(aNode));
nsCOMPtr<nsIDOMNode> selNode = aNode;
NS_ENSURE_STATE(mHTMLEditor);
res = nsWSRunObject::PrepareToSplitAcrossBlocks(mHTMLEditor, address_of(selNode), &aOffset);
NS_ENSURE_SUCCESS(res, res);
// now split list item
int32_t newOffset;
NS_ENSURE_STATE(mHTMLEditor);
res = mHTMLEditor->SplitNodeDeep(aListItem, GetAsDOMNode(selNode), aOffset, &newOffset, false);
res = mHTMLEditor->SplitNodeDeep( aListItem, selNode, aOffset, &newOffset, false);
NS_ENSURE_SUCCESS(res, res);
// hack: until I can change the damaged doc range code back to being
// extra inclusive, I have to manually detect certain list items that

View File

@ -171,16 +171,15 @@ nsWSRunObject::PrepareToDeleteNode(nsHTMLEditor* aHTMLEd,
return leftWSObj.PrepareToDeleteRangePriv(&rightWSObj);
}
nsresult
nsWSRunObject::PrepareToSplitAcrossBlocks(nsHTMLEditor* aHTMLEd,
nsCOMPtr<nsINode>* aSplitNode,
int32_t* aSplitOffset)
nsresult
nsWSRunObject::PrepareToSplitAcrossBlocks(nsHTMLEditor *aHTMLEd,
nsCOMPtr<nsIDOMNode> *aSplitNode,
int32_t *aSplitOffset)
{
NS_ENSURE_TRUE(aHTMLEd && aSplitNode && *aSplitNode && aSplitOffset,
NS_ERROR_NULL_POINTER);
NS_ENSURE_TRUE(aSplitNode && aSplitOffset && *aSplitNode && aHTMLEd, NS_ERROR_NULL_POINTER);
nsAutoTrackDOMPoint tracker(aHTMLEd->mRangeUpdater, aSplitNode, aSplitOffset);
nsWSRunObject wsObj(aHTMLEd, *aSplitNode, *aSplitOffset);
return wsObj.PrepareToSplitAcrossBlocksPriv();

View File

@ -192,14 +192,16 @@ class MOZ_STACK_CLASS nsWSRunObject
static nsresult PrepareToDeleteNode(nsHTMLEditor *aHTMLEd,
nsIContent* aContent);
// PrepareToSplitAcrossBlocks fixes up ws before and after
// {aSplitNode,aSplitOffset} in preparation for a block parent to be split.
// Note that the aSplitNode and aSplitOffset are adjusted in response to
// any DOM changes we make while adjusting ws. Example of fixup: normalws
// before {aSplitNode,aSplitOffset} needs to end with nbsp.
static nsresult PrepareToSplitAcrossBlocks(nsHTMLEditor* aHTMLEd,
nsCOMPtr<nsINode>* aSplitNode,
int32_t* aSplitOffset);
// PrepareToSplitAcrossBlocks fixes up ws before and after
// {aSplitNode,aSplitOffset} in preperation for a block
// parent to be split. Note that the aSplitNode and aSplitOffset
// are adjusted in response to any dom changes we make while
// adjusting ws.
// example of fixup: normalws before {aSplitNode,aSplitOffset}
// needs to end with nbsp.
static nsresult PrepareToSplitAcrossBlocks(nsHTMLEditor *aHTMLEd,
nsCOMPtr<nsIDOMNode> *aSplitNode,
int32_t *aSplitOffset);
// InsertBreak inserts a br node at {aInOutParent,aInOutOffset}
// and makes any needed adjustments to ws around that point.