From e061d60a885ae6919ecf1cf536783300ecb82a0c Mon Sep 17 00:00:00 2001 From: "rods%netscape.com" Date: Tue, 25 Jan 2000 15:25:46 +0000 Subject: [PATCH] changed signature of GetFont b=905 r=dcone git-svn-id: svn://10.0.0.236/trunk@58599 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/forms/nsComboboxControlFrame.cpp | 4 ++-- mozilla/layout/forms/nsComboboxControlFrame.h | 2 +- mozilla/layout/forms/nsFileControlFrame.h | 2 +- mozilla/layout/forms/nsFormControlFrame.cpp | 9 ++++---- mozilla/layout/forms/nsFormControlFrame.h | 2 +- .../layout/forms/nsHTMLButtonControlFrame.cpp | 4 ++-- .../layout/forms/nsHTMLButtonControlFrame.h | 2 +- mozilla/layout/forms/nsImageControlFrame.cpp | 9 ++++---- mozilla/layout/forms/nsListControlFrame.cpp | 4 ++-- mozilla/layout/forms/nsListControlFrame.h | 2 +- .../html/forms/src/nsComboboxControlFrame.cpp | 4 ++-- .../html/forms/src/nsComboboxControlFrame.h | 2 +- .../html/forms/src/nsFileControlFrame.h | 2 +- .../html/forms/src/nsFormControlFrame.cpp | 9 ++++---- .../html/forms/src/nsFormControlFrame.h | 2 +- .../html/forms/src/nsGfxListControlFrame.cpp | 4 ++-- .../html/forms/src/nsGfxListControlFrame.h | 2 +- .../forms/src/nsHTMLButtonControlFrame.cpp | 4 ++-- .../html/forms/src/nsHTMLButtonControlFrame.h | 2 +- .../html/forms/src/nsImageControlFrame.cpp | 9 ++++---- .../html/forms/src/nsListControlFrame.cpp | 4 ++-- .../html/forms/src/nsListControlFrame.h | 2 +- .../forms/src/nsNativeButtonControlFrame.cpp | 8 ++++--- .../forms/src/nsNativeSelectControlFrame.cpp | 22 ++++++++++++------- .../forms/src/nsNativeTextControlFrame.cpp | 20 +++++++++++------ .../html/forms/src/nsSelectControlFrame.cpp | 16 +++++++++----- 26 files changed, 83 insertions(+), 69 deletions(-) diff --git a/mozilla/layout/forms/nsComboboxControlFrame.cpp b/mozilla/layout/forms/nsComboboxControlFrame.cpp index 465a7945feb..479216ac38c 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.cpp +++ b/mozilla/layout/forms/nsComboboxControlFrame.cpp @@ -277,8 +277,8 @@ nsComboboxControlFrame::GetFormContent(nsIContent*& aContent) const //-------------------------------------------------------------- NS_IMETHODIMP -nsComboboxControlFrame::GetFont(nsIPresContext* aPresContext, - nsFont& aFont) +nsComboboxControlFrame::GetFont(nsIPresContext* aPresContext, + const nsFont*& aFont) { nsFormControlHelper::GetFont(this, aPresContext, mStyleContext, aFont); return NS_OK; diff --git a/mozilla/layout/forms/nsComboboxControlFrame.h b/mozilla/layout/forms/nsComboboxControlFrame.h index 3024439a87a..5d68665435b 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.h +++ b/mozilla/layout/forms/nsComboboxControlFrame.h @@ -119,7 +119,7 @@ public: virtual PRBool GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues, nsString* aValues, nsString* aNames); NS_IMETHOD GetFont(nsIPresContext* aPresContext, - nsFont& aFont); + const nsFont*& aFont); NS_IMETHOD GetFormContent(nsIContent*& aContent) const; virtual nscoord GetVerticalBorderWidth(float aPixToTwip) const; virtual nscoord GetHorizontalBorderWidth(float aPixToTwip) const; diff --git a/mozilla/layout/forms/nsFileControlFrame.h b/mozilla/layout/forms/nsFileControlFrame.h index 1d1a984eaa9..c90cf974c43 100644 --- a/mozilla/layout/forms/nsFileControlFrame.h +++ b/mozilla/layout/forms/nsFileControlFrame.h @@ -100,7 +100,7 @@ public: void ScrollIntoView(nsIPresContext* aPresContext); NS_IMETHOD GetFont(nsIPresContext* aPresContext, - nsFont& aFont); + const nsFont*& aFont); NS_IMETHOD GetFormContent(nsIContent*& aContent) const; virtual nscoord GetVerticalInsidePadding(nsIPresContext* aPresContext, diff --git a/mozilla/layout/forms/nsFormControlFrame.cpp b/mozilla/layout/forms/nsFormControlFrame.cpp index 0794fa717c0..431b87f3dd6 100644 --- a/mozilla/layout/forms/nsFormControlFrame.cpp +++ b/mozilla/layout/forms/nsFormControlFrame.cpp @@ -364,7 +364,7 @@ nsFormControlFrame::ScrollIntoView(nsIPresContext* aPresContext) nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); presShell->ScrollFrameIntoView(this, - NS_PRESSHELL_SCROLL_ANYWHERE,NS_PRESSHELL_SCROLL_ANYWHERE); + NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE); } } @@ -559,11 +559,10 @@ nsFormControlFrame::GetFormContent(nsIContent*& aContent) const } NS_IMETHODIMP -nsFormControlFrame::GetFont(nsIPresContext* aPresContext, - nsFont& aFont) +nsFormControlFrame::GetFont(nsIPresContext* aPresContext, + const nsFont*& aFont) { - nsFormControlHelper::GetFont(this, aPresContext, mStyleContext, aFont); - return NS_OK; + return nsFormControlHelper::GetFont(this, aPresContext, mStyleContext, aFont); } nsresult diff --git a/mozilla/layout/forms/nsFormControlFrame.h b/mozilla/layout/forms/nsFormControlFrame.h index bc812bec117..23fd9988058 100644 --- a/mozilla/layout/forms/nsFormControlFrame.h +++ b/mozilla/layout/forms/nsFormControlFrame.h @@ -192,7 +192,7 @@ public: virtual void SetFormFrame(nsFormFrame* aFormFrame) { mFormFrame = aFormFrame; } NS_IMETHOD GetFont(nsIPresContext* aPresContext, - nsFont& aFont); + const nsFont*& aFont); NS_IMETHOD GetFormContent(nsIContent*& aContent) const; diff --git a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp index c9c9818c44d..13235e954ee 100644 --- a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp @@ -684,8 +684,8 @@ nsHTMLButtonControlFrame::GetSkipSides() const } NS_IMETHODIMP -nsHTMLButtonControlFrame::GetFont(nsIPresContext* aPresContext, - nsFont& aFont) +nsHTMLButtonControlFrame::GetFont(nsIPresContext* aPresContext, + const nsFont*& aFont) { nsFormControlHelper::GetFont(this, aPresContext, mStyleContext, aFont); return NS_OK; diff --git a/mozilla/layout/forms/nsHTMLButtonControlFrame.h b/mozilla/layout/forms/nsHTMLButtonControlFrame.h index 4aace2ee354..4c902e08dd0 100644 --- a/mozilla/layout/forms/nsHTMLButtonControlFrame.h +++ b/mozilla/layout/forms/nsHTMLButtonControlFrame.h @@ -121,7 +121,7 @@ public: void ScrollIntoView(nsIPresContext* aPresContext); NS_IMETHOD GetFont(nsIPresContext* aPresContext, - nsFont& aFont); + const nsFont*& aFont); NS_IMETHOD GetFormContent(nsIContent*& aContent) const; virtual nscoord GetVerticalInsidePadding(nsIPresContext* aPresContext, diff --git a/mozilla/layout/forms/nsImageControlFrame.cpp b/mozilla/layout/forms/nsImageControlFrame.cpp index abe58c48e18..54d5cdcbf5b 100644 --- a/mozilla/layout/forms/nsImageControlFrame.cpp +++ b/mozilla/layout/forms/nsImageControlFrame.cpp @@ -115,7 +115,7 @@ public: void SetFocus(PRBool aOn, PRBool aRepaint); void ScrollIntoView(nsIPresContext* aPresContext); NS_IMETHOD GetFont(nsIPresContext* aPresContext, - nsFont& aFont); + const nsFont*& aFont); NS_IMETHOD GetFormContent(nsIContent*& aContent) const; virtual nscoord GetVerticalInsidePadding(nsIPresContext* aPresContext, @@ -455,11 +455,10 @@ nsImageControlFrame::MouseClicked(nsIPresContext* aPresContext) } NS_IMETHODIMP -nsImageControlFrame::GetFont(nsIPresContext* aPresContext, - nsFont& aFont) +nsImageControlFrame::GetFont(nsIPresContext* aPresContext, + const nsFont*& aFont) { - nsFormControlHelper::GetFont(this, aPresContext, mStyleContext, aFont); - return NS_OK; + return nsFormControlHelper::GetFont(this, aPresContext, mStyleContext, aFont); } NS_IMETHODIMP diff --git a/mozilla/layout/forms/nsListControlFrame.cpp b/mozilla/layout/forms/nsListControlFrame.cpp index b1bbf4b16ad..a938590732c 100644 --- a/mozilla/layout/forms/nsListControlFrame.cpp +++ b/mozilla/layout/forms/nsListControlFrame.cpp @@ -622,8 +622,8 @@ nsListControlFrame::GetFormContent(nsIContent*& aContent) const //--------------------------------------------------------- NS_IMETHODIMP -nsListControlFrame::GetFont(nsIPresContext* aPresContext, - nsFont& aFont) +nsListControlFrame::GetFont(nsIPresContext* aPresContext, + const nsFont*& aFont) { nsFormControlHelper::GetFont(this, aPresContext, mStyleContext, aFont); return NS_OK; diff --git a/mozilla/layout/forms/nsListControlFrame.h b/mozilla/layout/forms/nsListControlFrame.h index 92806815cde..8ae637d8697 100644 --- a/mozilla/layout/forms/nsListControlFrame.h +++ b/mozilla/layout/forms/nsListControlFrame.h @@ -88,7 +88,7 @@ public: NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); NS_IMETHOD GetMultiple(PRBool* aResult, nsIDOMHTMLSelectElement* aSelect = nsnull); NS_IMETHOD GetFont(nsIPresContext* aPresContext, - nsFont& aFont); + const nsFont*& aFont); NS_IMETHOD GetFormContent(nsIContent*& aContent) const; virtual void SetFocus(PRBool aOn = PR_TRUE, PRBool aRepaint = PR_FALSE); diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp index 465a7945feb..479216ac38c 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -277,8 +277,8 @@ nsComboboxControlFrame::GetFormContent(nsIContent*& aContent) const //-------------------------------------------------------------- NS_IMETHODIMP -nsComboboxControlFrame::GetFont(nsIPresContext* aPresContext, - nsFont& aFont) +nsComboboxControlFrame::GetFont(nsIPresContext* aPresContext, + const nsFont*& aFont) { nsFormControlHelper::GetFont(this, aPresContext, mStyleContext, aFont); return NS_OK; diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.h b/mozilla/layout/html/forms/src/nsComboboxControlFrame.h index 3024439a87a..5d68665435b 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.h +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.h @@ -119,7 +119,7 @@ public: virtual PRBool GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues, nsString* aValues, nsString* aNames); NS_IMETHOD GetFont(nsIPresContext* aPresContext, - nsFont& aFont); + const nsFont*& aFont); NS_IMETHOD GetFormContent(nsIContent*& aContent) const; virtual nscoord GetVerticalBorderWidth(float aPixToTwip) const; virtual nscoord GetHorizontalBorderWidth(float aPixToTwip) const; diff --git a/mozilla/layout/html/forms/src/nsFileControlFrame.h b/mozilla/layout/html/forms/src/nsFileControlFrame.h index 1d1a984eaa9..c90cf974c43 100644 --- a/mozilla/layout/html/forms/src/nsFileControlFrame.h +++ b/mozilla/layout/html/forms/src/nsFileControlFrame.h @@ -100,7 +100,7 @@ public: void ScrollIntoView(nsIPresContext* aPresContext); NS_IMETHOD GetFont(nsIPresContext* aPresContext, - nsFont& aFont); + const nsFont*& aFont); NS_IMETHOD GetFormContent(nsIContent*& aContent) const; virtual nscoord GetVerticalInsidePadding(nsIPresContext* aPresContext, diff --git a/mozilla/layout/html/forms/src/nsFormControlFrame.cpp b/mozilla/layout/html/forms/src/nsFormControlFrame.cpp index 0794fa717c0..431b87f3dd6 100644 --- a/mozilla/layout/html/forms/src/nsFormControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFormControlFrame.cpp @@ -364,7 +364,7 @@ nsFormControlFrame::ScrollIntoView(nsIPresContext* aPresContext) nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); presShell->ScrollFrameIntoView(this, - NS_PRESSHELL_SCROLL_ANYWHERE,NS_PRESSHELL_SCROLL_ANYWHERE); + NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE); } } @@ -559,11 +559,10 @@ nsFormControlFrame::GetFormContent(nsIContent*& aContent) const } NS_IMETHODIMP -nsFormControlFrame::GetFont(nsIPresContext* aPresContext, - nsFont& aFont) +nsFormControlFrame::GetFont(nsIPresContext* aPresContext, + const nsFont*& aFont) { - nsFormControlHelper::GetFont(this, aPresContext, mStyleContext, aFont); - return NS_OK; + return nsFormControlHelper::GetFont(this, aPresContext, mStyleContext, aFont); } nsresult diff --git a/mozilla/layout/html/forms/src/nsFormControlFrame.h b/mozilla/layout/html/forms/src/nsFormControlFrame.h index bc812bec117..23fd9988058 100644 --- a/mozilla/layout/html/forms/src/nsFormControlFrame.h +++ b/mozilla/layout/html/forms/src/nsFormControlFrame.h @@ -192,7 +192,7 @@ public: virtual void SetFormFrame(nsFormFrame* aFormFrame) { mFormFrame = aFormFrame; } NS_IMETHOD GetFont(nsIPresContext* aPresContext, - nsFont& aFont); + const nsFont*& aFont); NS_IMETHOD GetFormContent(nsIContent*& aContent) const; diff --git a/mozilla/layout/html/forms/src/nsGfxListControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxListControlFrame.cpp index 73dcd114ad1..f6f2ab0fcff 100644 --- a/mozilla/layout/html/forms/src/nsGfxListControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxListControlFrame.cpp @@ -650,8 +650,8 @@ nsGfxListControlFrame::GetFormContent(nsIContent*& aContent) const //--------------------------------------------------------- NS_IMETHODIMP -nsGfxListControlFrame::GetFont(nsIPresContext* aPresContext, - nsFont& aFont) +nsGfxListControlFrame::GetFont(nsIPresContext* aPresContext, + const nsFont*& aFont) { nsFormControlHelper::GetFont(this, aPresContext, mStyleContext, aFont); return NS_OK; diff --git a/mozilla/layout/html/forms/src/nsGfxListControlFrame.h b/mozilla/layout/html/forms/src/nsGfxListControlFrame.h index 827d003147d..ea8240770a3 100644 --- a/mozilla/layout/html/forms/src/nsGfxListControlFrame.h +++ b/mozilla/layout/html/forms/src/nsGfxListControlFrame.h @@ -89,7 +89,7 @@ public: NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); NS_IMETHOD GetMultiple(PRBool* aResult, nsIDOMHTMLSelectElement* aSelect = nsnull); NS_IMETHOD GetFont(nsIPresContext* aPresContext, - nsFont& aFont); + const nsFont*& aFont); NS_IMETHOD GetFormContent(nsIContent*& aContent) const; virtual void SetFocus(PRBool aOn = PR_TRUE, PRBool aRepaint = PR_FALSE); diff --git a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp index c9c9818c44d..13235e954ee 100644 --- a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp @@ -684,8 +684,8 @@ nsHTMLButtonControlFrame::GetSkipSides() const } NS_IMETHODIMP -nsHTMLButtonControlFrame::GetFont(nsIPresContext* aPresContext, - nsFont& aFont) +nsHTMLButtonControlFrame::GetFont(nsIPresContext* aPresContext, + const nsFont*& aFont) { nsFormControlHelper::GetFont(this, aPresContext, mStyleContext, aFont); return NS_OK; diff --git a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.h b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.h index 4aace2ee354..4c902e08dd0 100644 --- a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.h +++ b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.h @@ -121,7 +121,7 @@ public: void ScrollIntoView(nsIPresContext* aPresContext); NS_IMETHOD GetFont(nsIPresContext* aPresContext, - nsFont& aFont); + const nsFont*& aFont); NS_IMETHOD GetFormContent(nsIContent*& aContent) const; virtual nscoord GetVerticalInsidePadding(nsIPresContext* aPresContext, diff --git a/mozilla/layout/html/forms/src/nsImageControlFrame.cpp b/mozilla/layout/html/forms/src/nsImageControlFrame.cpp index abe58c48e18..54d5cdcbf5b 100644 --- a/mozilla/layout/html/forms/src/nsImageControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsImageControlFrame.cpp @@ -115,7 +115,7 @@ public: void SetFocus(PRBool aOn, PRBool aRepaint); void ScrollIntoView(nsIPresContext* aPresContext); NS_IMETHOD GetFont(nsIPresContext* aPresContext, - nsFont& aFont); + const nsFont*& aFont); NS_IMETHOD GetFormContent(nsIContent*& aContent) const; virtual nscoord GetVerticalInsidePadding(nsIPresContext* aPresContext, @@ -455,11 +455,10 @@ nsImageControlFrame::MouseClicked(nsIPresContext* aPresContext) } NS_IMETHODIMP -nsImageControlFrame::GetFont(nsIPresContext* aPresContext, - nsFont& aFont) +nsImageControlFrame::GetFont(nsIPresContext* aPresContext, + const nsFont*& aFont) { - nsFormControlHelper::GetFont(this, aPresContext, mStyleContext, aFont); - return NS_OK; + return nsFormControlHelper::GetFont(this, aPresContext, mStyleContext, aFont); } NS_IMETHODIMP diff --git a/mozilla/layout/html/forms/src/nsListControlFrame.cpp b/mozilla/layout/html/forms/src/nsListControlFrame.cpp index b1bbf4b16ad..a938590732c 100644 --- a/mozilla/layout/html/forms/src/nsListControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsListControlFrame.cpp @@ -622,8 +622,8 @@ nsListControlFrame::GetFormContent(nsIContent*& aContent) const //--------------------------------------------------------- NS_IMETHODIMP -nsListControlFrame::GetFont(nsIPresContext* aPresContext, - nsFont& aFont) +nsListControlFrame::GetFont(nsIPresContext* aPresContext, + const nsFont*& aFont) { nsFormControlHelper::GetFont(this, aPresContext, mStyleContext, aFont); return NS_OK; diff --git a/mozilla/layout/html/forms/src/nsListControlFrame.h b/mozilla/layout/html/forms/src/nsListControlFrame.h index 92806815cde..8ae637d8697 100644 --- a/mozilla/layout/html/forms/src/nsListControlFrame.h +++ b/mozilla/layout/html/forms/src/nsListControlFrame.h @@ -88,7 +88,7 @@ public: NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); NS_IMETHOD GetMultiple(PRBool* aResult, nsIDOMHTMLSelectElement* aSelect = nsnull); NS_IMETHOD GetFont(nsIPresContext* aPresContext, - nsFont& aFont); + const nsFont*& aFont); NS_IMETHOD GetFormContent(nsIContent*& aContent) const; virtual void SetFocus(PRBool aOn = PR_TRUE, PRBool aRepaint = PR_FALSE); diff --git a/mozilla/layout/html/forms/src/nsNativeButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsNativeButtonControlFrame.cpp index 45907f45ceb..4e7f6e6dbf4 100644 --- a/mozilla/layout/html/forms/src/nsNativeButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsNativeButtonControlFrame.cpp @@ -84,9 +84,11 @@ nsNativeButtonControlFrame::PostCreateWidget(nsIPresContext* aPresContext, nscoo { nsIButton* button = nsnull; if (mWidget && (NS_OK == mWidget->QueryInterface(kIButtonIID,(void**)&button))) { - nsFont font(aPresContext->GetDefaultFixedFontDeprecated()); - GetFont(aPresContext, font); - mWidget->SetFont(font); + const nsFont * font = nsnull; + nsresult res = GetFont(aPresContext, font); + if (NS_SUCCEEDED(res) && font != nsnull) { + mWidget->SetFont(*font); + } SetColors(aPresContext); nsAutoString value; diff --git a/mozilla/layout/html/forms/src/nsNativeSelectControlFrame.cpp b/mozilla/layout/html/forms/src/nsNativeSelectControlFrame.cpp index e4f56620ae9..5296f388ff4 100644 --- a/mozilla/layout/html/forms/src/nsNativeSelectControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsNativeSelectControlFrame.cpp @@ -610,9 +610,11 @@ nsNativeSelectControlFrame::PostCreateWidget(nsIPresContext* aPresContext, } mWidget->Enable(!nsFormFrame::GetDisabled(this)); - nsFont font(aPresContext->GetDefaultFixedFontDeprecated()); - GetFont(aPresContext, font); - mWidget->SetFont(font); + const nsFont * font; + nsresult res = GetFont(aPresContext, font); + if (NS_SUCCEEDED(res) && font != nsnull) { + mWidget->SetFont(*font); + } SetColors(aPresContext); // add the options @@ -932,10 +934,12 @@ nsNativeSelectControlFrame::PaintSelectControl(nsIPresContext* aPresContext, aRenderingContext.SetColor(NS_RGB(0,0,0)); - nsFont font(aPresContext->GetDefaultFixedFontDeprecated()); - GetFont(aPresContext, font); - - aRenderingContext.SetFont(font); + const nsFont * font = nsnull; + nsresult res = GetFont(aPresContext, font); + if (NS_SUCCEEDED(res) && font != nsnull) { + mWidget->SetFont(*font); + aRenderingContext.SetFont(*font); + } //nscoord textWidth; nscoord textHeight; @@ -943,7 +947,9 @@ nsNativeSelectControlFrame::PaintSelectControl(nsIPresContext* aPresContext, // Calculate the height of the text nsIFontMetrics* metrics; - context->GetMetricsFor(font, metrics); + if (font != nsnull) { + context->GetMetricsFor(*font, metrics); + } metrics->GetHeight(textHeight); // Calculate the width of the scrollbar diff --git a/mozilla/layout/html/forms/src/nsNativeTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsNativeTextControlFrame.cpp index 350bb0262a3..2ec35ee4391 100644 --- a/mozilla/layout/html/forms/src/nsNativeTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsNativeTextControlFrame.cpp @@ -249,9 +249,10 @@ nsNativeTextControlFrame::PostCreateWidget(nsIPresContext* aPresContext, PRInt32 type; GetType(&type); - nsFont font(aPresContext->GetDefaultFixedFontDeprecated()); - GetFont(aPresContext, font); - mWidget->SetFont(font); + const nsFont * font = nsnull; + if (NS_SUCCEEDED(GetFont(aPresContext, font))) { + mWidget->SetFont(*font); + } SetColors(aPresContext); PRUint32 ignore; @@ -406,10 +407,13 @@ nsNativeTextControlFrame::PaintTextControl(nsIPresContext* aPresContext, aRenderingContext.SetColor(NS_RGB(0,0,0)); - nsFont font(aPresContext->GetDefaultFixedFontDeprecated()); - GetFont(aPresContext, font); + const nsFont * font = nsnull; + nsresult res = GetFont(aPresContext, font); + if (NS_SUCCEEDED(res) && font != nsnull) { + mWidget->SetFont(*font); + aRenderingContext.SetFont(*font); + } - aRenderingContext.SetFont(font); nscoord textWidth; nscoord textHeight; @@ -417,7 +421,9 @@ nsNativeTextControlFrame::PaintTextControl(nsIPresContext* aPresContext, aRenderingContext.GetWidth(aText, textWidth); nsIFontMetrics* metrics; - context->GetMetricsFor(font, metrics); + if (font != nsnull) { + context->GetMetricsFor(*font, metrics); + } metrics->GetHeight(textHeight); PRInt32 type; diff --git a/mozilla/layout/html/forms/src/nsSelectControlFrame.cpp b/mozilla/layout/html/forms/src/nsSelectControlFrame.cpp index 76a2798a746..bd4f5e68167 100644 --- a/mozilla/layout/html/forms/src/nsSelectControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsSelectControlFrame.cpp @@ -553,9 +553,11 @@ nsSelectControlFrame::PostCreateWidget(nsIPresContext* aPresContext, } mWidget->Enable(!nsFormFrame::GetDisabled(this)); - nsFont font(aPresContext->GetDefaultFixedFontDeprecated()); - GetFont(aPresContext, font); - mWidget->SetFont(font); + const nsFont * font = nsnull; + nsresult res = GetFont(aPresContext, font); + if (NS_SUCCEEDED(res) && font != nsnull) { + mWidget->SetFont(font); + } SetColors(aPresContext); // add the options @@ -874,10 +876,12 @@ nsSelectControlFrame::PaintSelectControl(nsIPresContext* aPresContext, aRenderingContext.SetColor(NS_RGB(0,0,0)); - nsFont font(aPresContext->GetDefaultFixedFontDeprecated()); - GetFont(aPresContext, font); + const nsFont * font = nsnull; + nsresult res = GetFont(aPresContext, font); + if (NS_SUCCEEDED(res) && font != nsnull) { + aRenderingContext.SetFont(font); + } - aRenderingContext.SetFont(font); //nscoord textWidth; nscoord textHeight;