зеркало из https://github.com/mozilla/pjs.git
Added checks for null objects so printing would work.
This commit is contained in:
Родитель
6da8634dc3
Коммит
52fbea657c
|
@ -79,6 +79,9 @@ nsresult nsButton::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsButton::SetLabel(const nsString& aText)
|
||||
{
|
||||
if (NULL == mWnd) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_ALLOC_STR_BUF(label, aText, 256);
|
||||
VERIFY(::SetWindowText(mWnd, label));
|
||||
NS_FREE_STR_BUF(label);
|
||||
|
|
|
@ -196,8 +196,12 @@ NS_METHOD nsLabel::GetBounds(nsRect &aRect)
|
|||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsLabel::GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight)
|
||||
{
|
||||
if (nsnull == mContext) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
//nsIFontMetrics * fm = GetFont();;
|
||||
// mDeviceContext->GetMetricsFor(mFont, &fm);
|
||||
|
||||
nsIFontMetrics* metrics;
|
||||
mContext->GetMetricsFor(*mFont, metrics);
|
||||
|
||||
|
|
|
@ -927,6 +927,10 @@ nsIFontMetrics* nsWindow::GetFont(void)
|
|||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsWindow::SetFont(const nsFont &aFont)
|
||||
{
|
||||
if (nsnull == mContext) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsIFontMetrics* metrics;
|
||||
mContext->GetMetricsFor(aFont, metrics);
|
||||
nsFontHandle fontHandle;
|
||||
|
|
Загрузка…
Ссылка в новой задаче