bug 8287; rvd sfraser; aprvd buster; aprvd chofmann

This commit is contained in:
jfrancis%netscape.com 1999-06-16 21:38:51 +00:00
Родитель 657c148e9e
Коммит 39fd84cbfe
6 изменённых файлов: 22 добавлений и 18 удалений

Просмотреть файл

@ -2000,11 +2000,11 @@ nsGenericContainerElement::ReplaceChildAt(nsIContent* aKid,
{
NS_PRECONDITION(nsnull != aKid, "null ptr");
nsIContent* oldKid = (nsIContent *)mChildren.ElementAt(aIndex);
nsRange::OwnerChildReplaced(mContent, aIndex, oldKid);
PRBool rv = mChildren.ReplaceElementAt(aKid, aIndex);
if (rv) {
NS_ADDREF(aKid);
aKid->SetParent(mContent);
nsRange::OwnerChildReplaced(mContent, aIndex, oldKid);
nsIDocument* doc = mDocument;
if (nsnull != doc) {
aKid->SetDocument(doc, PR_FALSE);
@ -2045,8 +2045,8 @@ nsGenericContainerElement::RemoveChildAt(PRInt32 aIndex, PRBool aNotify)
nsIContent* oldKid = (nsIContent *)mChildren.ElementAt(aIndex);
if (nsnull != oldKid ) {
nsIDocument* doc = mDocument;
mChildren.RemoveElementAt(aIndex);
nsRange::OwnerChildRemoved(mContent, aIndex, oldKid);
mChildren.RemoveElementAt(aIndex);
if (aNotify) {
if (nsnull != doc) {
doc->ContentRemoved(mContent, oldKid, aIndex);

Просмотреть файл

@ -788,21 +788,23 @@ nsresult nsRange::PopRanges(nsCOMPtr<nsIDOMNode> aDestNode, PRInt32 aOffset, nsC
{
nsCOMPtr<nsIDOMNode> domNode;
res = GetDOMNodeFromContent(cN, &domNode);
NS_PRECONDITION(NS_SUCCEEDED(res), "error updating range list");
NS_PRECONDITION(domNode, "error updating range list");
NS_POSTCONDITION(NS_SUCCEEDED(res), "error updating range list");
NS_POSTCONDITION(domNode, "error updating range list");
// sanity check - do range and content agree over ownership?
res = theRange->ContentOwnsUs(domNode);
NS_PRECONDITION(NS_SUCCEEDED(res), "range and content disagree over range ownership");
NS_POSTCONDITION(NS_SUCCEEDED(res), "range and content disagree over range ownership");
if (theRange->mStartParent == domNode)
{
// promote start point up to replacement point
theRange->SetStart(aDestNode, aOffset);
res = theRange->SetStart(aDestNode, aOffset);
NS_POSTCONDITION(NS_SUCCEEDED(res), "nsRange::PopRanges() got error from SetStart()");
}
if (theRange->mEndParent == domNode)
{
// promote end point up to replacement point
theRange->SetEnd(aDestNode, aOffset);
res = theRange->SetEnd(aDestNode, aOffset);
NS_POSTCONDITION(NS_SUCCEEDED(res), "nsRange::PopRanges() got error from SetEnd()");
}
}
// must refresh theRangeList - it might have gone away!

Просмотреть файл

@ -2627,11 +2627,11 @@ nsGenericHTMLContainerElement::ReplaceChildAt(nsIContent* aKid,
{
NS_PRECONDITION(nsnull != aKid, "null ptr");
nsIContent* oldKid = (nsIContent *)mChildren.ElementAt(aIndex);
nsRange::OwnerChildReplaced(mContent, aIndex, oldKid);
PRBool rv = mChildren.ReplaceElementAt(aKid, aIndex);
if (rv) {
NS_ADDREF(aKid);
aKid->SetParent(mContent);
nsRange::OwnerChildReplaced(mContent, aIndex, oldKid);
nsIDocument* doc = mDocument;
if (nsnull != doc) {
aKid->SetDocument(doc, PR_FALSE);
@ -2672,8 +2672,8 @@ nsGenericHTMLContainerElement::RemoveChildAt(PRInt32 aIndex, PRBool aNotify)
nsIContent* oldKid = (nsIContent *)mChildren.ElementAt(aIndex);
if (nsnull != oldKid ) {
nsIDocument* doc = mDocument;
mChildren.RemoveElementAt(aIndex);
nsRange::OwnerChildRemoved(mContent, aIndex, oldKid);
mChildren.RemoveElementAt(aIndex);
if (aNotify) {
if (nsnull != doc) {
doc->ContentRemoved(mContent, oldKid, aIndex);

Просмотреть файл

@ -2000,11 +2000,11 @@ nsGenericContainerElement::ReplaceChildAt(nsIContent* aKid,
{
NS_PRECONDITION(nsnull != aKid, "null ptr");
nsIContent* oldKid = (nsIContent *)mChildren.ElementAt(aIndex);
nsRange::OwnerChildReplaced(mContent, aIndex, oldKid);
PRBool rv = mChildren.ReplaceElementAt(aKid, aIndex);
if (rv) {
NS_ADDREF(aKid);
aKid->SetParent(mContent);
nsRange::OwnerChildReplaced(mContent, aIndex, oldKid);
nsIDocument* doc = mDocument;
if (nsnull != doc) {
aKid->SetDocument(doc, PR_FALSE);
@ -2045,8 +2045,8 @@ nsGenericContainerElement::RemoveChildAt(PRInt32 aIndex, PRBool aNotify)
nsIContent* oldKid = (nsIContent *)mChildren.ElementAt(aIndex);
if (nsnull != oldKid ) {
nsIDocument* doc = mDocument;
mChildren.RemoveElementAt(aIndex);
nsRange::OwnerChildRemoved(mContent, aIndex, oldKid);
mChildren.RemoveElementAt(aIndex);
if (aNotify) {
if (nsnull != doc) {
doc->ContentRemoved(mContent, oldKid, aIndex);

Просмотреть файл

@ -788,21 +788,23 @@ nsresult nsRange::PopRanges(nsCOMPtr<nsIDOMNode> aDestNode, PRInt32 aOffset, nsC
{
nsCOMPtr<nsIDOMNode> domNode;
res = GetDOMNodeFromContent(cN, &domNode);
NS_PRECONDITION(NS_SUCCEEDED(res), "error updating range list");
NS_PRECONDITION(domNode, "error updating range list");
NS_POSTCONDITION(NS_SUCCEEDED(res), "error updating range list");
NS_POSTCONDITION(domNode, "error updating range list");
// sanity check - do range and content agree over ownership?
res = theRange->ContentOwnsUs(domNode);
NS_PRECONDITION(NS_SUCCEEDED(res), "range and content disagree over range ownership");
NS_POSTCONDITION(NS_SUCCEEDED(res), "range and content disagree over range ownership");
if (theRange->mStartParent == domNode)
{
// promote start point up to replacement point
theRange->SetStart(aDestNode, aOffset);
res = theRange->SetStart(aDestNode, aOffset);
NS_POSTCONDITION(NS_SUCCEEDED(res), "nsRange::PopRanges() got error from SetStart()");
}
if (theRange->mEndParent == domNode)
{
// promote end point up to replacement point
theRange->SetEnd(aDestNode, aOffset);
res = theRange->SetEnd(aDestNode, aOffset);
NS_POSTCONDITION(NS_SUCCEEDED(res), "nsRange::PopRanges() got error from SetEnd()");
}
}
// must refresh theRangeList - it might have gone away!

Просмотреть файл

@ -2627,11 +2627,11 @@ nsGenericHTMLContainerElement::ReplaceChildAt(nsIContent* aKid,
{
NS_PRECONDITION(nsnull != aKid, "null ptr");
nsIContent* oldKid = (nsIContent *)mChildren.ElementAt(aIndex);
nsRange::OwnerChildReplaced(mContent, aIndex, oldKid);
PRBool rv = mChildren.ReplaceElementAt(aKid, aIndex);
if (rv) {
NS_ADDREF(aKid);
aKid->SetParent(mContent);
nsRange::OwnerChildReplaced(mContent, aIndex, oldKid);
nsIDocument* doc = mDocument;
if (nsnull != doc) {
aKid->SetDocument(doc, PR_FALSE);
@ -2672,8 +2672,8 @@ nsGenericHTMLContainerElement::RemoveChildAt(PRInt32 aIndex, PRBool aNotify)
nsIContent* oldKid = (nsIContent *)mChildren.ElementAt(aIndex);
if (nsnull != oldKid ) {
nsIDocument* doc = mDocument;
mChildren.RemoveElementAt(aIndex);
nsRange::OwnerChildRemoved(mContent, aIndex, oldKid);
mChildren.RemoveElementAt(aIndex);
if (aNotify) {
if (nsnull != doc) {
doc->ContentRemoved(mContent, oldKid, aIndex);