From 715dea1240f29625b84a61b634826bc9333da103 Mon Sep 17 00:00:00 2001 From: "bmlk%gmx.de" Date: Sun, 15 Jan 2006 19:10:14 +0000 Subject: [PATCH] don't call ProcessChildren on leafframes, bug 51767, r/sr=bzbarsky --- layout/base/nsCSSFrameConstructor.cpp | 53 +++++++++++++++------------ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index a2f187389c61..430a7197cbaf 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -5137,33 +5137,38 @@ nsCSSFrameConstructor::ConstructButtonFrame(nsFrameConstructorState& aState, buttonFrame->Destroy(aState.mPresContext); return rv; } - // The area frame is a float container - PRBool haveFirstLetterStyle, haveFirstLineStyle; - HaveSpecialBlockStyle(aContent, aStyleContext, - &haveFirstLetterStyle, &haveFirstLineStyle); - nsFrameConstructorSaveState floatSaveState; - aState.PushFloatContainingBlock(areaFrame, floatSaveState, - haveFirstLetterStyle, - haveFirstLineStyle); - // Process children - nsFrameConstructorSaveState absoluteSaveState; - nsFrameItems childItems; + + if (!buttonFrame->IsLeaf()) { + // input type="button" have only anonymous content + // The area frame is a float container + PRBool haveFirstLetterStyle, haveFirstLineStyle; + HaveSpecialBlockStyle(aContent, aStyleContext, + &haveFirstLetterStyle, &haveFirstLineStyle); + nsFrameConstructorSaveState floatSaveState; + aState.PushFloatContainingBlock(areaFrame, floatSaveState, + haveFirstLetterStyle, + haveFirstLineStyle); - if (aStyleDisplay->IsPositioned()) { - // The area frame becomes a container for child frames that are - // absolutely positioned - aState.PushAbsoluteContainingBlock(areaFrame, absoluteSaveState); + // Process children + nsFrameConstructorSaveState absoluteSaveState; + nsFrameItems childItems; + + if (aStyleDisplay->IsPositioned()) { + // The area frame becomes a container for child frames that are + // absolutely positioned + aState.PushAbsoluteContainingBlock(areaFrame, absoluteSaveState); + } + + rv = ProcessChildren(aState, aContent, areaFrame, PR_TRUE, childItems, + buttonFrame->GetStyleDisplay()->IsBlockLevel()); + if (NS_FAILED(rv)) return rv; + + // Set the areas frame's initial child lists + areaFrame->SetInitialChildList(aState.mPresContext, nsnull, + childItems.childList); } - rv = ProcessChildren(aState, aContent, areaFrame, PR_TRUE, childItems, - buttonFrame->GetStyleDisplay()->IsBlockLevel()); - if (NS_FAILED(rv)) return rv; - - // Set the scrolled frame's initial child lists - areaFrame->SetInitialChildList(aState.mPresContext, nsnull, - childItems.childList); - buttonFrame->SetInitialChildList(aState.mPresContext, nsnull, areaFrame); nsFrameItems anonymousChildItems; @@ -5171,7 +5176,7 @@ nsCSSFrameConstructor::ConstructButtonFrame(nsFrameConstructorState& aState, CreateAnonymousFrames(aTag, aState, aContent, buttonFrame, PR_FALSE, anonymousChildItems); if (anonymousChildItems.childList) { - // the anonmyous content is allready parented to the area frame + // the anonymous content is already parented to the area frame aState.mFrameManager->AppendFrames(areaFrame, nsnull, anonymousChildItems.childList); }