diff --git a/mozilla/layout/forms/nsGfxButtonControlFrame.cpp b/mozilla/layout/forms/nsGfxButtonControlFrame.cpp index d8286416854..92be9978aad 100644 --- a/mozilla/layout/forms/nsGfxButtonControlFrame.cpp +++ b/mozilla/layout/forms/nsGfxButtonControlFrame.cpp @@ -158,6 +158,20 @@ nsGfxButtonControlFrame::GetFrameName(nsString& aResult) const +NS_IMETHODIMP +nsGfxButtonControlFrame::AddComputedBorderPaddingToDesiredSize(nsHTMLReflowMetrics& aDesiredSize, + const nsHTMLReflowState& aSuggestedReflowState) +{ + if (kSuggestedNotSet == mSuggestedWidth) { + aDesiredSize.width += aSuggestedReflowState.mComputedBorderPadding.left + aSuggestedReflowState.mComputedBorderPadding.right; + } + + if (kSuggestedNotSet == mSuggestedHeight) { + aDesiredSize.height += aSuggestedReflowState.mComputedBorderPadding.top + aSuggestedReflowState.mComputedBorderPadding.bottom; + } + return NS_OK; +} + NS_IMETHODIMP nsGfxButtonControlFrame::Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -169,25 +183,22 @@ nsGfxButtonControlFrame::Reflow(nsIPresContext& aPresContext, } if ((kSuggestedNotSet != mSuggestedWidth) || - (kSuggestedNotSet != mSuggestedHeight)) - { + (kSuggestedNotSet != mSuggestedHeight)) { + nsHTMLReflowState suggestedReflowState(aReflowState); - + // Honor the suggested width and/or height. if (kSuggestedNotSet != mSuggestedWidth) { suggestedReflowState.mComputedWidth = mSuggestedWidth; - suggestedReflowState.mComputedWidth -= aReflowState.mComputedBorderPadding.left + aReflowState.mComputedBorderPadding.right; } if (kSuggestedNotSet != mSuggestedHeight) { suggestedReflowState.mComputedHeight = mSuggestedHeight; - suggestedReflowState.mComputedHeight -= aReflowState.mComputedBorderPadding.top + aReflowState.mComputedBorderPadding.bottom; } return nsHTMLButtonControlFrame::Reflow(aPresContext, aDesiredSize, suggestedReflowState, aStatus); - } else { - // Normal reflow. + } else { // Normal reflow. return nsHTMLButtonControlFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus); } } diff --git a/mozilla/layout/forms/nsGfxButtonControlFrame.h b/mozilla/layout/forms/nsGfxButtonControlFrame.h index 658cec1612a..550f1e9b07c 100644 --- a/mozilla/layout/forms/nsGfxButtonControlFrame.h +++ b/mozilla/layout/forms/nsGfxButtonControlFrame.h @@ -53,6 +53,9 @@ public: nsString* aValues, nsString* aNames); virtual void MouseClicked(nsIPresContext* aPresContext); +protected: + NS_IMETHOD AddComputedBorderPaddingToDesiredSize(nsHTMLReflowMetrics& aDesiredSize, + const nsHTMLReflowState& aSuggestedReflowState); private: NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; } NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; } diff --git a/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp index d8286416854..92be9978aad 100644 --- a/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp @@ -158,6 +158,20 @@ nsGfxButtonControlFrame::GetFrameName(nsString& aResult) const +NS_IMETHODIMP +nsGfxButtonControlFrame::AddComputedBorderPaddingToDesiredSize(nsHTMLReflowMetrics& aDesiredSize, + const nsHTMLReflowState& aSuggestedReflowState) +{ + if (kSuggestedNotSet == mSuggestedWidth) { + aDesiredSize.width += aSuggestedReflowState.mComputedBorderPadding.left + aSuggestedReflowState.mComputedBorderPadding.right; + } + + if (kSuggestedNotSet == mSuggestedHeight) { + aDesiredSize.height += aSuggestedReflowState.mComputedBorderPadding.top + aSuggestedReflowState.mComputedBorderPadding.bottom; + } + return NS_OK; +} + NS_IMETHODIMP nsGfxButtonControlFrame::Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -169,25 +183,22 @@ nsGfxButtonControlFrame::Reflow(nsIPresContext& aPresContext, } if ((kSuggestedNotSet != mSuggestedWidth) || - (kSuggestedNotSet != mSuggestedHeight)) - { + (kSuggestedNotSet != mSuggestedHeight)) { + nsHTMLReflowState suggestedReflowState(aReflowState); - + // Honor the suggested width and/or height. if (kSuggestedNotSet != mSuggestedWidth) { suggestedReflowState.mComputedWidth = mSuggestedWidth; - suggestedReflowState.mComputedWidth -= aReflowState.mComputedBorderPadding.left + aReflowState.mComputedBorderPadding.right; } if (kSuggestedNotSet != mSuggestedHeight) { suggestedReflowState.mComputedHeight = mSuggestedHeight; - suggestedReflowState.mComputedHeight -= aReflowState.mComputedBorderPadding.top + aReflowState.mComputedBorderPadding.bottom; } return nsHTMLButtonControlFrame::Reflow(aPresContext, aDesiredSize, suggestedReflowState, aStatus); - } else { - // Normal reflow. + } else { // Normal reflow. return nsHTMLButtonControlFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus); } } diff --git a/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.h b/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.h index 658cec1612a..550f1e9b07c 100644 --- a/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.h +++ b/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.h @@ -53,6 +53,9 @@ public: nsString* aValues, nsString* aNames); virtual void MouseClicked(nsIPresContext* aPresContext); +protected: + NS_IMETHOD AddComputedBorderPaddingToDesiredSize(nsHTMLReflowMetrics& aDesiredSize, + const nsHTMLReflowState& aSuggestedReflowState); private: NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; } NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }