added unknown content quality. fixed potential crash because of bug in timer

code. now uses rootscrollable for all scrollable view notifications.
This commit is contained in:
michaelp%netscape.com 1999-02-16 19:57:45 +00:00
parent 3be12f53e8
commit 980ea68e38
3 changed files with 21 additions and 69 deletions

View File

@ -36,7 +36,8 @@ typedef enum
{
nsContentQuality_kGood = 0,
nsContentQuality_kFair,
nsContentQuality_kPoor
nsContentQuality_kPoor,
nsContentQuality_kUnknown
} nsContentQuality;
#define NS_IVIEWMANAGER_IID \

View File

@ -279,8 +279,10 @@ NS_IMETHODIMP CornerView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
rc.SetColor(NS_RGB(0, 255, 0));
else if (mQuality == nsContentQuality_kFair)
rc.SetColor(NS_RGB(255, 176, 0));
else
else if (mQuality == nsContentQuality_kPoor)
rc.SetColor(NS_RGB(255, 0, 0));
else
rc.SetColor(NS_RGB(0, 0, 255));
//hey, notice that these numbers don't add up... that's because
//something funny happens on windows when the *right* numbers are

View File

@ -241,7 +241,11 @@ NS_IMETHODIMP nsViewManager :: SetFrameRate(PRUint32 aFrameRate)
if (aFrameRate != mFrameRate)
{
NS_IF_RELEASE(mTimer);
if (nsnull != mTimer)
{
mTimer->Cancel(); //XXX this should not be necessary. MMP
NS_RELEASE(mTimer);
}
mFrameRate = aFrameRate;
mTrueFrameRate = aFrameRate;
@ -291,18 +295,8 @@ NS_IMETHODIMP nsViewManager :: SetWindowDimensions(nscoord width, nscoord height
NS_IMETHODIMP nsViewManager :: ResetScrolling(void)
{
if (nsnull != mRootView)
{
nsIScrollableView *scroller;
nsresult retval;
retval = mRootView->QueryInterface(kIScrollableViewIID, (void **)&scroller);
if (NS_SUCCEEDED(retval)) {
scroller->ComputeContainerSize();
}
return retval;
}
if (nsnull != mRootScrollable)
mRootScrollable->ComputeContainerSize();
return NS_OK;
}
@ -1700,71 +1694,26 @@ nsDrawingSurface nsViewManager :: GetDrawingSurface(nsIRenderingContext &aContex
NS_IMETHODIMP nsViewManager :: ShowQuality(PRBool aShow)
{
nsIScrollableView *scroller;
nsresult retval = NS_ERROR_FAILURE;
if (nsnull != mRootScrollable)
mRootScrollable->ShowQuality(aShow);
if (nsnull != mRootView)
{
nsIView *child;
mRootView->GetChild(0, child);
if (nsnull != child)
{
retval = child->QueryInterface(kIScrollableViewIID, (void **)&scroller);
if (NS_SUCCEEDED(retval))
scroller->ShowQuality(aShow);
}
}
return retval;
return NS_OK;
}
NS_IMETHODIMP nsViewManager :: GetShowQuality(PRBool &aResult)
{
nsIScrollableView *scroller;
nsresult retval = NS_ERROR_FAILURE;
if (nsnull != mRootScrollable)
mRootScrollable->GetShowQuality(aResult);
if (nsnull != mRootView)
{
nsIView *child;
mRootView->GetChild(0, child);
if (nsnull != child)
{
retval = child->QueryInterface(kIScrollableViewIID, (void **)&scroller);
if (NS_SUCCEEDED(retval))
scroller->GetShowQuality(aResult);
}
}
return retval;
return NS_OK;
}
NS_IMETHODIMP nsViewManager :: SetQuality(nsContentQuality aQuality)
{
nsIScrollableView *scroller;
nsresult retval = NS_ERROR_FAILURE;
if (nsnull != mRootScrollable)
mRootScrollable->SetQuality(aQuality);
if (nsnull != mRootView)
{
nsIView *child;
mRootView->GetChild(0, child);
if (nsnull != child)
{
retval = child->QueryInterface(kIScrollableViewIID, (void **)&scroller);
if (NS_SUCCEEDED(retval))
scroller->SetQuality(aQuality);
}
}
return retval;
return NS_OK;
}
nsIRenderingContext * nsViewManager :: CreateRenderingContext(nsIView &aView)