diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index f7abb018cd52..fcabbfd3c199 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -912,21 +912,26 @@ nsresult nsCSSFrameConstructor::CreateInputFrame(nsIPresContext *aPresContext, nsIContent *aContent, nsIFrame *&aFrame, - nsIStyleContext *aStyleContext) + nsIStyleContext *aStyleContext, + PRBool &aIsButton) { nsresult rv; + aIsButton = PR_FALSE; // Figure out which type of input frame to create nsAutoString val; if (NS_OK == aContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::type, val)) { if (val.EqualsIgnoreCase("submit")) { rv = ConstructButtonControlFrame(aPresContext, aFrame); + aIsButton = PR_TRUE; } else if (val.EqualsIgnoreCase("reset")) { rv = ConstructButtonControlFrame(aPresContext, aFrame); + aIsButton = PR_TRUE; } else if (val.EqualsIgnoreCase("button")) { rv = ConstructButtonControlFrame(aPresContext, aFrame); + aIsButton = PR_TRUE; } else if (val.EqualsIgnoreCase("checkbox")) { rv = ConstructCheckboxControlFrame(aPresContext, aFrame); @@ -2730,6 +2735,23 @@ nsCSSFrameConstructor::ConstructButtonLabelFrame(nsIPresContext *aPresContext, return rv; } +nsresult +nsCSSFrameConstructor::ConstructButtonFrames(nsIPresContext *aPresContext, + nsIContent *aContent, + nsIFrame *&aFrame, + nsFrameConstructorState& aState, + nsFrameItems& aFrameItems) +{ + // Construct button label frame using generated content + // Get the first area frame to insert the button as a child. + nsIFrame* areaFrame = nsnull; + aFrame->FirstChild(nsnull, &areaFrame); + NS_ASSERTION(areaFrame != nsnull, "Button does not have an area frame"); + nsresult rv = ConstructButtonLabelFrame(aPresContext, aContent, areaFrame, aState, aFrameItems); + return rv; +} + + nsresult nsCSSFrameConstructor::ConstructButtonControlFrame(nsIPresContext* aPresContext, @@ -3090,6 +3112,7 @@ nsCSSFrameConstructor::ConstructFrameByTag(nsIPresContext* aPresContext PRBool isReplaced = PR_FALSE; PRBool addToHashTable = PR_TRUE; nsresult rv = NS_OK; + PRBool isButton = PR_FALSE; if (nsLayoutAtoms::textTagName == aTag) { rv = NS_NewTextFrame(&newFrame); @@ -3143,7 +3166,7 @@ nsCSSFrameConstructor::ConstructFrameByTag(nsIPresContext* aPresContext } else if (nsHTMLAtoms::input == aTag) { isReplaced = PR_TRUE; - rv = CreateInputFrame(aPresContext, aContent, newFrame, aStyleContext); + rv = CreateInputFrame(aPresContext, aContent, newFrame, aStyleContext, isButton); } else if (nsHTMLAtoms::textarea == aTag) { isReplaced = PR_TRUE; @@ -3249,11 +3272,16 @@ nsCSSFrameConstructor::ConstructFrameByTag(nsIPresContext* aPresContext PR_TRUE, childItems, PR_FALSE); } - if (nsHTMLAtoms::input == aTag) { - // Construct button label frame using generated content - ConstructButtonLabelFrame(aPresContext, aContent, newFrame, aState, childItems); - } - + // Create button label frames. + // This must be done after the Init so + // the button label frames get the proper + // parent style context. + // XXX: Need to reorganize nsCSSFrameConstructor + // so we don't have to special case buttons here. + if (isButton) { + rv = ConstructButtonFrames(aPresContext, aContent, newFrame, aState, childItems); + } + // if there are any anonymous children create frames for them CreateAnonymousFrames(aPresContext, aTag, aState, aContent, newFrame, childItems); diff --git a/layout/base/nsCSSFrameConstructor.h b/layout/base/nsCSSFrameConstructor.h index f2113422413e..dd063138aeb9 100644 --- a/layout/base/nsCSSFrameConstructor.h +++ b/layout/base/nsCSSFrameConstructor.h @@ -428,6 +428,11 @@ protected: nsIFrame *&aFrame, nsFrameConstructorState& aState, nsFrameItems& aFrameItems); + nsresult ConstructButtonFrames(nsIPresContext *aPresContext, + nsIContent *aContent, + nsIFrame *&aFrame, + nsFrameConstructorState& aState, + nsFrameItems& aFrameItems); nsresult ConstructButtonControlFrame(nsIPresContext* aPresContext, nsIFrame*& aNewFrame); @@ -527,7 +532,8 @@ protected: nsresult CreateInputFrame(nsIPresContext *aPresContext, nsIContent *aContent, nsIFrame *&aFrame, - nsIStyleContext *aStyleContext); + nsIStyleContext *aStyleContext, + PRBool &aIsButton); nsresult RemoveDummyFrameFromSelect(nsIPresContext* aPresContext, nsIPresShell * aPresShell, diff --git a/layout/forms/nsButtonFrameRenderer.cpp b/layout/forms/nsButtonFrameRenderer.cpp index 763ea84e9af1..dacaa07e262e 100644 --- a/layout/forms/nsButtonFrameRenderer.cpp +++ b/layout/forms/nsButtonFrameRenderer.cpp @@ -162,29 +162,6 @@ nsButtonFrameRenderer::PaintOutlineAndFocusBorders(nsIPresContext& aPresContext, } } - if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) - { - /* - if (mOutlineStyle) { - - GetButtonOutlineRect(aRect, rect); - - mOutlineRect = rect; - - const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOutlineStyle ->GetStyleData(eStyleStruct_Spacing); - - // set the clipping area so we can draw outside our bounds. - aRenderingContext.PushState(); - PRBool clipEmpty; - - aRenderingContext.SetClipRect(rect, nsClipCombine_kReplace, clipEmpty); - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame, - aDirtyRect, rect, *spacing, mOutlineStyle, 0); - - aRenderingContext.PopState(clipEmpty); - } - */ - } } @@ -331,15 +308,6 @@ nsMargin nsButtonFrameRenderer::GetButtonOutlineBorderAndPadding() { nsMargin borderAndPadding(0,0,0,0); - - if (mOutlineStyle) { - // get the outline border and padding - const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOutlineStyle ->GetStyleData(eStyleStruct_Spacing); - if (!spacing->GetBorderPadding(borderAndPadding)) { - NS_NOTYETIMPLEMENTED("percentage border"); - } - } - return borderAndPadding; } @@ -370,14 +338,9 @@ nsButtonFrameRenderer::ReResolveStyles(nsIPresContext& aPresContext) nsCOMPtr context; mFrame->GetStyleContext(getter_AddRefs(context)); - // style that draw an outline around the button - nsCOMPtr atom ( getter_AddRefs(NS_NewAtom(":-moz-outline")) ); - aPresContext.ProbePseudoStyleContextFor(content, atom, context, - PR_FALSE, - getter_AddRefs(mOutlineStyle)); // style for the inner such as a dotted line (Windows) - atom = getter_AddRefs(NS_NewAtom(":-moz-focus-inner")); + nsCOMPtr atom = getter_AddRefs(NS_NewAtom(":-moz-focus-inner")); aPresContext.ProbePseudoStyleContextFor(content, atom, context, PR_FALSE, getter_AddRefs(mInnerFocusStyle)); @@ -399,10 +362,7 @@ nsButtonFrameRenderer::GetStyleContext(PRInt32 aIndex, nsIStyleContext** aStyleC } *aStyleContext = nsnull; switch (aIndex) { - case NS_BUTTON_RENDERER_OUTLINE_CONTEXT_INDEX: - *aStyleContext = mOutlineStyle; - NS_IF_ADDREF(*aStyleContext); - break; + case NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX: *aStyleContext = mInnerFocusStyle; NS_IF_ADDREF(*aStyleContext); @@ -424,9 +384,7 @@ nsButtonFrameRenderer::SetStyleContext(PRInt32 aIndex, nsIStyleContext* aStyleCo return NS_ERROR_INVALID_ARG; } switch (aIndex) { - case NS_BUTTON_RENDERER_OUTLINE_CONTEXT_INDEX: - mOutlineStyle = aStyleContext; - break; + case NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX: mInnerFocusStyle = aStyleContext; break; diff --git a/layout/forms/nsButtonFrameRenderer.h b/layout/forms/nsButtonFrameRenderer.h index 47805980bf32..8f7e5de3c2ce 100644 --- a/layout/forms/nsButtonFrameRenderer.h +++ b/layout/forms/nsButtonFrameRenderer.h @@ -35,9 +35,9 @@ class nsStyleChangeList; -#define NS_BUTTON_RENDERER_OUTLINE_CONTEXT_INDEX 0 -#define NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX 1 -#define NS_BUTTON_RENDERER_FOCUS_OUTER_CONTEXT_INDEX 2 + +#define NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX 0 +#define NS_BUTTON_RENDERER_FOCUS_OUTER_CONTEXT_INDEX 1 #define NS_BUTTON_RENDERER_LAST_CONTEXT_INDEX NS_BUTTON_RENDERER_FOCUS_OUTER_CONTEXT_INDEX class nsButtonFrameRenderer { @@ -103,7 +103,6 @@ private: nsCOMPtr mBorderStyle; nsCOMPtr mInnerFocusStyle; nsCOMPtr mOuterFocusStyle; - nsCOMPtr mOutlineStyle; PRInt32 mNameSpace; nsFrame* mFrame; diff --git a/layout/forms/nsHTMLButtonControlFrame.cpp b/layout/forms/nsHTMLButtonControlFrame.cpp index 1747141d369c..c1b97cc7d9b0 100644 --- a/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/layout/forms/nsHTMLButtonControlFrame.cpp @@ -101,6 +101,27 @@ nsHTMLButtonControlFrame::Init(nsIPresContext& aPresContext, { nsresult rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow); mRenderer.SetFrame(this,aPresContext); + // cache our display type + const nsStyleDisplay* styleDisplay; + GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) styleDisplay); + mInline = (NS_STYLE_DISPLAY_BLOCK != styleDisplay->mDisplay); + + PRUint32 flags = NS_BLOCK_SPACE_MGR; + if (mInline) { + flags |= NS_BLOCK_SHRINK_WRAP; + } + nsIFrame* areaFrame; + NS_NewAreaFrame(&areaFrame, flags); + mFrames.SetFrames(areaFrame); + + // Resolve style and initialize the frame + nsIStyleContext* styleContext; + aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::buttonContentPseudo, + mStyleContext, PR_FALSE, + &styleContext); + mFrames.FirstChild()->Init(aPresContext, mContent, this, styleContext, nsnull); + NS_RELEASE(styleContext); + return rv; } @@ -382,27 +403,7 @@ nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext& aPresContext, // add ourself as an nsIFormControlFrame nsFormFrame::AddFormControlFrame(aPresContext, *this); - // cache our display type - const nsStyleDisplay* styleDisplay; - GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) styleDisplay); - mInline = (NS_STYLE_DISPLAY_BLOCK != styleDisplay->mDisplay); - - PRUint32 flags = NS_BLOCK_SPACE_MGR; - if (mInline) { - flags |= NS_BLOCK_SHRINK_WRAP; - } - nsIFrame* areaFrame; - NS_NewAreaFrame(&areaFrame, flags); - mFrames.SetFrames(areaFrame); - - // Resolve style and initialize the frame - nsIStyleContext* styleContext; - aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::buttonContentPseudo, - mStyleContext, PR_FALSE, - &styleContext); - mFrames.FirstChild()->Init(aPresContext, mContent, this, styleContext, nsnull); - NS_RELEASE(styleContext); - + // Set the parent for each of the child frames for (nsIFrame* frame = aChildList; nsnull != frame; frame->GetNextSibling(&frame)) { frame->SetParent(mFrames.FirstChild()); diff --git a/layout/html/forms/src/nsButtonFrameRenderer.cpp b/layout/html/forms/src/nsButtonFrameRenderer.cpp index 763ea84e9af1..dacaa07e262e 100644 --- a/layout/html/forms/src/nsButtonFrameRenderer.cpp +++ b/layout/html/forms/src/nsButtonFrameRenderer.cpp @@ -162,29 +162,6 @@ nsButtonFrameRenderer::PaintOutlineAndFocusBorders(nsIPresContext& aPresContext, } } - if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) - { - /* - if (mOutlineStyle) { - - GetButtonOutlineRect(aRect, rect); - - mOutlineRect = rect; - - const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOutlineStyle ->GetStyleData(eStyleStruct_Spacing); - - // set the clipping area so we can draw outside our bounds. - aRenderingContext.PushState(); - PRBool clipEmpty; - - aRenderingContext.SetClipRect(rect, nsClipCombine_kReplace, clipEmpty); - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame, - aDirtyRect, rect, *spacing, mOutlineStyle, 0); - - aRenderingContext.PopState(clipEmpty); - } - */ - } } @@ -331,15 +308,6 @@ nsMargin nsButtonFrameRenderer::GetButtonOutlineBorderAndPadding() { nsMargin borderAndPadding(0,0,0,0); - - if (mOutlineStyle) { - // get the outline border and padding - const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOutlineStyle ->GetStyleData(eStyleStruct_Spacing); - if (!spacing->GetBorderPadding(borderAndPadding)) { - NS_NOTYETIMPLEMENTED("percentage border"); - } - } - return borderAndPadding; } @@ -370,14 +338,9 @@ nsButtonFrameRenderer::ReResolveStyles(nsIPresContext& aPresContext) nsCOMPtr context; mFrame->GetStyleContext(getter_AddRefs(context)); - // style that draw an outline around the button - nsCOMPtr atom ( getter_AddRefs(NS_NewAtom(":-moz-outline")) ); - aPresContext.ProbePseudoStyleContextFor(content, atom, context, - PR_FALSE, - getter_AddRefs(mOutlineStyle)); // style for the inner such as a dotted line (Windows) - atom = getter_AddRefs(NS_NewAtom(":-moz-focus-inner")); + nsCOMPtr atom = getter_AddRefs(NS_NewAtom(":-moz-focus-inner")); aPresContext.ProbePseudoStyleContextFor(content, atom, context, PR_FALSE, getter_AddRefs(mInnerFocusStyle)); @@ -399,10 +362,7 @@ nsButtonFrameRenderer::GetStyleContext(PRInt32 aIndex, nsIStyleContext** aStyleC } *aStyleContext = nsnull; switch (aIndex) { - case NS_BUTTON_RENDERER_OUTLINE_CONTEXT_INDEX: - *aStyleContext = mOutlineStyle; - NS_IF_ADDREF(*aStyleContext); - break; + case NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX: *aStyleContext = mInnerFocusStyle; NS_IF_ADDREF(*aStyleContext); @@ -424,9 +384,7 @@ nsButtonFrameRenderer::SetStyleContext(PRInt32 aIndex, nsIStyleContext* aStyleCo return NS_ERROR_INVALID_ARG; } switch (aIndex) { - case NS_BUTTON_RENDERER_OUTLINE_CONTEXT_INDEX: - mOutlineStyle = aStyleContext; - break; + case NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX: mInnerFocusStyle = aStyleContext; break; diff --git a/layout/html/forms/src/nsButtonFrameRenderer.h b/layout/html/forms/src/nsButtonFrameRenderer.h index 47805980bf32..8f7e5de3c2ce 100644 --- a/layout/html/forms/src/nsButtonFrameRenderer.h +++ b/layout/html/forms/src/nsButtonFrameRenderer.h @@ -35,9 +35,9 @@ class nsStyleChangeList; -#define NS_BUTTON_RENDERER_OUTLINE_CONTEXT_INDEX 0 -#define NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX 1 -#define NS_BUTTON_RENDERER_FOCUS_OUTER_CONTEXT_INDEX 2 + +#define NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX 0 +#define NS_BUTTON_RENDERER_FOCUS_OUTER_CONTEXT_INDEX 1 #define NS_BUTTON_RENDERER_LAST_CONTEXT_INDEX NS_BUTTON_RENDERER_FOCUS_OUTER_CONTEXT_INDEX class nsButtonFrameRenderer { @@ -103,7 +103,6 @@ private: nsCOMPtr mBorderStyle; nsCOMPtr mInnerFocusStyle; nsCOMPtr mOuterFocusStyle; - nsCOMPtr mOutlineStyle; PRInt32 mNameSpace; nsFrame* mFrame; diff --git a/layout/html/forms/src/nsHTMLButtonControlFrame.cpp b/layout/html/forms/src/nsHTMLButtonControlFrame.cpp index 1747141d369c..c1b97cc7d9b0 100644 --- a/layout/html/forms/src/nsHTMLButtonControlFrame.cpp +++ b/layout/html/forms/src/nsHTMLButtonControlFrame.cpp @@ -101,6 +101,27 @@ nsHTMLButtonControlFrame::Init(nsIPresContext& aPresContext, { nsresult rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow); mRenderer.SetFrame(this,aPresContext); + // cache our display type + const nsStyleDisplay* styleDisplay; + GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) styleDisplay); + mInline = (NS_STYLE_DISPLAY_BLOCK != styleDisplay->mDisplay); + + PRUint32 flags = NS_BLOCK_SPACE_MGR; + if (mInline) { + flags |= NS_BLOCK_SHRINK_WRAP; + } + nsIFrame* areaFrame; + NS_NewAreaFrame(&areaFrame, flags); + mFrames.SetFrames(areaFrame); + + // Resolve style and initialize the frame + nsIStyleContext* styleContext; + aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::buttonContentPseudo, + mStyleContext, PR_FALSE, + &styleContext); + mFrames.FirstChild()->Init(aPresContext, mContent, this, styleContext, nsnull); + NS_RELEASE(styleContext); + return rv; } @@ -382,27 +403,7 @@ nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext& aPresContext, // add ourself as an nsIFormControlFrame nsFormFrame::AddFormControlFrame(aPresContext, *this); - // cache our display type - const nsStyleDisplay* styleDisplay; - GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) styleDisplay); - mInline = (NS_STYLE_DISPLAY_BLOCK != styleDisplay->mDisplay); - - PRUint32 flags = NS_BLOCK_SPACE_MGR; - if (mInline) { - flags |= NS_BLOCK_SHRINK_WRAP; - } - nsIFrame* areaFrame; - NS_NewAreaFrame(&areaFrame, flags); - mFrames.SetFrames(areaFrame); - - // Resolve style and initialize the frame - nsIStyleContext* styleContext; - aPresContext.ResolvePseudoStyleContextFor(mContent, nsHTMLAtoms::buttonContentPseudo, - mStyleContext, PR_FALSE, - &styleContext); - mFrames.FirstChild()->Init(aPresContext, mContent, this, styleContext, nsnull); - NS_RELEASE(styleContext); - + // Set the parent for each of the child frames for (nsIFrame* frame = aChildList; nsnull != frame; frame->GetNextSibling(&frame)) { frame->SetParent(mFrames.FirstChild()); diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp index f7abb018cd52..fcabbfd3c199 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -912,21 +912,26 @@ nsresult nsCSSFrameConstructor::CreateInputFrame(nsIPresContext *aPresContext, nsIContent *aContent, nsIFrame *&aFrame, - nsIStyleContext *aStyleContext) + nsIStyleContext *aStyleContext, + PRBool &aIsButton) { nsresult rv; + aIsButton = PR_FALSE; // Figure out which type of input frame to create nsAutoString val; if (NS_OK == aContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::type, val)) { if (val.EqualsIgnoreCase("submit")) { rv = ConstructButtonControlFrame(aPresContext, aFrame); + aIsButton = PR_TRUE; } else if (val.EqualsIgnoreCase("reset")) { rv = ConstructButtonControlFrame(aPresContext, aFrame); + aIsButton = PR_TRUE; } else if (val.EqualsIgnoreCase("button")) { rv = ConstructButtonControlFrame(aPresContext, aFrame); + aIsButton = PR_TRUE; } else if (val.EqualsIgnoreCase("checkbox")) { rv = ConstructCheckboxControlFrame(aPresContext, aFrame); @@ -2730,6 +2735,23 @@ nsCSSFrameConstructor::ConstructButtonLabelFrame(nsIPresContext *aPresContext, return rv; } +nsresult +nsCSSFrameConstructor::ConstructButtonFrames(nsIPresContext *aPresContext, + nsIContent *aContent, + nsIFrame *&aFrame, + nsFrameConstructorState& aState, + nsFrameItems& aFrameItems) +{ + // Construct button label frame using generated content + // Get the first area frame to insert the button as a child. + nsIFrame* areaFrame = nsnull; + aFrame->FirstChild(nsnull, &areaFrame); + NS_ASSERTION(areaFrame != nsnull, "Button does not have an area frame"); + nsresult rv = ConstructButtonLabelFrame(aPresContext, aContent, areaFrame, aState, aFrameItems); + return rv; +} + + nsresult nsCSSFrameConstructor::ConstructButtonControlFrame(nsIPresContext* aPresContext, @@ -3090,6 +3112,7 @@ nsCSSFrameConstructor::ConstructFrameByTag(nsIPresContext* aPresContext PRBool isReplaced = PR_FALSE; PRBool addToHashTable = PR_TRUE; nsresult rv = NS_OK; + PRBool isButton = PR_FALSE; if (nsLayoutAtoms::textTagName == aTag) { rv = NS_NewTextFrame(&newFrame); @@ -3143,7 +3166,7 @@ nsCSSFrameConstructor::ConstructFrameByTag(nsIPresContext* aPresContext } else if (nsHTMLAtoms::input == aTag) { isReplaced = PR_TRUE; - rv = CreateInputFrame(aPresContext, aContent, newFrame, aStyleContext); + rv = CreateInputFrame(aPresContext, aContent, newFrame, aStyleContext, isButton); } else if (nsHTMLAtoms::textarea == aTag) { isReplaced = PR_TRUE; @@ -3249,11 +3272,16 @@ nsCSSFrameConstructor::ConstructFrameByTag(nsIPresContext* aPresContext PR_TRUE, childItems, PR_FALSE); } - if (nsHTMLAtoms::input == aTag) { - // Construct button label frame using generated content - ConstructButtonLabelFrame(aPresContext, aContent, newFrame, aState, childItems); - } - + // Create button label frames. + // This must be done after the Init so + // the button label frames get the proper + // parent style context. + // XXX: Need to reorganize nsCSSFrameConstructor + // so we don't have to special case buttons here. + if (isButton) { + rv = ConstructButtonFrames(aPresContext, aContent, newFrame, aState, childItems); + } + // if there are any anonymous children create frames for them CreateAnonymousFrames(aPresContext, aTag, aState, aContent, newFrame, childItems); diff --git a/layout/html/style/src/nsCSSFrameConstructor.h b/layout/html/style/src/nsCSSFrameConstructor.h index f2113422413e..dd063138aeb9 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.h +++ b/layout/html/style/src/nsCSSFrameConstructor.h @@ -428,6 +428,11 @@ protected: nsIFrame *&aFrame, nsFrameConstructorState& aState, nsFrameItems& aFrameItems); + nsresult ConstructButtonFrames(nsIPresContext *aPresContext, + nsIContent *aContent, + nsIFrame *&aFrame, + nsFrameConstructorState& aState, + nsFrameItems& aFrameItems); nsresult ConstructButtonControlFrame(nsIPresContext* aPresContext, nsIFrame*& aNewFrame); @@ -527,7 +532,8 @@ protected: nsresult CreateInputFrame(nsIPresContext *aPresContext, nsIContent *aContent, nsIFrame *&aFrame, - nsIStyleContext *aStyleContext); + nsIStyleContext *aStyleContext, + PRBool &aIsButton); nsresult RemoveDummyFrameFromSelect(nsIPresContext* aPresContext, nsIPresShell * aPresShell,