From bc6cc23c4283372ea1049d5d54d3d3c970636fe2 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Tue, 13 Aug 2002 23:33:58 +0000 Subject: [PATCH] Fix crash bug 159359, patch by leon.zhang@sun.com, r=jkeiser, sr=bzbarsky --- layout/base/nsCSSFrameConstructor.cpp | 36 ++++++++++--------- .../html/style/src/nsCSSFrameConstructor.cpp | 36 ++++++++++--------- 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 73660b6221b7..2fc4b7bd2da3 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -2950,9 +2950,7 @@ nsCSSFrameConstructor::MustGeneratePseudoParent(nsIPresContext* aPresContext, } // exclude tags - // XXX Now that form does not have a special frame, can we remove this? - if ( (nsLayoutAtoms::commentTagName == aTag) || - (nsHTMLAtoms::form == aTag) ) { + if ( nsLayoutAtoms::commentTagName == aTag) { return PR_FALSE; } @@ -3184,21 +3182,25 @@ nsCSSFrameConstructor::TableProcessChild(nsIPresShell* aPresShell, default: { - nsCOMPtr tag; - aChildContent->GetTag(*getter_AddRefs(tag)); - // A form doesn't get a psuedo frame parent, but it needs a frame, so just use the current parent - // XXX now that form is a normal frame, do we need to do this? - if (tag == nsHTMLAtoms::form) { - nsFrameItems items; - rv = ConstructFrame(aPresShell, aPresContext, aState, aChildContent, - aParentFrame, items); - childFrame = items.childList; - } - else { - rv = ConstructTableForeignFrame(aPresShell, aPresContext, aState, aChildContent, - aParentFrame, childStyleContext, aTableCreator, - aChildItems, childFrame, isPseudoParent); + + // if
's parent is //// in html, + // NOT create psuedoframe for it. + // see bug 159359 + nsCOMPtr parentNodeInfo, childNodeInfo; + aParentContent->GetNodeInfo(*getter_AddRefs(parentNodeInfo)); + aChildContent->GetNodeInfo(*getter_AddRefs(childNodeInfo)); + if (childNodeInfo->Equals(nsHTMLAtoms::form, kNameSpaceID_None) && + (parentNodeInfo->Equals(nsHTMLAtoms::table, kNameSpaceID_None) || + parentNodeInfo->Equals(nsHTMLAtoms::tr, kNameSpaceID_None) || + parentNodeInfo->Equals(nsHTMLAtoms::tbody, kNameSpaceID_None) || + parentNodeInfo->Equals(nsHTMLAtoms::thead, kNameSpaceID_None) || + parentNodeInfo->Equals(nsHTMLAtoms::tfoot, kNameSpaceID_None))) { + break; } + + rv = ConstructTableForeignFrame(aPresShell, aPresContext, aState, aChildContent, + aParentFrame, childStyleContext, aTableCreator, + aChildItems, childFrame, isPseudoParent); } break; } diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp index 73660b6221b7..2fc4b7bd2da3 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -2950,9 +2950,7 @@ nsCSSFrameConstructor::MustGeneratePseudoParent(nsIPresContext* aPresContext, } // exclude tags - // XXX Now that form does not have a special frame, can we remove this? - if ( (nsLayoutAtoms::commentTagName == aTag) || - (nsHTMLAtoms::form == aTag) ) { + if ( nsLayoutAtoms::commentTagName == aTag) { return PR_FALSE; } @@ -3184,21 +3182,25 @@ nsCSSFrameConstructor::TableProcessChild(nsIPresShell* aPresShell, default: { - nsCOMPtr tag; - aChildContent->GetTag(*getter_AddRefs(tag)); - // A form doesn't get a psuedo frame parent, but it needs a frame, so just use the current parent - // XXX now that form is a normal frame, do we need to do this? - if (tag == nsHTMLAtoms::form) { - nsFrameItems items; - rv = ConstructFrame(aPresShell, aPresContext, aState, aChildContent, - aParentFrame, items); - childFrame = items.childList; - } - else { - rv = ConstructTableForeignFrame(aPresShell, aPresContext, aState, aChildContent, - aParentFrame, childStyleContext, aTableCreator, - aChildItems, childFrame, isPseudoParent); + + // if 's parent is /
/// in html, + // NOT create psuedoframe for it. + // see bug 159359 + nsCOMPtr parentNodeInfo, childNodeInfo; + aParentContent->GetNodeInfo(*getter_AddRefs(parentNodeInfo)); + aChildContent->GetNodeInfo(*getter_AddRefs(childNodeInfo)); + if (childNodeInfo->Equals(nsHTMLAtoms::form, kNameSpaceID_None) && + (parentNodeInfo->Equals(nsHTMLAtoms::table, kNameSpaceID_None) || + parentNodeInfo->Equals(nsHTMLAtoms::tr, kNameSpaceID_None) || + parentNodeInfo->Equals(nsHTMLAtoms::tbody, kNameSpaceID_None) || + parentNodeInfo->Equals(nsHTMLAtoms::thead, kNameSpaceID_None) || + parentNodeInfo->Equals(nsHTMLAtoms::tfoot, kNameSpaceID_None))) { + break; } + + rv = ConstructTableForeignFrame(aPresShell, aPresContext, aState, aChildContent, + aParentFrame, childStyleContext, aTableCreator, + aChildItems, childFrame, isPseudoParent); } break; }